How to add player name or id to this. - 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: How to add player name or id to this. (
/showthread.php?tid=347265)
How to add player name or id to this. -
Gangster-rocks - 01.06.2012
pawn Код:
if (strcmp("/duty", cmdtext, true, 10) == 0)
{ SetPlayerSkin(playerid,287);
GivePlayerWeapon(playerid,23,100);
GivePlayerWeapon(playerid,30,1000);
SetPlayerColor(playerid,0xFFC7FF);
SendClientMessageToAll(0xEF0A00,"Army member is now onduty please ask him for help you");
// player dead
How can i add his name.
Re: How to add player name or id to this. -
MP2 - 01.06.2012
You need to use
format():
pawn Код:
new szString[128], pName[MAX_PLAYER_NAME+1];
GetPlayerName(playerid, pName, MAX_PLAYER_NAME);
format(szString, sizeof(szString), "Army member %s is now on duty, please ask him to help you.", pName);
SendClientMessageToAll(0xEF0A00, szString);
Re: How to add player name or id to this. -
Sandiel - 01.06.2012
You will need ZCMD and SSCANF2 for this...
Код:
COMMAND:duty(playerid, params[])
{
new str[128], pName[MAX_PLAYER_NAME];
GetPlayerName(playerid, pName, sizeof(pName));
format(str, sizeof(str), "** Army memeber %s (ID:%d) is now on duty **", pName, playerid);
SendClientMessageToAll(COLOR_YELLOW, str);
SetPlayerSkin(playerid,287);
GivePlayerWeapon(playerid,23,100);
GivePlayerWeapon(playerid,30,1000);
SetPlayerColor(playerid,0xFFC7FF);
return 1;
}
Try to understand about strings, will help you alot!
Respuesta: How to add player name or id to this. -
Chris1337 - 01.06.2012
Remember that SendClientMessage without a format you cant add strings %s %i %d
Re: How to add player name or id to this. -
pasha97 - 01.06.2012
even a month ago i didn't know how to do that, but then i joined this forum and learned a lot