This repository was archived by the owner on Feb 19, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 39
ToggleWaterBuoyancy
GtakillerIV edited this page Dec 8, 2014
·
4 revisions
Allows or denies water physics from affecting the player
This function will not work for vehicles.
playerid
The player's id.
bool:toggle
Whether to allow the water physics to take effect or not.
Can be true
or false
.
0 if the player is not connected
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