SA-MP Forums Archive
Target ID. - 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: Target ID. (/showthread.php?tid=483345)



Target ID. - Jason_Roul - 25.12.2013

So, let's say I want to set a player's name, how do I target HIS ID to be changed? Like, HIS name and not mine (playerid).


Re: Target ID. - Zex Tan - 25.12.2013

First, use sscanf and create 2 variables, target and newname.

Second, update his/her account name (if you're using file saving/MySQL)

Lastly, use SetPlayerName to a new name.


Re: Target ID. - SilentSoul - 25.12.2013

Declare new variable of the target id
pawn Код:
new targetid;
Here's a simple example
pawn Код:
CMD:setname(playerid,params[])
{
    new targetid;
    SetPlayerName(targetid,params);
    return 1;
}
EDIT: Ops sorry i was too late.


Re: Target ID. - Jason_Roul - 25.12.2013

Thanks a lot you both! I never thought targetid actually existed hehe, thanks.
And yeah, I've already done the variable name, I just didnt know targetid existed at all :P.