Both give same bug: It says invalid ID while the player with that ID is connected
Код:
irccmd_score(conn, channel[], user[], params[])
{
if(!ircIsVop(conn,channel,user)) return AccessDenied(user);
new ID = strval(params), PlayerName[24], tString[256], PlayerScore[24];
if(sscanf(params,"s",ID))return ircSay(conn,channel,"3Usage:1 !score <PartOfName/PlayerID>");
if(!IsPlayerConnected(ID))return ircSay(conn,channel,"4*** Error: Invalid player ID.");
format(tString,sizeof(tString),"3* Score from %s: %d",PlayerName,ID,PlayerScore);
GetPlayerScore(ID);
ircSay(BotSwitcher(),channel,tString);
#pragma unused conn, user
return true;
}
irccmd_fakemsg(conn, channel[], user[], params[])
{
if(!ircIsOp(conn,channel,user)) return AccessDenied(user);
new ID = strval(params),tString[128], PlayerName[24], msg[100];
GetPlayerName(ID, PlayerName, sizeof(PlayerName));
if(sscanf(params,"ss",ID,msg)) return ircSay(conn,channel,"3Usage:1 !fakemsg <PartOfName/PlayerID> <Message>");
if(!IsPlayerConnected(ID))return ircSay(conn,channel,"5Error: Invalid player ID.");
SendPlayerMessageToAll(ID,msg);
format(tString,sizeof(tString),"[%d] 07%s: %s",ID,PlayerName,msg);
ircSay(BotSwitcher(),channel,tString);
#pragma unused user,conn
return true;
}
Also you don't need to check if the player is connected as sscanf does that for you.