Drop weapons problem...HELP
#1

Hey im making that i can do /dump guns, so all the weapons the player are holding will be shown on the floor, but when i do /dump guns it will only drop the weapon that im holding, can you please help me with this?

CODE:

pawn Код:
if(strcmp(tmp,"guns",true)==0)
            {
                new gunID = GetPlayerWeapon(playerid);
                new gunAmmo = GetPlayerAmmo(playerid);
                if(gunID != 0 && gunAmmo != 0)
                {
                    new f = MAX_OBJ+1;
                    for(new a = 0; a < sizeof(ObjCoords); a++)
                    {
                        if(ObjCoords[a][0] == 0.0)
                        {
                            f = a;
                            break;
                        }
                    }
                    for(new i = 1;i < 12;i++)
                    {
                        if(PlayerInfo[playerid][pMember] == 1)
                        {
                            SendClientMessage(playerid, COLOR_GREY, " You cannot drop weapons in this faction !");
                            return 1;
                        }
                        if(PlayerInfo[playerid][pMember] == 2)
                        {
                            SendClientMessage(playerid, COLOR_GREY, " You cannot drop weapons in this faction !");
                            return 1;
                        }
                        if(PlayerInfo[playerid][pMember] == 3)
                        {
                            SendClientMessage(playerid, COLOR_GREY, " You cannot drop weapons in this faction !");
                            return 1;
                        }
                        if(gunID == pGun[playerid][i])
                        {
                            if(f > MAX_OBJ) return SendClientMessage(playerid, COLOR_GRAD1, "You can not throw weapons at the moment, try back later!!");
                            new WeaponNames[25];
                            new buffer[100];
                            GetWeaponName(gunID, WeaponNames, sizeof(WeaponNames));
                            format(buffer, sizeof(buffer), "You threw away your all your weapons");
                            SendClientMessage(playerid, COLOR_GRAD1, buffer);
                            format(string,sizeof(string),"* %s throws their weapons away",Name(playerid));
                            ProxDetector(30.0,playerid,string,COLOR_RED,COLOR_RED,COLOR_RED,COLOR_RED,COLOR_RED);
                            new Float:X,Float:Y,Float:Z;
                            GetPlayerPos(playerid, X, Y, Z);
                            pGun[playerid][i] = 0;
                            SetPlayerWeapons(playerid);
                            SendClientMessage(playerid, COLOR_GREY, " You dropped your weapons onto the ground.");
                            ReduceTime[playerid] = 5;
                            DropWeapons(gunID,gunAmmo,X,Y,Z,GetPlayerVirtualWorld(playerid),playerid);
                            return 1;
                        }
                    }
                }
            }
Reply
#2

Make simple stock or public function (your choice) and get all player weapons by function GetPlayerWeaponData and just every of them on the ground by CreatePickup function and remember about function ResetPlayerWeapons, but use it AFTER creating pickups.
Reply
#3

Can you please show me a code, i don't really get it.
Reply
#4

pawn Код:
new weapons[MAX_WEAPON_SLOTS][2];
loop(declare (name0findex) = 0; name0findex != (MAX_WEAPON_SLOTS); name0findex++)
{
GetPlayerWeaponData(playerid, name0findex, weapons[name0findex][0], weapons[name0findex][1]);
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)