SA-MP Forums Archive
How would I make all weapons drop at once? - 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: How would I make all weapons drop at once? (/showthread.php?tid=576192)



How would I make all weapons drop at once? - ChristofferHoffmann - 01.06.2015

Hello, I'm using a system that allows the weapon to be dropped by choice and at death it would then also drop the weapon that was being used. Unfortunately it only drops the one gun you're using, which means that let us say you scroll away from your weapon then it wont drop anything. How would I make it drop EVERY weapon that the person has on them - with the right amount of ammo, that is.

Код:
stock DropGun(playerid, GunID, GunAmmo, Float:X, Float:Y, Float:Z, world, interior)
{
	new name[MAX_PLAYER_NAME];
	GetPlayerName(playerid,name,sizeof(name));
    if(GunID != 0 && GunAmmo != 0)
    {
	    for(new i = 0; i < sizeof(DropInfo); i++)
  	    {
  	        if(DropInfo[i][DropGunPosX] == 0.0 && DropInfo[i][DropGunPosY] == 0.0 && DropInfo[i][DropGunPosZ] == 0.0)
  	        {
  	            DropInfo[i][DropGunAmmount][0] = GunID;
  	            DropInfo[i][DropGunAmmount][1] = GunAmmo;
  	            DropInfo[i][DropGunPosX] = X;
  	            DropInfo[i][DropGunPosY] = Y;
  	            DropInfo[i][DropGunPosZ] = Z;
  	            DropInfo[i][DropGunVWorld] = world;
  	            DropInfo[i][DropGunInterior] = interior;
  	            DropObject[i] = CreateDynamicObject(GetGunObjectID(GunID), X, Y, Z-1, 80.0, 0.0, 0.0, world);
	            return 1;
  	        }
	    }
        return 1;
    }
    return 1;
}



Re: How would I make all weapons drop at once? - Konstantinos - 01.06.2015

Something like that I guess would work:
PHP код:
new w_idw_ammoFloatp_pos[3], p_world GetPlayerVirtualWorld(playerid), p_int GetPlayerInterior(playerid), Floatoffset;
GetPlayerPos(playeridp_pos[0], p_pos[1], p_pos[2]);

for (new 
i!= 13; ++i)
{
    
GetPlayerWeaponData(playeridiw_idw_ammo);
    if (
w_idDropGun(playeridw_idw_ammop_pos[0] + (offset += 0.5), p_pos[1], p_pos[2], p_worldp_int);