02.02.2018, 20:53
is there any way to detect if a player fall into water?
public OnGameModeInit()
{
SetTimer("dm_activate", 1000, true);
return 1;
}
forward dm_activate();
public dm_activate()
{
for (new i = 0; i < MAX_PLAYERS; i++)
{
new Float:pPos[3];
GetPlayerPos(i, pPos[0], pPos[1], pPos[2]);
if(IsPlayerConnected(i))
{
if (pPos[2] < 25.0)
{
if(Player_minigame[i] == 1)//detects if the player is inside the minigame/place, if you want to remove it.
{
TogglePlayerSpectating(playerid, 1);
GameTextForPlayer(playerid, "You lost", 2000, 5);
SetTimerEx("check_exit",1000,0,"d",playerid);
return 1;
}
}
}
}
return 1;
}
forward check_exit(playerid);
public check_exit(playerid)
{
TogglePlayerSpectating(playerid,0);
return 1;
}