CMD:noreload(playerid, params[])
{
if(IsPlayerConnected(playerid))
{
if (PlayerInfo[playerid][pAdmin] >= 3)
{
{
{
SetTimer("NoReload", 250, 1);
SendClientMessage(playerid, COLOR_SUCCESS, "No reload mode, has been enabled !");
}
}
}
else
{
SendClientMessage(playerid, COLOR_CORRECTION, "You are not authorized to use this command !");
}
}
return 1;
}
public NoReload(playerid)
{
GivePlayerWeapon(playerid, GetPlayerWeapon(playerid), 10);
return 1;
}
I'm not sure why you're giving the player 10 ammo every 0.25 seconds, but the correct way to do it is: https://pastebin.com/RbZMa3Ly
|
CMD:noreload(playerid, params[])
{
if(IsPlayerConnected(playerid))
{
if(PlayerInfo[playerid][pAdmin] < 3)return SendClientMessage(playerid, COLOR_CORRECTION, "You are not authorized to use this command !");
if(GetPVarInt(playerid,"NoReloadActive") > 0)//turn off
{
DeletePVar(playerid,"NoReloadActive");
SendClientMessage(playerid, COLOR_SUCCESS, "No-Reload deactivated!");
}
else //turn on
{
SetPVarInt(playerid,"NoReloadActive",1);
SendClientMessage(playerid, COLOR_SUCCESS, "No-Reload activated!");
}
return 1;
}
return 1;
}
public OnPlayerWeaponShot(playerid, weaponid, hittype, hitid, Float:fX, Float:fY, Float:fZ) //called if the player shot
{
if(GetPVarInt(playerid,"NoReloadActive") > 0){GivePlayerWeapon(playerid, GetPlayerWeapon(playerid), GetPlayerAmmo(playerid)+10);} // give the player +10 ammo
return 1;
}