(BUG SCRIPT) Weapons duplication - Unsync player

Hello, before to strat I just want to say : I'm not english so sorry if my english is not perfect.

I have a little problem on my server SA:MP. I have a script to drop a weapon, but when a player is Unsync (with the server), he can drop weapon to infinity (the unsync player keep the weapon in his hand but the weapon is dropped too ).

So, I want to make a security, if the player is unsync, and he drop his weapon AND he keep the weapon in this hand, i want to delete the weapon (in this hand OR on the floor)

This is my code

if(strcmp(subcmd, "weapon", true) == 0)
            if(GetPlayerWeapon(playerid) == 0)
                {SendClientMessage(playerid, COLOR_PINK, "[Info] You want to have your weapon in your hand."); return 1;}
            if(PlayerInfo[playerid][pMember] == 5 || PlayerInfo[playerid][pMember] == 8 || PlayerInfo[playerid][pMember] == 15 || PlayerInfo[playerid][pMember] == 20)
                 if(OnDuty[playerid]){SendClientMessage(playerid, COLOR_PINK, "[Info]You can't do that now."); return 1;}
            new indice = -1;
            new wepId = GetPlayerWeapon(playerid);
            new ammo = GetPlayerAmmo(playerid);
            print("Lancement Boucle 57");
            for(i=0; i<drop_weapondsDropableCount; i++)
                if(wepId ==drop_weapondsDropableId[i])
                    {indice = i; break;}
            print("Fin Boucle 57");
            if(indice >= 0)
                new f = MAX_GUNDROP+1;
                for(new a = 0; a < MAX_GUNDROP; a++)
                    if(dGunData[a][ObjPos][0] ==0.0)
                        f = a;
                if(f > MAX_GUNDROP) returnSendClientMessage(playerid, -1, "You can't do that now.");
                RemovePlayerWeapon(playerid, wepId);
                dGunData[f][ObjData][0] = wepId;
                dGunData[f][ObjData][1] = ammo;
                GetPlayerPos(playerid, dGunData[f][ObjPos][0], dGunData[f][ObjPos][1], dGunData[f][ObjPos][2]);
                dGunData[f][ObjID] =CreateObject(GunObjects[wepId], dGunData[f][ObjPos][0], dGunData[f][ObjPos][1], dGunData[f][ObjPos][2]-1, 93.7, 120.0, 120.0);
                new buffer[50];
                format(buffer, sizeof(buffer), "you dropped your %s on the floor.", GunNames[dGunData[f][ObjData][0]]);
                SendClientMessage(playerid, -1, buffer);
                format(proxy_msg, sizeof(proxy_msg), "%s drop a weapon on the floor.", playername);
                proxy_teteMsg(playerid, proxy_msg);
                {SendClientMessage(playerid, COLOR_PINK, "[Info] Impossible now."); return 1;}
            return 1;

Keep the track of weapons on player and store that inside a variable.

Hi, thanks TwinkiDaBoss !

But, Have u an example please ? I don't really see how to start the track

Forum Jump:

Users browsing this thread: 1 Guest(s)