SA-MP Forums Archive
/pm = crashing server - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: /pm = crashing server (/showthread.php?tid=179037)



/pm = crashing server - Seven. - 25.09.2010

pawn Код:
dcmd_pm(playerid, params[])
{
    new targetid;
    new string[128];
    new message[128];
    if(sscanf(params,"uz",targetid,message)) return SM(playerid,red,"Error: /pm [id/name] [message]");
   
    format(string, sizeof(string),"PM: %s(id: %d): %s",gPlayer[playerid][gName],message);
    SendClientMessage(targetid,PLAYER_COLOR_YELLOW,string);
    return 1;
}
When typing /pm it will crash the server.


Re: /pm = crashing server - Mikkel_Pedersen - 25.09.2010

pawn Код:
format(string, sizeof(string),"PM: %s(id: %d): %s",gPlayer[playerid][gName],message);
//you only defined name & message not the id.
//Although i don't know if that can crash the server.



Re: /pm = crashing server - Mauzen - 25.09.2010

Quote:
Originally Posted by Mikkel_Pedersen
Посмотреть сообщение
pawn Код:
format(string, sizeof(string),"PM: %s(id: %d): %s",gPlayer[playerid][gName],message);
//you only defined name & message not the id.
//Although i don't know if that can crash the server.
Yes, this crashes the server.

pawn Код:
format(string, sizeof(string),"PM: %s(id: %d): %s",gPlayer[playerid][gName], playerid, message);
//Use that line, I added the playerid to the params