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

ToggleWaterBuoyancy

GtakillerIV edited this page Dec 8, 2014 · 4 revisions

ToggleWaterBuoyancy

Allows or denies water physics from affecting the player

Note This function will not work for vehicles.


Parameters

playerid

The player's id.

bool:toggle

Whether to allow the water physics to take effect or not.

Can be true or false.

Returns

    0 if the player is not connected

Usage

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

		//If the player gets affected by water physics
		if(waterPhysics[playerid])
		{
			ToggleWaterBuoyancy(playerid, false);

			SendClientMessage(playerid, -1, "You can no longer go through water!");

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

			SendClientMessage(playerid, -1, "You can now go through water!");

			waterPhysics[playerid] = true;
		}

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

See Also

TogglePlayerDriveOnWater

TogglePlayerInfiniteOxygen

TogglePlayerInfiniteRun

Clone this wiki locally