CMD:clan(playerid,params[]){
if(sscanf(params,"s",TinyString)) return MSG(playerid,C_RED,"/Clan [Invite/Kick/Join/Leave/SetRank/SetTag]");
if(strval(TinyString) == strval("Invite")) return MSG(playerid,C_RED,"Invite");
if(strval(TinyString) == strval("Kick")) return MSG(playerid,C_RED,"Kick");
return 1;}
CMD:clan(playerid,params[]){ if(sscanf(params,"s",TinyString)) return MSG(playerid,C_RED,"/Clan [Invite/Kick/Join/Leave/SetRank/SetTag]"); if(strval(TinyString) == strval("Invite")) return MSG(playerid,C_RED,"Invite"); else if(strval(TinyString) == strval("Kick")) return MSG(playerid,C_RED,"Kick"); return 1;}
Код:
CMD:clan(playerid,params[]){ if(sscanf(params,"s",TinyString)) return MSG(playerid,C_RED,"/Clan [Invite/Kick/Join/Leave/SetRank/SetTag]"); if(strval(TinyString) == strval("Invite")) return MSG(playerid,C_RED,"Invite"); else if(strval(TinyString) == strval("Kick")) return MSG(playerid,C_RED,"Kick"); return 1;} |
CMD:clan(playerid,params[])
{
new string[50];
if(sscanf(params,"s[50]",string)) return MSG(playerid,C_RED,"/Clan [Invite/Kick/Join/Leave/SetRank/SetTag]");
if(strcmp(string, "Invite")) return MSG(playerid,C_RED,"Invite");
else if(strcmp(string, "Kick")) return MSG(playerid,C_RED,"Kick");
return 1;
}
Код:
CMD:clan(playerid,params[]){ if(sscanf(params,"s",TinyString)) return MSG(playerid,C_RED,"/Clan [Invite/Kick/Join/Leave/SetRank/SetTag]"); if(strval(TinyString) == strval("Invite")) return MSG(playerid,C_RED,"Invite"); else if(strval(TinyString) == strval("Kick")) return MSG(playerid,C_RED,"Kick"); return 1;} |
It will not work. You try to check NUMBER with letters!
You need STRCMP. Ex: if(strcmp(s, "Invite")) return MSG(playerid,C_RED,"Invite"); |
CMD:clan(playerid,params[]){
if(sscanf(params,"s",TinyString)) return MSG(playerid,C_RED,"/Clan [Invite/Kick/Join/Leave/SetRank/SetTag]");
if(strcmp(TinyString, "Invite")) return MSG(playerid,C_RED,"Invite");
if(strcmp(TinyString, "Kick")) return MSG(playerid,C_RED,"Kick");
return 1;}
Almost.
https://sampwiki.blast.hk/wiki/Strcmp This function returns difference between two strings. If the return is 0, it means they are equal (might be case insensitive). So, you need to check for !strcmp(s, "Invite"), or strcmp(s, "Invite") == 0. If you want to work with numbers, use y_stringhash |