String
#1

Does someone know how to fix this,
This is my code:
[pawn] if (strcmp(cmdtext, "/helpls", true)==0)
{
new string[128];
format(string,sizeof(string),"%s Is Requesting Support At LS.");
SendClientMessageToAll(0xFF0000,string);
return 1;
}
[pawn]
In-game This Says: jlefgmnos ---------------------------- Is Requesting Support At LS
Its supposed to say: Torran Is Requesting Support At LS

Does anyone know how to stop this saying:
jlefgmnos ---------------------------- Is Requesting Support At LS

And start saying:
[playername] Is Requesting Support At LS,

[playername] is the players name from whoever said it,
Example if a guy named michael typed /helpls
It would say Michael is requesting support at ls,
Although if someone called torran typed /helpls
It would say Torran is requesting support at ls,

Any help will be good, Ty
Reply
#2

pawn Код:
format(string,sizeof(string),"%s Is Requesting Support At LS.", sendername);
Reply
#3

Also, use GetPlayerName.
Reply
#4

I get undefined symbol sendername,
If i define it i got alot more errors,
Any suggestions.
Reply
#5

pawn Код:
if (strcmp(cmdtext, "/helpls", true)==0)
  {
      new string[128];
      GetPlayerName(playerid, sendername, sizeof(sendername));
      format(string,sizeof(string),"%s Is Requesting Support At LS.", sendername);
      SendClientMessageToAll(0xFF0000,string);
      return 1;
  }
Reply
#6

And if he doesn't have 'sendername' defined?..
Also better to make a global string, instead of make a string in each public.
I rather do something like
new string[1024];
in top of script, instead of
new string[128]; in each public.

If sendername isn't defined for you, add this.
pawn Код:
new sendername[24];
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)