I tested it and worked fine (tested only on deagle, but it should works for all others)
It sets the player ammo to 0 to reset the weapon, and then give it again with new ammo, then GTA does the rest
pawn Код:
CMD:reload( playerid , params [ ] )
{
#pragma unused params
if ( GetPlayerState ( playerid ) == 1 )
{
new Ammo = GetPlayerAmmo(playerid);
if(GetPlayerWeapon(playerid) == 24)
{
ApplyAnimation ( playerid , "COLT45" , "colt45_reload" , 4.0 , 0 , 0 , 0 , 0 , 0 ) ;
SetPlayerAmmo(playerid, 24, 0);
GivePlayerWeapon(playerid, 24, Ammo);
}
if(GetPlayerWeapon(playerid) == 22)
{
ApplyAnimation ( playerid , "COLT45" , "colt45_reload" , 4.0 , 0 , 0 , 0 , 0 , 0 ) ;
SetPlayerAmmo(playerid, 22, 0);
GivePlayerWeapon(playerid, 22, Ammo);
}
if(GetPlayerWeapon(playerid) == 29)
{
ApplyAnimation ( playerid , "BUDDY" , "buddy_reload" , 4.0 , 0 , 0 , 0 , 0 , 0 ) ;
SetPlayerAmmo(playerid, 29, 0);
GivePlayerWeapon(playerid, 29, Ammo);
}
if(GetPlayerWeapon(playerid) == 30)
{
ApplyAnimation ( playerid , "BUDDY" , "buddy_reload" , 4.0 , 0 , 0 , 0 , 0 , 0 ) ;
SetPlayerAmmo(playerid, 30, 0);
GivePlayerWeapon(playerid, 30, Ammo);
}
if(GetPlayerWeapon(playerid) == 31)
{
ApplyAnimation ( playerid , "BUDDY" , "buddy_reload" , 4.0 , 0 , 0 , 0 , 0 , 0 ) ;
SetPlayerAmmo(playerid, 31, 0);
GivePlayerWeapon(playerid, 31, Ammo);
}
if(GetPlayerWeapon(playerid) == 25)
{
ApplyAnimation ( playerid , "PYTHON" , "pythonreload" , 4.0 , 0 , 0 , 0 , 0 , 0 ) ;
SetPlayerAmmo(playerid, 25, 0);
GivePlayerWeapon(playerid, 25, Ammo);
}
if(GetPlayerWeapon(playerid) == 26)
{
ApplyAnimation ( playerid , "COLT45" , "sawnoff_reload" , 4.0 , 0 , 0 , 0 , 0 , 0 ) ;
SetPlayerAmmo(playerid, 26, 0);
GivePlayerWeapon(playerid, 26, Ammo);
}
if(GetPlayerWeapon(playerid) == 27)
{
ApplyAnimation ( playerid , "PYTHON" , "pythonreload" , 4.0 , 0 , 0 , 0 , 0 , 0 ) ;
SetPlayerAmmo(playerid, 27, 0);
GivePlayerWeapon(playerid, 27, Ammo);
}
if(GetPlayerWeapon(playerid) == 32)
{
ApplyAnimation ( playerid , "UZI" , "UZI_reload" , 4.0 , 0 , 0 , 0 , 0 , 0 ) ;
SetPlayerAmmo(playerid, 32, 0);
GivePlayerWeapon(playerid, 32, Ammo);
}
if(GetPlayerWeapon(playerid) == 28)
{
ApplyAnimation ( playerid , "UZI" , "UZI_reload" , 4.0 , 0 , 0 , 0 , 0 , 0 ) ;
SetPlayerAmmo(playerid, 28, 0);
GivePlayerWeapon(playerid, 28, Ammo);
}
if(GetPlayerWeapon(playerid) == 23)
{
ApplyAnimation ( playerid , "SILENCED" ,"silence_reload" , 4.0 , 0 , 0 , 0 , 0 , 0 ) ;
SetPlayerAmmo(playerid, 23, 0);
GivePlayerWeapon(playerid, 23, Ammo);
}
}
return 1;
}