Problem renaming - 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: Problem renaming (
/showthread.php?tid=326699)
Problem renaming -
jcvag44800 - 18.03.2012
Hi guys.
I have a problem to change the name of the player
This is the code:
Код:
format(string,sizeof string,"%s [AFK]",name);
SetPlayerName(playerid,string);
The name not changed...
Regards.
Re: Problem renaming -
Ronaldo_raul™ - 18.03.2012
Try this -
pawn Код:
new name [ MAX_PLAYER_NAME ] ;
GetPlayerName ( playerid , name , MAX_PLAYER_NAME ) ;
new string [ 128 ] ;
format ( string , 128 , "%s [AFK]" , name ) ;
SetPlayerName ( playerid , string ) ;
Re : Problem renaming -
jcvag44800 - 18.03.2012
Yes, already...
Код:
new name[MAX_PLAYER_NAME], string[24+MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
Re : Problem renaming -
jcvag44800 - 18.03.2012
Not work, help plz !
Re: Re : Problem renaming -
Ronaldo_raul™ - 18.03.2012
Quote:
Originally Posted by jcvag44800
Yes, already...
Код:
new name[MAX_PLAYER_NAME], string[24+MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
|
why your doing 24+MAX_PLAYER_NAME ?
and didn't i gave you the whole AFK command ? Just add your AFK variable and your done boom.
Re : Problem renaming -
jcvag44800 - 18.03.2012
Not work...
Код:
if (strcmp("/afk", cmdtext, true, 10) == 0)
{
new name [ MAX_PLAYER_NAME ] ;
GetPlayerName ( playerid , name , MAX_PLAYER_NAME ) ;
new string [ 128 ] ;
if(jAFK[playerid] == 0)
{
format ( string , 128 , "%s [AFK]" , name ) ;
SetPlayerName ( playerid , string ) ;
SendClientMessage(playerid,COLOR_WHITE,"Vous кtes AFK, pour vous enlever AFK, taper la commande /afk de nouveau.");
jAFK[playerid] = 1;
GetPlayerPos(playerid,x[playerid],y[playerid],z[playerid]);
TogglePlayerControllable(playerid,0);
format(string,sizeof string,"%s est maintenant AFK.",name);
SendClientMessageToAll(COLOR_WHITE,string);
PlayerPlaySound(playerid, 1068, 0.0, 0.0, 0.0);
timer = SetTimerEx("afkkick", 1800000,true, "i", playerid);
timer2 = SetTimerEx("afkrandom", 3000,true, "i", playerid);
return 1;
}
else
{
jAFK[playerid] = 0;
TogglePlayerControllable(playerid,1);
format(string,sizeof string,"%s n'est plus AFK.",name);
SendClientMessageToAll(COLOR_WHITE,string);
PlayerPlaySound(playerid,1098,0.0,0.0,0.0);
KillTimer(timer);
KillTimer(timer2);
etape = 0;
SetPlayerPos(playerid,x[playerid],y[playerid],z[playerid]);
SetCameraBehindPlayer(playerid);
format(string,sizeof string,"%s",name);
SetPlayerName(playerid,string);
return 1;
}
Re: Problem renaming -
Ronaldo_raul™ - 18.03.2012
What actually is not working.
And what are you doing is when the player is AFK your setting his name to %s [AFK]
and getting his name again so you get %s [AFK]
which your actually setting his name again to the same.
Re : Problem renaming -
jcvag44800 - 18.03.2012
I did not understand ^ ^ '
You can speak English more easily x)?
Re: Problem renaming -
Ronaldo_raul™ - 18.03.2012
I thought i was too good in english as i score best marks in it.
Never-mind.
Concentrate Ok.
My name was Ronaldo_raul after using the /afk command the command named me Ronaldo_raul [AFK]
and now when i again type /afk to get back your code again gets my name which is Ronaldo_raul [AFK]
after that your code sets my name according to what it got which is Ronaldo_raul [AFK]. So the script FAILS.
Re : Problem renaming -
jcvag44800 - 18.03.2012
Ok ^ ^
And how can I fix this?