Jump to content
  • 0

pomoc SCM


play

Dotaz

zdravím potřeboval bych poradit udělal jsem si funkci pro SCM(playerid,color,text[],argumenty....); 

ale nefunguje mi %s. 

 

např:

SCM(playerid,-1,"vítej %s",Name(playerid));
 
 
native SCM(playerid,color,string,text[], {Float,_}:...);
native chrfind(FindText,Text[]);




#define SCM SCM_play
#define chrfind chrfind_play




stock SCM_play(playerid,color,text[], {Float,_}:...){
new MAX_ARGUMENT_play = numargs();
new MIN_ARGUMENT_play = 3;
new String_Play[256];
new String_2_Play[10][50];
new GetP=0;


if(MAX_ARGUMENT_play != MIN_ARGUMENT_play)
{
for(new i = MIN_ARGUMENT_play ; i < MAX_ARGUMENT_play ; i++)
{
    new p=chrfind_play('%',text,GetP);
    new ss[50];
GetP=p+1;
if(text[p+1] == 's')
{
format(String_2_Play[i-MIN_ARGUMENT_play],50,"%s",getarg(i));
ss=String_2_Play[i-MIN_ARGUMENT_play];
strins(text,String_2_Play[i-MIN_ARGUMENT_play],p,sizeof(ss));
strdel(text,p+strlen(String_2_Play[i-MIN_ARGUMENT_play]),p+strlen(String_2_Play[i-MIN_ARGUMENT_play])+2);
}
else if (text[p+1] == 'd')
{
format(String_2_Play[i-MIN_ARGUMENT_play],50,"%d",getarg(i));
ss=String_2_Play[i-MIN_ARGUMENT_play];
strins(text,String_2_Play[i-MIN_ARGUMENT_play],p,sizeof(ss));
strdel(text,p+strlen(String_2_Play[i-MIN_ARGUMENT_play]),p+strlen(String_2_Play[i-MIN_ARGUMENT_play])+2);
}
else if (text[p+1] == 'f')
{
format(String_2_Play[i-MIN_ARGUMENT_play],50,"%f",getarg(i));
ss=String_2_Play[i-MIN_ARGUMENT_play];
strins(text,String_2_Play[i-MIN_ARGUMENT_play],p,sizeof(ss));
strdel(text,p+strlen(String_2_Play[i-MIN_ARGUMENT_play]),p+strlen(String_2_Play[i-MIN_ARGUMENT_play])+2);
}
else if (text[p+1] != 's' || 'd' || 'f')
{
format(String_2_Play[i-MIN_ARGUMENT_play],50,"Error",getarg(i));
ss=String_2_Play[i-MIN_ARGUMENT_play];
strins(text,String_2_Play[i-MIN_ARGUMENT_play],p,sizeof(ss));
strdel(text,p+strlen(String_2_Play[i-MIN_ARGUMENT_play]),p+strlen(String_2_Play[i-MIN_ARGUMENT_play])+2);
}
}
}


format(String_Play,sizeof(String_Play),text);
SendClientMessage(playerid,color,String_Play);
return 1;
}


stock chrfind_play(FindText,Text[],s=0)
{
new String=strlen(Text);


while(s<String)
{
if(Text[s]==FindText) return s;
s++;
}
return -1;
}

Dík za rady :d

 

Opraveno 

Link to comment
Share on other sites

2 odpovědí na tuto otázku

Recommended Posts

  • 0

//----------------NEW

new plname[MAX_PLAYER_NAME];

//----------------------

 

GetPlayerName(playerid, plname, sizeof(plname));

SCM(playerid,-1,"vítej %s",Name(playerid));

 

 

:)

Link to comment
Share on other sites

  • 0

to vím mám to přes stock Name(playerid)

problém je v tom stock SCM prostě to pak jen napíše "vítej p1" ti p1 je první písmeno stringu a 1  nvm :d

%d a %f jde v pohodě 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...