SA-MP Forums Archive
String - 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: String (/showthread.php?tid=73369)



String - JoeDaDude - 14.04.2009

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


Re: String - [IB]Scorcher - 14.04.2009

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



Re: String - SpiderPork - 14.04.2009

Also, use GetPlayerName.


Re: String - JoeDaDude - 14.04.2009

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


Re: String - [IB]Scorcher - 14.04.2009

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



Re: String - MenaceX^ - 14.04.2009

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