Player id number - 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: Player id number (
/showthread.php?tid=90036)
Player id number -
Head$hot - 05.08.2009
Hey, i am learning to script and i am just wondering how to get a players id number, i am makin a script that has a /heal <playerid> command, and when u type it i want some text to come up on the player who got healed saying 'You have been healed by <player name>' if you understand me?
lol :S if its not clear enough then i will make it clearer for ya
please reply quick cause i havnt got much time
cheers
HeadShot
Re: Player id number -
JaTochNietDan - 05.08.2009
Simple example using dcmd and sscanf, a great combination for making commands
pawn Код:
dcmd_heal(playerid,params[])
{
if(sscanf(params,"i",strval(params))) SendClientMessage(playerid,red,"Usage: /heal <playerid>");
else
{
if(!IsPlayerConnected(strval(params))) return SendClientMessage(playerid,red,"Error, player not found!");
SetPlayerHealth(strval(params),100);
format(string,sizeof(string),"You have been healed by %s",PlayerName(strval(params)));
SendClientMessage(strval(params),red,string);
}
return 1;
}
Hope that helps.
Note, you will need to define certain things to make this work with your script, this is merely an example to get you started
Re: Player id number -
Head$hot - 05.08.2009
thanks
looks helpful