Little Problem with 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)
+--- Thread: Little Problem with string. (
/showthread.php?tid=625014)
Little Problem with string. -
RyderX - 26.12.2016
Hello guys,
PHP код:
format(string, sizeof(string), "* {FFFFFF}%s is now AFK {00ff00}(Away From Keyboard).",name);
i were making AFK system, and Tested it and got this :
http://imgur.com/5tjsnzy
the problem is why the name of the player doesn't appear when he type /afk... isn't the code correct?
OK OK BROTHER I'VE SOLVED IT 
Re: Little Problem with string. -
RyderX - 26.12.2016
Help please? REP+ for who would help.
Re: Little Problem with string. -
Banditul18 - 26.12.2016
Maybe the name is not save into "name" variabile, check your GetPlayerName function(if you have one)
Re: Little Problem with string. -
4D1L - 26.12.2016
You need to assign the player name to the variable "name", you can do this with the
GetPlayerName
Re: Little Problem with string. -
ISmokezU - 26.12.2016
Show "name"
Example..
Код:
stock name(playerid) {
new pName[MAX_PLAYER_NAME];
GetPlayerName(playerid, pName, sizeof(pName));
return pName;
}
format(string, sizeof(string), "* {FFFFFF}%s(%d) is now AFK {00ff00}(Away From Keyboard).",name(playerid),playerid);
SendClientMessageToAll(-1,string);
Edit: all these replies
Re: Little Problem with string. -
BiosMarcel - 26.12.2016
Show us how you get the players name
Re: Little Problem with string. -
RyderX - 26.12.2016
DELETE Didn't work..
Any other?
Re: Little Problem with string. -
Yaa - 26.12.2016
Quote:
Originally Posted by RyderX
DELETE Didn't work..
Any other?
|
put this in ur last lines of script
PHP код:
stock GetName(playerid)
{
new szName[MAX_PLAYER_NAME];
GetPlayerName(playerid, szName, sizeof(szName));
return szName;
}
and use
PHP код:
format(string, sizeof(string), "* {FFFFFF}%s(%d) is now AFK {00ff00}(Away From Keyboard).",GetName(playerid),playerid);
SendClientMessageToAll(-1,string);
Next Time Contact me