SA-MP Forums Archive
Drop weapons problem...HELP - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Drop weapons problem...HELP (/showthread.php?tid=395796)



Drop weapons problem...HELP - Mikkel_RE - 27.11.2012

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;
                        }
                    }
                }
            }



Re: Drop weapons problem...HELP - Riddick94 - 27.11.2012

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.


Re: Drop weapons problem...HELP - Mikkel_RE - 27.11.2012

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


Re: Drop weapons problem...HELP - Riddick94 - 27.11.2012

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]);
}