public OnPlayerUpdate(playerid)
{
if(GetPlayerWeapon(playerid) == 27)
{
GivePlayerWeapon(playerid,27, 0);
GivePlayerWeapon(playerid,31,5000);//amount of ammo you want replace it with 5000
}
return 1;
}
stock RemovePlayerWeapon(playerid, pweaponid)
{
new plyWeapons[12];
new plyAmmo[12];
for(new slot = 0; slot != 12; slot++)
{
new pwep, pammo;
GetPlayerWeaponData(playerid, slot, pwep, pammo);
if(pwep != pweaponid)
{
GetPlayerWeaponData(playerid, slot, plyWeapons[slot], plyAmmo[slot]);
}
}
ResetPlayerGuns(playerid);
for(new slot = 0; slot != 12; slot++)
{
GivePlayerGun(playerid, plyWeapons[slot], plyAmmo[slot]);
}
}
public OnPlayerUpdate(playerid)
{
new weapon, ammo;
GetPlayerWeaponData(playerid, 3, weapon, ammo);
if(weapon==27)
{
RemovePlayerWeapon(playerid, 27);
GivePlayerWeapon(playerid, WEAPON_M4, 100);
}
}
PHP код:
|
Ok but it will work when the player get the weapon and when the player get the weapon the weapon become in his hand !
|