Originally Posted by XBrianX
Try using my command:
PHP код:
CMD:dropgun(playerid, params[])
{
if(IsPlayerInAnyVehicle(playerid)) {
SendClientMessageEx (playerid, COLOR_GRAD2, "You can not drop weapons in a vehicle!");
return 1;
}
new gunid = GetPlayerWeapon(playerid);
if(gunid) {
new f = 100+1;
for(new a = 0; a < sizeof(ObjCoords); a++) {
if(ObjCoords[a][0] == 0.0) {
f = a;
break;
}
}
if(f > 100) return SendClientMessage(playerid, COLOR_GREY, "You can not throw weapons at the moment, try back later!!");
new WeaponName[65], sendername[MAX_PLAYER_NAME];
new string[128];
GetPlayerName(playerid, sendername, sizeof(sendername));
GetWeaponName(gunid, WeaponName, 64);
if(gunid == 18) { WeaponName = "Molotovs"; }
if(gunid == 44) { WeaponName = "Nightvision Goggles"; }
if(gunid == 45) { WeaponName = "Infared Goggles"; }
RemovePlayerWeapon(playerid,gunid);
ObjectID[f][0] = gunid;
GetPlayerPos(playerid, ObjCoords[f][0], ObjCoords[f][1], ObjCoords[f][2]);
object[f] = CreateDynamicObject(GunObjects[gunid][0],ObjCoords[f][0],ObjCoords[f][1],ObjCoords[f][2]-1,93.7,120.0,120.0, GetPlayerVirtualWorld(playerid), GetPlayerInterior(playerid), -1, 100.0);
SetTimerEx("DeleteGun", 500000, 0, "d", object[f]);
format(string, sizeof(string), "* %s has thrown away their %s.", sendername, WeaponName);
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
}
else
{
SendClientMessageEx(playerid, COLOR_GRAD1, "You Don't have guns");
}
return 1;
}
I'm sure it'll work because sets the weapon on ground position.
PHP код:
GetPlayerPos(playerid, ObjCoords[f][0], ObjCoords[f][1], ObjCoords[f][2]);
object[f] = CreateDynamicObject(GunObjects[gunid][0],ObjCoords[f][0],ObjCoords[f][1],ObjCoords[f][2]-1,93.7,120.0,120.0, GetPlayerVirtualWorld(playerid), GetPlayerInterior(playerid), -1, 100.0);
|