Little Problem with string.
#1

Hello guys,
PHP код:
    format(stringsizeof(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
Reply
#2

Help please? REP+ for who would help.
Reply
#3

Maybe the name is not save into "name" variabile, check your GetPlayerName function(if you have one)
Reply
#4

You need to assign the player name to the variable "name", you can do this with the GetPlayerName
Reply
#5

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
Reply
#6

Show us how you get the players name
Reply
#7

DELETE Didn't work..
Any other?
Reply
#8

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(playeridszNamesizeof(szName));
    return 
szName;

and use
PHP код:
format(stringsizeof(string), "* {FFFFFF}%s(%d) is now AFK {00ff00}(Away From Keyboard).",GetName(playerid),playerid);
SendClientMessageToAll(-1,string); 
Next Time Contact me
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)