26.04.2010, 17:30
How to create weapons to the ground as in the picture below?
if(strcmp(cmd, "/objectdeagle", true) == 0)
{
new Float: X, Float: Y, Float: Z;
GetPlayerPos(playerid, X, Y, Z);
new weapon = GetPlayerWeapon(playerid);
if(weapon != 0)
{
if(weapon == 24)
{
RemovePlayerWeapon(playerid, 24);
CreateObject(348,X, Y, Z-1,85,0,0);
return 1;
}
else
{
SendClientMessage(playerid, COLOR_WHITE, "You don't have a Desert Eagle!");
}
}
else
{
SendClientMessage(playerid, COLOR_WHITE, "You don't have any weapon!");
}
return 1;
}
stock RemovePlayerWeapon(playerid, weaponid)
{
if(!IsPlayerConnected(playerid) || weaponid < 0 || weaponid > 50)
return;
new
saveweapon[13],
saveammo[13];
// Probably could be done using one loop
for(new slot = 0; slot < 13; slot++)
GetPlayerWeaponData(playerid, slot, saveweapon[slot], saveammo[slot]);
ResetPlayerWeapons(playerid);
for(new slot; slot < 13; slot++)
{
if(saveweapon[slot] == weaponid || saveammo[slot] == 0)
continue;
GivePlayerWeapon(playerid, saveweapon[slot], saveammo[slot]);
}
// give them weapon ID 0 to reset the current armed weapon
// to a fist and not the last weapon in their inventory
GivePlayerWeapon(playerid, 0, 1);
}
new cmd[256];
cmd = strtok(cmdtext, idx);
Originally Posted by FlashInTheNighT
what if I want to remove all of the player's weapons ?
|
ResetPlayerWeapons(playerid);
Originally Posted by luigifan9
Quote:
pawn Код:
|
ResetPlayerWeapons(playerid);