Quote:
Originally Posted by [HRD]Mar1
What do you mean sir ? you want to send weapons to another player ![Huh?](images/smilies/confused.gif)
|
Alright, it's very hard to explain but i'm trying my best here. So, I've got a filterscript that drops my weapons on death and it spawns weapon objects on the ground that are pickupable of my weapons. However I'm trying to create a command here so I could drop only one gun that spawns the object model on the ground (which are pickupable). I'm using the same script as onplayerdeath and I'm trying to convert it to a command that I could drop only one gun if I want to. But the problem is that when I type /dropgun it REMOVES one of my guns like it should be BUT it spawns pickupable object models on the ground of ALL my weapons and it won't remove all of my weapons, only one. So, I'm trying to make it like when I type /dropgun it removes only one of my guns and spawns it on the ground, not all of them.
Код:
command(dropgun, playerid, params[])
{
new GunID = GetPlayerWeapon(playerid);
GetPlayerName(playerid, sendername, sizeof(sendername));
RemovePlayerWeapon(playerid, GunID);
RemovePickups(playerid);
new Float:x, Float:y, Float:z, dropped;
GetPlayerPos(playerid,x,y,z);
for(new i=0; i<13; i++)
{
new weapon, ammo;
GetPlayerWeaponData(playerid, i, weapon, ammo);
if((ammo > 0 || weapon == 1) && weapon != 0)
{
new model = GetModel(weapon);
if(model != -1)
{
WeaponData[playerid][i][0] = weapon;
WeaponData[playerid][i][1] = ammo;
OnWeaponDrop(playerid);
}
}
}
if(dropped > 0)
{
new radius;
if(dropped < 3) radius = 1;
if(dropped < 6) radius = 2; /*If you want another radius, change it here.*/
if(dropped < 9) radius = 3;
if(dropped > 8) radius = 4;
new Float:degree, Float:tmp;
degree = 360.0 / (float(dropped));
tmp = degree;
if(WeaponTimer[playerid] != -1) KillTimer(WeaponTimer[playerid]);
WeaponTimer[playerid] = SetTimerEx("RemovePickups", WEAPON_RESPAWN_TIME*1000, 0, "d", playerid);
for(new i=0; i<13; i++)
{
if((WeaponData[playerid][i][1] > 0 || WeaponData[playerid][i][0] == 1) && WeaponData[playerid][i][0] > 0)
{
new model = GetModel(WeaponData[playerid][i][0]);
if(model != -1)
{
WeaponDrop[playerid][i] = CreatePickup(model, 1, x+(floatsin(degree, degrees)*radius), y+(floatcos(degree, degrees)*radius), z);
degree = degree + tmp;
}
}
}
}
return 1;
}