/checkmask doesn't work.
#1

Hello.

So I have a mask system at my server, where players can take on a mask and then it shows Stranger_RandomNumber.

To make this able to work we made a command so admins can check who's behind the mask, the cmd is called /checkmask. However, the cmd doesnt work. It just shows "This MaskID doesn't exist!"

Can someone show me what to do to fix this?

/mask command.
pawn Код:
CMD:mask(playerid, params[])
{
    //new name[MAX_PLAYER_NAME];
    new string[128];
    if (PlayerInfo[playerid][pMaskOwner] == 1)
    {
        if(PlayerInfo[playerid][pMask] == 0)
        {
            new rand = 1000 + random(8999);
            MaskID[playerid] = rand;
            foreach(Player, i)
            {
                ShowPlayerNameTagForPlayer(i, playerid, false);
            }
            PlayerInfo[playerid][pMask] = 1;
            format(string, sizeof(string), "\n\nStranger_%d", MaskID[playerid]);
            MaskLabel[playerid] = CreateDynamic3DTextLabel(string, WHITE, 0, 0, -20, 25, playerid);
            Streamer_SetFloatData(STREAMER_TYPE_3D_TEXT_LABEL, MaskLabel[playerid] , E_STREAMER_ATTACH_OFFSET_Z, 0.30);
            format(string, sizeof(string), "* %s has put a mask on.", RemoveUnderScore(playerid));
            ProxDetector(15.0, playerid, string,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
        }
        else if(PlayerInfo[playerid][pMask] == 1)
        {
            DestroyDynamic3DTextLabel(MaskLabel[playerid]);
            foreach(Player, i)
            {
                ShowPlayerNameTagForPlayer(i, playerid, true);
            }
            DestroyDynamic3DTextLabel(MaskLabel[playerid]);
            //MaskID[playerid] = 0;
            PlayerInfo[playerid][pMask] = 0;
            format(string, sizeof(string), "* %s has put their mask away.", RemoveUnderScore(playerid));
            ProxDetector(15.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
        }
    }
    else
    {
        SendClientMessageEx(playerid, COLOR_WHITE, "You haven't bought a mask.");
    }
    return 1;
}
stock MaskName
pawn Код:
stock MaskName(playerid)
{
    new string[128];
    if(PlayerInfo[playerid][pMask] == 1) format(string, sizeof(string), "Stranger %d", MaskID[playerid]);
    else format(string, sizeof(string), "%s", RemoveUnderScore(playerid));
    return string;
}
/checkmask command
pawn Код:
CMD:checkmask(playerid, params[])
{
    if(PlayerInfo[playerid][pAdmin] > 0)
    {
        new maski;
        if(sscanf(params, "i", maski)) return SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /checkmask [maskid] ( gives playername&playerid of maskid )");
        {
            if(maski < 1000 || maski > 9999) return SendClientMessageEx(playerid, COLOR_WHITE, "Error: MaskID can't be less than 1000 or higher than 9999.");
            {
                foreach(Player, i)
                {
                    if(MaskID[i] == maski)
                    {
                        if(IsPlayerConnected(i))
                        {
                            new str[120];
                            format(str, sizeof(str), "MaskID %i belongs to %s (%i)", maski, RemoveUnderScore(i), i);
                            SendClientMessageEx(playerid, COLOR_GREEN, str);
                        }
                        else return SendClientMessageEx(playerid, COLOR_WHITE, "Error: No one was found with that MaskID.");
                    }
                    else return SendClientMessageEx(playerid, COLOR_WHITE, "Error: No one was found with that MaskID.");
                }
            }
        }
    }
    else return SendClientMessageEx(playerid, COLOR_WHITE, "You are not authorized to use this command.");
    return 1;
}
Reply
#2

pawn Код:
CMD:checkmask(playerid, params[])
{
    new maski;
    if(PlayerInfo[playerid][pAdmin] < 1)    return SendClientMessageEx(playerid, COLOR_WHITE, "You are not authorized to use this command.");
    if(sscanf(params, "u", maski))          return SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /checkmask [maskid] ( gives playername&playerid of maskid )");
    if(maski == INVALID_PLAYER_ID)          return SendClientMessageEx(playerid, COLOR_WHITE, "Error Not conected.");
    if(MaskID[maski] > 999)
    {
        new str[120];
        format(str, sizeof(str), "MaskID %i belongs to %s (%i)", maski, RemoveUnderScore(i), i);
        SendClientMessageEx(playerid, COLOR_GREEN, str);
        return 1;
    }
    else
    {
        SendClientMessageEx(playerid, COLOR_GREEN, "Not");
    }
    return 1;
}
Reply
#3

Quote:
Originally Posted by Tirael
Посмотреть сообщение
pawn Код:
CMD:checkmask(playerid, params[])
{
    new maski;
    if(PlayerInfo[playerid][pAdmin] < 1)    return SendClientMessageEx(playerid, COLOR_WHITE, "You are not authorized to use this command.");
    if(sscanf(params, "u", maski))          return SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /checkmask [maskid] ( gives playername&playerid of maskid )");
    if(maski == INVALID_PLAYER_ID)          return SendClientMessageEx(playerid, COLOR_WHITE, "Error Not conected.");
    if(MaskID[maski] > 999)
    {
        new str[120];
        format(str, sizeof(str), "MaskID %i belongs to %s (%i)", maski, RemoveUnderScore(i), i);
        SendClientMessageEx(playerid, COLOR_GREEN, str);
        return 1;
    }
    else
    {
        SendClientMessageEx(playerid, COLOR_GREEN, "Not");
    }
    return 1;
}
Not working.
Reply
#4

pawn Код:
CMD:checkmask(playerid, params[])
{
    if(PlayerInfo[playerid][pAdmin] < 1)    return SendClientMessageEx(playerid, COLOR_WHITE, "You are not authorized to use this command.");
    if(sscanf(params, "u", params[0]))      return SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /checkmask [params[0]d] ( gives playername&playerid of params[0]d )");
    if(params[0] == INVALID_PLAYER_ID)      return SendClientMessageEx(playerid, COLOR_WHITE, "Error Not conected.");
    if(MaskID[params[0]] > 999)
    {
        new str[120];
        format(str, sizeof(str), "MaskID %d belongs to %s (%i)", MaskID[params[0], RemoveUnderScore(params[0]), params[0]);
        SendClientMessageEx(playerid, COLOR_GREEN, str);
        return 1;
    }
    else
    {
        SendClientMessageEx(playerid, COLOR_GREEN, "Not");
    }
    return 1;
}
It should work.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)