How to add player name or id to this.
#1

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.
Reply
#2

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);
Reply
#3

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!
Reply
#4

Remember that SendClientMessage without a format you cant add strings %s %i %d
Reply
#5

even a month ago i didn't know how to do that, but then i joined this forum and learned a lot
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)