#1

Hey guys I don't have any single clue how does this happened.. I have perfect mask system, when player write /mask there is a random number above his head - 3Dtext label, but when he write mask this number doesn't goes off - It didn't destroyed that 3Dtext label, so I asked him if he tried /mask, but he said he didn't even write that command so is possible that if other player write /mask and one X player will be affected with this also? .. I checked the script and I didn't found nothing.. So I actually don't even know how the hell it happened that number appears above his head if he didn't used the command :S

here is the whole mask cmd

pawn Код:
if (strcmp("/mask", cmdtext, true, 5) == 0)
    {
    #define NAME_DRAWDISTANCE (5)
    if(Smask[playerid] == 0) return SendClientMessage(playerid,0xFF0000AA,"You dont have a mask!");
    if(IsPlayerConnected(playerid))
    {
        if(Masked[playerid] == 0)
        {
            for(new i = 0; i < MAX_PLAYERS; i++)
            {
                if(IsPlayerConnected(i))
                {
                    ShowPlayerNameTagForPlayer(i, playerid, 0);
                }
            }
            ApplyAnimation(playerid, "SHOP", "ROB_Shifty", 4.1,0,0,0,0,0); // Anim to avoid bug when Animations doesn't apply
            Masked[playerid] = 1;
            maskid[playerid] = random(999); // Assinging number to player it will server as his ID at name

            format(string, sizeof(string), "%d",maskid[playerid]);
            MaskIDLab[playerid] = Create3DTextLabel(string, 0xFFFFFFFF, 0, 0, 0, NAME_DRAWDISTANCE, 0, 1 ); // Creating label
            Attach3DTextLabelToPlayer(string, playerid, 0.0, 0.0, 0.2); // Attaching it above their head

            MaskTimer[playerid] = SetTimerEx("MaskAnim", 100, false, "i", playerid); // Timer for Applying animation and triggering another timer
            msk[0] = SetPlayerAttachedObject(playerid, 1, 19037, 5, 0.067999, 0.030000, 0.026000, 105.800018, 87.500038, 30.699975,1.000000,1.000000,1.000000,0,0); // Mask in left hand, so it's looking cool with Animation..
            SendClientMessage(playerid, COLOR_LIGHTGREEN, "You are now wearing a mask.");
            return 1;
        }
        else if(Masked[playerid] == 1) // If player will write /mask again his mask will be removed
        {
            if(IsPlayerConnected(playerid))
            {
                for(new i = 0; i < MAX_PLAYERS; i++)
                {
                    if(IsPlayerConnected(playerid))
                    {
                        ShowPlayerNameTagForPlayer(i, playerid, 1); // Showing player's tag for other player
                    }
                }
                Delete3DTextLabel(MaskIDLab[playerid]);
                Masked[playerid] = 0;
                ClearAnimations(playerid); // To avoid bugging /mask if player spam /mask CMD
                KillTimer(MaskTimer[playerid]); // To avoid bugging /mask if player spam /mask CMD
                KillTimer(MaskTime[playerid]); // Same as above..
                if(IsPlayerAttachedObjectSlotUsed(playerid, 1)) RemovePlayerAttachedObject(playerid, msk[1]); // Removing his mask
                SendClientMessage(playerid, COLOR_LIGHTGREEN, "You took off your mask.");
                Smask[playerid] --;
                return 1;
            }
        }
    }
    return 1;
    }
I have this on Top of script also

pawn Код:
new Text3D:MaskIDLab[MAX_PLAYERS];
+ When player reconnected he still had that number above his head along with his name :S but the main problem is how the hell this number appeared above his head if he didn't even used the command? REP + for helpers
Reply
#2

Destroy the 3DTextLabel if a player has one in OnPlayerDisconnect. Otherwise it will stay for the next player to join the server with the same ID.

You don't need that first condition checking if the player is connected since only connected players can enter commands.
Reply
#3

Okay thanks for your help you helped me a lot:

There was a player with ID 5 who did /mask and /q so there was number 256 above his head, that means other player connected with ID 5 so that number appears at his head and nobody knew how the fuck can this happen ^^ So I tested it and friend was ID 5 and that number was there, so yeah I was thinking that might be something with disconnecting and I was right but with your help now I'm sure it was that, one BIG rep+ for you ty
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)