SA-MP Forums Archive
Question about saving a playerid - 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)
+--- Thread: Question about saving a playerid (/showthread.php?tid=536132)



Question about saving a playerid - AkaSKY - 07.09.2014

Is there a way to save a player (for example killerid from "OnPlayerDeath") and use it in other callback (for example in "OnPlayerCommandText") without using sscanf?


Re: Question about saving a playerid - CutX - 07.09.2014

//EDIT: fixed something...im always too fast when writing stuff :P

you could do this:
pawn Код:
//global
new someID;

//somewhere in OnPlayerDeath
someID = killerid;

//somewhere in OnPlayerCommandText
//do your thing with "someID" as killerid of OnPlayerDeath here
you could also trigger OnPlayerCommandText by doing
pawn Код:
OnPlayerCommandText(killerid,"_");
//and then parse cmdtext of OnPlayerCommandText at the top for "_"
but i'd rather not suggest doing it like that.
decide 4 yourself


Re: Question about saving a playerid - AkaSKY - 07.09.2014

Thank you, but because you made an array variable, it must be indexed, so i think it would be ok without [MAX_PLAYERS] (global variable)...