Problem renaming
#1

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.
Reply
#2

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 ) ;
Reply
#3

Yes, already...

Код:
new name[MAX_PLAYER_NAME], string[24+MAX_PLAYER_NAME];
        GetPlayerName(playerid, name, sizeof(name));
Reply
#4

Not work, help plz !
Reply
#5

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

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

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.
Reply
#8

I did not understand ^ ^ '

You can speak English more easily x)?
Reply
#9

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.
Reply
#10

Ok ^ ^

And how can I fix this?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)