SA-MP Forums Archive
Help with one thing. - 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: Help with one thing. (/showthread.php?tid=363715)



Help with one thing. - TaLhA XIV - 28.07.2012

just a small question that if I type a command,the player name turns to wolf and when I again type the command it turns back t its original name.Please help.


Re: Help with one thing. - Dolby - 28.07.2012

If I understand you question,you can use SetPlayerName,you need save the original name in a variable,and later, restore to original name.


Re: Help with one thing. - TaLhA XIV - 28.07.2012

realy can't figure it out please help me with some codes please.


Re: Help with one thing. - Dolby - 28.07.2012

pawn Код:
//Top:
new Name[MAX_PLAYERS][MAX_PLAYER_NAME];
new bool:Changed[MAX_PLAYERS];
//Command
CMD:wolf(playerid,params[])
{
     if(Changed[playerid] == false)
     {
          GetPlayerName(playerid,Name[playerid],24);
          SetPlayerName(playerid,"Wolf");
          Changed[playerid] = true;
          return 1;
     }
     else
     {
          SetPlayerName(playerid,Name[playerid]);
          Changed[playerid] = false;
          return 1;
     }
     return 1;
}
Try.


Re: Help with one thing. - Alexis1999 - 28.07.2012

pawn Код:
#include <a_samp>
#include <zcmd>

new OldName[128];
new i =0;

public OnPlayerDisconnect(playerid)
{
    if( i == 1 )
    {
        SetPlayerName(playerid, OldName);
    }
    return 1;
}

CMD:name(playerid, params[])
{
        GetPlayerName(playerid, OldName, sizeof(OldName));
        SetPlayerName(playerid, "Wolf");
        SendClientMessage(playerid, -1, "Your name was setted to Wolf");
        i=1;
        return 1;
}

CMD:restorename(playerid, params[])
{
    SetPlayerName(playerid, OldName);
    new String[128];
    format(String, sizeof(String), "Your name was restored to %s", OldName);
    SendClientMessage(playerid, -1, String);
    i=0;
    return 1;
}
EDIT: Oh I didn't see the previous post :O