Mask question
#1

Evening all, I got a question,

I got a mask system and it change your whole name, even when you go offline its saves your mask name, how can you change that to your normal name,

pawn Код:
CMD:mask(playerid, params[])
{
    if(IsPlayerConnected(playerid))
    {
        if(Masked[playerid] == false)
        {
            new pname[24];
            new Maskid = random(200);
            new string[35];
            GetPlayerName(playerid, pname, sizeof(pname));
            Masked[playerid] = true;
            strmid(OldName[playerid], pname, 0, strlen(pname), 64);
            format(string,sizeof(string), "Masked[%d]", Maskid);
            SetPlayerName(playerid, string);
            SendClientMessage(playerid, COLOR_LIGHTRED, "* You have put on your mask.");
            format(string, sizeof(string), "%s is now masked ID %d",pname, Maskid);
            SendAdminMessage(COLOR_DARKRED, 1, string);
            for(new i=0;i<MAX_PLAYERS;i++)
            {
                ShowPlayerNameTagForPlayer(i, playerid, 0);
            }
        }
        else
        {
            SetPlayerName(playerid, OldName[playerid]);
            Masked[playerid] = false;
            SendClientMessage(playerid, COLOR_LIGHTRED, "* You have removed your mask.");
            for(new i=0;i<MAX_PLAYERS;i++)
            {
                ShowPlayerNameTagForPlayer(i, playerid, 1);
            }
        }
    }
    return 1;
}
I hope you understand what i mean
Reply
#2

pawn Код:
//onplayerconnect
new pname[MAX_PLAYER_NAME];
GetPlayerName(playerid,pname,sizeof(pname));
oldname[playerid] = pname;
have you tryed to save the name of player in a global variable when he connect?
Reply
#3

Quote:
Originally Posted by Galletziz
Посмотреть сообщение
pawn Код:
//onplayerconnect
new pname[MAX_PLAYER_NAME];
GetPlayerName(playerid,pname,sizeof(pname));
oldname[playerid] = pname;
have you tryed to save the name of player in a global variable when he connect?
works thanks.. But how can you set this
To the normal names and not to the mask names
Reply
#4

Its not good to Change a players NAME to maskID when they do Mask...
Do this..
PHP код:
new MASKNAME[MAX_PLAYERS][24];
stock PlayerName(playerid)
{
    if(
Masked[playerid]==true)
    {
        return 
MASKNAME[playerid];
    }
    else
    {
        new 
Name[24];
        
GetPlayerName(playeridName24);
        return 
Name;
    }
}
CMD:mask(playeridparams[])
{
    if(
IsPlayerConnected(playerid))
    {
        if(
Masked[playerid] == false)
        {
            new 
pname[24];
            new 
Maskid random(200);
            new 
string[35];
            
GetPlayerName(playeridpnamesizeof(pname));
            
Masked[playerid] = true;
            
strmid(OldName[playerid], pname0strlen(pname), 64);
            
format(string,sizeof(string), "Masked[%d]"Maskid);
            
MASKNAME[playerid]=string
            SendClientMessage
(playeridCOLOR_LIGHTRED"* You have put on your mask.");
            
format(stringsizeof(string), "%s is now masked ID %d",pnameMaskid);
            
SendAdminMessage(COLOR_DARKRED1string);
            for(new 
i=0;i<MAX_PLAYERS;i++)
            {
                
ShowPlayerNameTagForPlayer(iplayerid0);
            }
            }
            else
            {
            
SetPlayerName(playeridOldName[playerid]);
            
Masked[playerid] = false;
            
SendClientMessage(playeridCOLOR_LIGHTRED"* You have removed your mask.");
            for(new 
i=0;i<MAX_PLAYERS;i++)
            {
                
ShowPlayerNameTagForPlayer(iplayerid1);
            }
        }
    }
    return 
1;

Edit: And Instead of using GetPlayerName, use PlayerName() for all RP process..
Reply


Forum Jump:


Users browsing this thread: