COMMAND:dropgun(playerid, params[])
{
if(PlayerInfo[playerid][pConnectTime] < 3)
{
return SendClientMessage(playerid, COLOR_GREY, " This command is restricted to: TLS 3 and above");
}
if (GetPlayerWeapon(playerid) < 2 || GetPlayerWeapon(playerid) > 34)
{
SendClientMessage(playerid, COLOR_GREY, " You cannot drop this weapon !");
return 1;
}
new Float:PlayersHealth;
GetPlayerHealth(playerid, PlayersHealth);
if (PlayersHealth == 0.0)
{
SendClientMessage(playerid, COLOR_GREY, " You have no access to drop this weapon at your health !");
return 1;
}
new giveplayerid;
new gunID = GetPlayerWeapon(playerid);
new gunAmmo = GetPlayerAmmo(playerid);
new Float:x,Float:y,Float:z;
GetPlayerPos(playerid,x,y,z);
RemovePlayerWeaponEx(playerid, gunID);
SendClientMessage(playerid, COLOR_GREY, " You dropped your weapon onto the ground.");
DropWeapons(gunID,gunAmmo,x,y,z,GetPlayerVirtualWorld(playerid),playerid);
if(PlayerInfo[playerid][pSex] == 1)
{
PlayerPlayerActionMessage(playerid,giveplayerid,20.0,"drops his weapon to the ground.");
} else {
PlayerPlayerActionMessage(playerid,giveplayerid,20.0,"drops her weapon to the ground.");
}
return 1;
}
stock DropWeapons(gunID,gunAmmo,Float:X,Float:Y,Float:Z,world,playerid)
{
if(IsADisabledWeapon(playerid,gunID))
{
return 1;
}
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][dx] == 0.0 && DropInfo[i][dy] == 0.0 && DropInfo[i][dz] == 0.0)
{
DropInfo[i][dType] = 1;
DropInfo[i][dAmount][0] = gunID;
DropInfo[i][dAmount][1] = gunAmmo;
DropInfo[i][dx] = X;
DropInfo[i][dy] = Y;
DropInfo[i][dz] = Z;
DropInfo[i][dWorld] = world;
strcpy(DropInfo[i][dPlayerName],name,MAX_PLAYER_NAME);
DropObject[i] = CreateDynamicObject(gh_GetObjectID(gunID), X, Y, Z-1, 80.0, 0.0, 0.0, world);
return 1;
}
}
return 1;
}
return 1;
}
enum dInfo
{
dType,
dAmount[2],
Float:dx,
Float:dy,
Float:dz,
dWorld,
dPlayerName[MAX_PLAYER_NAME],
};
new DropInfo[500][dInfo];
}
stock DropWeapons(gunID,gunAmmo,Float:x,Float:y,Float:z,world,playerid)
{
if(IsADisabledWeapon(playerid,gunID))
{
return 1;
}
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[playerid][dox] == 0.0 && DropInfo[playerid][doy] == 0.0 && DropInfo[playerid][doz] == 0.0)
{
DropInfo[playerid][dType] = 1;
DropInfo[playerid][dAmount][0] = gunID;
DropInfo[playerid][dAmount][1] = gunAmmo;
DropInfo[playerid][dox] = x;
DropInfo[playerid][doy] = y;
DropInfo[playerid][doz] = z;
DropInfo[playerid][dWorld] = world;
strcpy(DropInfo[playerid][dPlayerName],name,MAX_PLAYER_NAME);
DropObject[playerid] = CreateDynamicObject(gh_GetObjectID(gunID), z, y, z-1, 80.0, 0.0, 0.0, world);
return 1;
}
}
return 1;
}
return 1;
DropObject[playerid] = CreateDynamicObject(gh_GetObjectID(gunID), x, y, z-1, 80.0, 0.0, 0.0, world);
DropObject[playerid] = CreateDynamicObject(gh_GetObjectID(gunID), z, y, z-1, 80.0, 0.0, 0.0, world);
Where's the x ? |