26.07.2013, 08:34
Hi all,
I've faced an issue with sscanf for the first time.
whenever i try to use a command on ID 2 it says "Invalid player/Player not connected"
So if you've ever faced this issue and fixed it succesfully please let me know how.
It might be a fail from me too , here's a code :
If you know how to fix it or you've seen it on a topic or find anything that might help please reply.
I've faced an issue with sscanf for the first time.
whenever i try to use a command on ID 2 it says "Invalid player/Player not connected"
So if you've ever faced this issue and fixed it succesfully please let me know how.
It might be a fail from me too , here's a code :
pawn Код:
#define IsValidPlayer(%0) \
(id_buf = (%0), 0 <= id_buf < MAX_PLAYERS && IsPlayerConnected(id_buf))
COMMAND:kick(playerid,params[])
{
if(!AdminCommandCheck(playerid,"/kick"))
return 1;
new id,reason[128];
if(sscanf(params,"us[128]",id,reason))
return SendSyntaxWarning(playerid,"/kick <ID/Name> <Grund>");
if(!IsValidPlayer(id))
return SendLanguageMessage(playerid,COLOR_WARNING,"<$> -Warnung-<#> Ungueltige ID!","<$> -Warning-<#> Invalid ID!");
if(IsPlayerHigherAdminAsPlayer(playerid,id))
{
if(IsValidPlayer(id) && id!=playerid)
{
KickPlayer(id,reason,PlayerName[playerid],playerid);
return 1;
}
else
return SendLanguageMessage(playerid,COLOR_WARNING,"<$> -Warnung-<#> Ungueltige ID!","<$> -Warning-<#> Invalid ID!");
}
else
return SendLanguageMessage(playerid,COLOR_WARNING,"<$> -Warnung-<#> Der Spieler hat ein gleiches oder hoeheres Level, du kannst ihn nicht kicken!","<$> -Warning-<#> You can't kick a player with a higher level then yours!");
}
stock SendSyntaxWarning(playerid,cmd[])
{
new string[128];
if(GetPlayerLanguage(playerid)==LANG_DE)
format(string,sizeof(string),"<$> -Warnung-<#> Anwendung: %s",cmd);
else
format(string,sizeof(string),"<$> -Warning-<#> Usage: %s",cmd);
return SendClientMessageEx(playerid,COLOR_WARNING,string);
}