I need a little help!
#1

Quote:

if (strcmp("/kill", cmdtext, true, 5) == 0)
{
SetPlayerHealth(playerid, 0.0);
SendClientMessageToAll(0x33AA33AA, " "NAME" has made Suicide!");
return 1;

Ok i have this and i placed there to tell you the "NAME" now...I want when some one uses /kill to send a client msg to every one Hes name, and that made suicide.

I tried using another code it was something like "$" but it didn't work, can some one tell me about this please i really need it.
Reply
#2

You have to use the function format
Reply
#3

format(string,sizeof(string),"%s has decided a suicide.",PlayerName(playerid));
SendClientMessageToAll(0x33AA33AA,string);
return true;
}

PlayerName depends on your name varielb.e
Reply
#4

thanks
Reply
#5

Use this as a PlayerName varieble.
pawn Код:
PlayerName(playerid)
{
  new name[24];
  GetPlayerName(playerid,name,24);
  return name;
}
Reply
#6

Alternatively, you can use something like that:
pawn Код:
new SMTA_String[128];
#define SendMessageToAll(%0,%1); \
{\
  format(SMTA_String, sizeof SMTA_String, %1);\
  SendClientMessageToAll(%0, SMTA_String);\
}
So you can just do
pawn Код:
SendMessageToAll(0xFFFFFFFF, "%s has decided a suicide", playername);
Reply
#7

it says " loose indentation" and i edited them to "SendClientMessageToAll".

Reply
#8

Then fix the indentation.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)