/mask doesnt work properly
#1

Can someone help me with this, it doesn't change there name back. It switches to a new name:
Say if its Masked_19, If you type /mask again it would switch to Masked_23.
Код:
new isMasked[MAX_PLAYERS];
new OldUsername[MAX_PLAYER_NAME][MAX_PLAYERS];
Код:
CMD:mask(playerid, params[]) {

    if(playerVariables[playerid][pGroup] != 7) {

        if(isMasked[playerid] == 0) {

            new randomID = random(200);
            new string[35];

            GetPlayerName(playerid, string, sizeof(string));
            strmid(OldUsername[playerid], string, 0, strlen(string), 64);
            format(string,sizeof(string), "Masked_%d", randomID);
            SetPlayerName(playerid, string);
            SendClientMessage(playerid, COLOR_GREY, "You have put on a mask! (/mask to disable)");
        }
        else return SendClientMessage(playerid, COLOR_GREY, "You do now have the right privillages to use this command.");

    }
    else
    {
        SetPlayerName(playerid, OldUsername[playerid]);
        isMasked[playerid] = 1;
        SendClientMessage(playerid, COLOR_GREY, "You have taken off your mask!");
    }
    return 1;
}
Reply
#2

pawn Код:
CMD:mask(playerid, params[])
{
    //I guess only Team 7 can use it. Line below this one is set that only Team 7 can use it. If you want that everyone except 7 ca use it
    // replace != 7 with == 7
    if(playerVariables[playerid][pGroup] != 7) return SendClientMessage(playerid, COLOR_GREY, "You do not have the right privillages to use this command.");
    if(isMasked[playerid] == 0)
    {
        new randomID = random(200);
        new string[35];
        isMasked[playerid] = 1;//Now you set that player has mask
        GetPlayerName(playerid, string, sizeof(string));
        strmid(OldUsername[playerid], string, 0, strlen(string), 64);
        format(string,sizeof(string), "Masked_%d", randomID);
        SetPlayerName(playerid, string);
        SendClientMessage(playerid, COLOR_GREY, "You have put on a mask! (/mask to disable)");
    }
    else
    {
        SetPlayerName(playerid, OldUsername[playerid]);
        isMasked[playerid] = 0;//here it has to be 0, not 1 because he took his mask off. Also I indentet your code a bit better
        SendClientMessage(playerid, COLOR_GREY, "You have taken off your mask!");
    }
    return 1;
}
Your confusion. Read comment lines inside script. Have fun.
Reply
#3

Thanks Dimi, but it still changes to a different name
Reply
#4

FIXED.
Reply
#5

Can lock this
Reply
#6

Why comment when I said it's fixed, Obviously a mod will lock it and delete it.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)