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

TogglePlayerSwitchReload

GtakillerIV edited this page Nov 16, 2014 · 2 revisions

TogglePlayerSwitchReload

Allows or denies a player's gun to automatically reload after switching guns


Parameters

playerid

The player's id.

bool:toggle

Whether to auto reload or not.

Can be true or false.

Returns

    0 if the player is not connected

Usage

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

		//If the player's gun will already reload after switching guns
		if(switchEnabled[playerid])
		{
			TogglePlayerSwitchReload(playerid, false);

			SendClientMessage(playerid, -1, "Your gun will no longer reload once you switch guns");

			switchEnabled[playerid] = false;
		}
		//If not
		else
		{
			TogglePlayerSwitchReload(playerid, true);

			SendClientMessage(playerid, -1, "Your gun will now reload after switching guns");

			switchEnabled[playerid] = true;
		}

	}
	//If not
	else
	{
		SendClientMessage(playerid, -1, "You need the SA-MP+ plugin");
	}
	return 1;
}

See Also

TogglePlayerDriveOnWater

TogglePlayerVehicleBlips

TogglePlayerInfiniteRun

Clone this wiki locally