SA-MP Forums Archive
Player check - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Player check (/showthread.php?tid=662624)



Player check - Rubennatan - 07.01.2019

Hello guys, I was making a SUMO cars war and I was wonderi g if its possible to check and respawn a player when he falls into the water and how can i do it?
Thanks!


Re: Player check - rockys - 07.01.2019

if(insumo[playerid]) {
new Float: pos[3];
GetPlayerPos(playerid,pos[0],pos[1],pos[2]);
new Float:waterpos = your coordonate from /save
if(pos[2] <= waterpos) SpawnPlayer(playerid);
}
you need to create a timer


Re: Player check - ch1ps - 07.01.2019

Like rockys responded, you need to get the height (Y parameter) of the water, and make a timer that checks if you are not at or below that height, and if you are, respawn


Re: Player check - Kraeror - 07.01.2019

I made it by myself for seconds and I think it will work!
Here is it (on the top of your script):
PHP Code:
boolIsPlayerInWater(playerid)
{
    new 
FloatpPosition[3];
    
GetPlayerPos(playeridpPosition[0], pPosition[1], pPosition[2]);
    if(
IsPlayerInRangeOfPoint(playerid10000pPosition[0], pPosition[1], 1-10000))
    {
        return 
true;
    }
    return 
false;