SendClientMessage Help -
Brickwood - 19.10.2010
I'm new to all of this and am still fiddling with bits and pieces but I need help on some testing..
For example I made a test command that is /test and I want it to say the players id and then say "is testing".
So basically I want to know how to put a playerid into a client message.
Thank you very much, and sorry if this is in the wrong section.
Re: SendClientMessage Help -
Retardedwolf - 19.10.2010
pawn Код:
new string[22];
format(string, sizeof(string), "( %d ), said testing", playerid);
SendClientMessage(playerid, 0xFFFFFFAA, string);
Re: SendClientMessage Help -
Brickwood - 20.10.2010
Quote:
Originally Posted by Retardedwolf
pawn Код:
new string[22]; format(string, sizeof(string), "( %d ), said testing", playerid); SendClientMessage(playerid, 0xFFFFFFAA, string);
|
it ends up saying ( 0 ), said testing, how do I make it say their name?
Thankyou for the help man
Re: SendClientMessage Help -
Crayon - 20.10.2010
I believe you change %d to %s, I'm not exactly sure though, sorry!
Re: SendClientMessage Help -
Andrus - 20.10.2010
Quote:
Originally Posted by Brickwood
it ends up saying ( 0 ), said testing, how do I make it say their name?
Thankyou for the help man
|
new string[22];
new plrname[MAX_PLAYER_NAME];
GetPlayerName(playerid, plrname, sizeof(plrname));
format(string, sizeof(string), "( %s ), said testing", plrname);
SendClientMessage(playerid, 0xFFFFFFAA, string);
Re: SendClientMessage Help -
Crayon - 20.10.2010
Woohoo, I was right
Re: SendClientMessage Help -
Brickwood - 20.10.2010
Quote:
Originally Posted by Andrus
new string[22];
new plrname[MAX_PLAYER_NAME];
GetPlayerName(playerid, plrname, sizeof(plrname));
format(string, sizeof(string), "( %s ), said testing", plrname);
SendClientMessage(playerid, 0xFFFFFFAA, string);
|
I have this;
Quote:
if(KillingSpree[killerid] == 5)
{
new string[22];
new plrname[MAX_PLAYER_NAME];
GetPlayerName(killerid, plrname, sizeof(plrname));
format(string, sizeof(string), "( %s ) got 5 kills in a row!", plrname);
SendClientMessage(killerid, 0xFFFFFFAA, string);
}
|
but it says "( their name ) go" :S
do i need the string[22] to be larger?
Re: SendClientMessage Help -
Retardedwolf - 20.10.2010
Quote:
Originally Posted by Brickwood
do i need the string[22] to be larger?
|
pawn Код:
new string[MAX_PLAYER_NAME];
Re: SendClientMessage Help -
iggy1 - 20.10.2010
Use this function for names it makes life easier place at bottom of script.
pawn Код:
stock playername(playerid)
{
new pName[MAX_PLAYER_NAME];
GetPlayerName(playerid, pName, MAX_PLAYER_NAME);
return pName;
}
Then wherever you put this (onplayerdeath?)
pawn Код:
if(KillingSpree[killerid] == 5)
{
new string[64];
format(string, sizeof(string), "( %s ) got 5 kills in a row!", playername(playerid));//this is how yopu use the playername function.
SendClientMessage(killerid, 0xFFFFFFAA, string);
}
Ps the array you mentioned should have been larger.
Re: SendClientMessage Help -
Brickwood - 20.10.2010
Thank you all for the help, it's done me some good.