Skip to content
This repository was archived by the owner on Feb 19, 2020. It is now read-only.

SetPlayerNoReload

GtakillerIV edited this page Nov 15, 2014 · 13 revisions

SetPlayerNoReload

Allows a player to continuously shoot without reloading

Note This function does not freeze the player's ammo.

Note If the player's ammo runs out, it'll decrease until the ammo is equal to the amount of bullets(in negative). When that happens, the player's weapon will disappear.


Parameters

playerid

The player's id.

bool:Toggle

Whether you want to enable it or not.

Can be either true or false.

Returns

    0 if the player is not connected

Usage

CMD:noreload(playerid, params[])
{
	//If the player has the SA-MP+ plugin installed
	if(IsUsingSAMPP(playerid))
	{
		static bool:noReload[MAX_PLAYERS];

		//If player already has no-reload mode enabled
		if(noReload[playerid])
		{
			//Turn off his no-reload mode and send him a message
			//saying no-reload is now turned off
			SetPlayerNoReload(playerid, false);
			SendClientMessage(playerid, -1, "No-reload mode set to OFF");
			noReload[playerid] = false;
		}
		//If no-reload mode is not enabled
		else 
		{
			//If the player is online
			if(IsPlayerConnected(playerid))
			{
				SetPlayerNoReload(playerid, true);
				//Enable it and send a message
				SendClientMessage(playerid, -1, "No-reload mode set to ON");
				noReload[playerid] = true;
			}
			
		}
	}
	else
	{
		SendClientMessage(playerid, -1, "You need the SA-MP+ plugin");
	}
	return 1;
}
Clone this wiki locally