IRC Scripting help
#1

hello

I was putting 2 new codes in my script (!score and !fakemsg)

Both give same bug: It says invalid ID while the player with that ID is connected
Код:
[Ask]Sk8er> !ping 1
<Shizzle>  [Ask]Sk8er's ping is 42
<[Ask]Sk8er> !fakemsg 1 fu
<Shizzle> Error: Invalid player ID.
Here are the command codes:

Код:
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;
}
Some1 can help meh?
Reply
#2

why are you doing ID = strval(params)

ID is stored in there from sscanf take strval(params) from ID

also put GetPlayerName after it checks if the player is connected
Reply
#3

Also you don't need to check if the player is connected as sscanf does that for you.

use this instead:

pawn Код:
if(ID == INVALID_PLAYER_ID)
    return ircsay(conn, channel, "4*** Error: Invalid player ID.");
Reply
#4

Resolved, plz lock :P
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)