Problem
#1

I got the following command.

Код:
	if (strcmp("/nameoff", cmdtext, true, 5) == 0)
	{
    if (NameOff[playerid] == 0)
    {
		 SetPlayerName(playerid,"Unknown");
     NameOff[playerid] = 1;
		 return 1;
		}
		else
		{
     NameOff[playerid] = 0;
     return 1;
    }
	}
How can I make ti like,if the player types again /nameoff it will set his name back to his previous name.
Thanks
Reply
#2

Quote:
Originally Posted by FreeSoul
I got the following command.

Код:
	if (strcmp("/nameoff", cmdtext, true, 5) == 0)
	{
    if (NameOff[playerid] == 0)
    {
		 SetPlayerName(playerid,"Unknown");
    NameOff[playerid] = 1;
		 return 1;
		}
		else
		{
     NameOff[playerid] = 0;
     return 1;
    }
	}
How can I make ti like,if the player types again /nameoff it will set his name back to his previous name.
Thanks
Код:
	if (strcmp("/nameoff", cmdtext, true, 5) == 0)
	{
	new playername[26][MAX_PLAYERS];
    if (NameOff[playerid] == 0)
    {
		GetPlayerName(playerid, playername[playerid], 26);
		 SetPlayerName(playerid,"Unknown");
     NameOff[playerid] = 1;
		 return 1;
		}
		else
		{
     NameOff[playerid] = 0;
	SetPlayerName(playerid,playername[playerid]);
     return 1;
    }
	}
Reply
#3

I changed it a bit so it fits my gamemode.
It changes his name to Unknown,but when he does it again it doesn't change his name back.

Код:
  if (strcmp("/nameoff", cmdtext, true, 5) == 0)
	{
    if(PlayerInfo[playerid][pMember] == 11 || PlayerInfo[playerid][pLeader] == 11)
		{
	  GetPlayerName(playerid, playername, sizeof(playername));
    if (NameOff[playerid] == 0)
    {
		 GetPlayerName(playerid, playername, sizeof(playername));
		 SetPlayerName(playerid,"Unknown");
    NameOff[playerid] = 1;
		 return 1;
		}
		else
		{
     NameOff[playerid] = 0;
	   SetPlayerName(playerid,playername);
     return 1;
    }
    }
	}
Reply
#4

Quote:
Originally Posted by FreeSoul
I changed it a bit so it fits my gamemode.
It changes his name to Unknown,but when he does it again it doesn't change his name back.

Код:
  if (strcmp("/nameoff", cmdtext, true, 5) == 0)
	{
    if(PlayerInfo[playerid][pMember] == 11 || PlayerInfo[playerid][pLeader] == 11)
		{
	  GetPlayerName(playerid, playername, sizeof(playername));
    if (NameOff[playerid] == 0)
    {
		 GetPlayerName(playerid, playername, sizeof(playername));
		 SetPlayerName(playerid,"Unknown");
    NameOff[playerid] = 1;
		 return 1;
		}
		else
		{
     NameOff[playerid] = 0;
	   SetPlayerName(playerid,playername);
     return 1;
    }
    }
	}
wait i fail.

pawn Код:
// top script
new pName[26][MAX_PLAYERS];

// on connect
GetPlayerName(playerid, pName[playerid], 26);

// command.
SetPlayerName(playerid, pName[playerid]);
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)