SA-MP Forums Archive
I need a little help! - 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: I need a little help! (/showthread.php?tid=66375)



I need a little help! - low_High2 - 21.02.2009

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.


Re: I need a little help! - yom - 21.02.2009

You have to use the function format


Re: I need a little help! - MenaceX^ - 21.02.2009

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

PlayerName depends on your name varielb.e


Re: I need a little help! - low_High2 - 21.02.2009

thanks


Re: I need a little help! - MenaceX^ - 21.02.2009

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



Re: I need a little help! - yom - 21.02.2009

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);



Re: I need a little help! - low_High2 - 21.02.2009

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




Re: I need a little help! - MenaceX^ - 21.02.2009

Then fix the indentation.