28.07.2012, 14:35
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.
//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;
}
#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;
}