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

TogglePlayerAction

GtakillerIV edited this page Nov 15, 2014 · 4 revisions

TogglePlayerAction

Allows or denies a player from performing a specific action


Parameters

playerid

The player's id.

actionid

The action id.

bool:toggle

Whether to allow access or not.

Can be true or false.

Returns

    0 if the player is not connected

Usage

CMD:togglejump(playerid, params[])
{
	new targetid, bool:toggle;
	if(sscanf(params, "ub", targetid, toggle)) return SendClientMessage(playerid, -1, "Correct usage: /togglejump playerid 1/0");

	if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, -1, "The requested player is not connected");
	if(!IsUsingSAMPP(targetid)) return SendClientMessage(playerid, -1, "The requested player doesn't have the SA-MP+ plugin installed");

	TogglePlayerAction(targetid, PLAYER_ACTION_JUMP , toggle);

	if(!toggle)
	{
		SendClientMessage(playerid, -1, "The requested player will not be able to jump!");
		//Send a message to the requested player
		SendClientMessage(targetid, -1, "You can no longer jump!");
	}
	else
	{
		SendClientMessage(playerid, -1, "The requested player will now be able to jump!");
		//Send a message to the requested player
		SendClientMessage(targetid, -1, "You can now jump!");
	}

	return 1;

}

See Also

ToggleHUDComponentForPlayer

TogglePauseMenuAbility

TogglePlayerDriveOnWater

Clone this wiki locally