SA-MP Forums Archive
[Help]IsPlayerInWater for Vehicles? - 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: [Help]IsPlayerInWater for Vehicles? (/showthread.php?tid=478873)



[Help]IsPlayerInWater for Vehicles? - luis_mendoza - 01.12.2013

Hi guys , so I've tried so much time to make IsPlayerInWater function for vehicles , when Someone touches the water (with vehicle) he dies (I'm scripting it for Destruction Derby gamemode) . I used This , but it doesn't work.

It's not sucessful. Can someone help ?


Re: [Help]IsPlayerInWater for Vehicles? - Pottus - 01.12.2013

If it's a destruction derby then your going to be confined to a specific area so why not just make a dynamic area where the water is and call it a day.


Re: [Help]IsPlayerInWater for Vehicles? - whatthefuck123 - 01.12.2013

just record the Z position of the water below the derby then check If They fell below that .. if your derby is above water i suppose


Re: [Help]IsPlayerInWater for Vehicles? - luis_mendoza - 01.12.2013

Quote:
Originally Posted by whatthefuck123
Посмотреть сообщение
just record the Z position of the water below the derby then check If They fell below that .. if your derby is above water i suppose
Well , I just need to know how to make it right , like when he touches the water he dies. That's all what I want , but it's big problem for me.
Btw I am still not professional scripter , what's really impossible xD.


Re: [Help]IsPlayerInWater for Vehicles? - SilentSoul - 01.12.2013

Quote:
Originally Posted by luis_mendoza
Посмотреть сообщение
Well , I just need to know how to make it right , like when he touches the water he dies. That's all what I want , but it's big problem for me.
Btw I am still not professional scripter , what's really impossible xD.
Try to make it by using :
https://sampwiki.blast.hk/wiki/IsPlayerInAnyVehicle
https://sampwiki.blast.hk/wiki/IsPlayerInRangeOfPoint
https://sampwiki.blast.hk/wiki/SetPlayerHealth
Water floats
Код:
{25.0,  2313.0, -1417.0,        23.0},
{15.0,  1280.0, -773.0,         1082.0},
{15.0,  1279.0, -804.0,         86.0},
{20.0,  1094.0, -674.0,         111.0},
{26.0,  194.0,  -1232.0,        76.0},
{25.0,  2583.0, 2385.0,         15.0},
{25.0,  225.0,  -1187.0,        73.0},
{50.0,  1973.0, -1198.0,        17.0}



Re: [Help]IsPlayerInWater for Vehicles? - whatthefuck123 - 01.12.2013

go to the water and type /save
then go to your file last line (savedpositions.txt) and get your 3rd coord
pawn Код:
public OnPlayerUpdate(playerid)
{
new Float:z;
GetPlayerPos(playerid, z,z,z);
if(z<=/* ur coord*/)
{
   SendClientMessage(playerid, -1, "your in water");
}
return 1;
}
i hope you understand i cant make it clearer..


Re: [Help]IsPlayerInWater for Vehicles? - luis_mendoza - 01.12.2013

Quote:
Originally Posted by whatthefuck123
Посмотреть сообщение
go to the water and type /save
then go to your file last line (savedpositions.txt) and get your 3rd coord
pawn Код:
public OnPlayerUpdate(playerid)
{
new Float:z;
GetPlayerPos(playerid, z,z,z);
if(z<=/* ur coord*/)
{
   SendClientMessage(playerid, -1, "your in water");
}
return 1;
}
i hope you understand i cant make it clearer..
Now it works fully ... Thank you


Re: [Help]IsPlayerInWater for Vehicles? - Konstantinos - 01.12.2013

Why do you even need OnPlayerUpdate or a timer for that?

When a vehicle enters the water, OnVehicleDeath is called so you will know that the vehicle either exploded or is in water. You also get the player's id through killerid!


Re: [Help]IsPlayerInWater for Vehicles? - whatthefuck123 - 01.12.2013

Quote:
Originally Posted by Konstantinos
Посмотреть сообщение
Why do you even need OnPlayerUpdate or a timer for that?

When a vehicle enters the water, OnVehicleDeath is called so you will know that the vehicle either exploded or is in water. You also get the player's id through killerid!
not always... it doesnt always work when it goes in water i remember i was trying it once