Vehicle Sink in Water
#1

Hello , I want to know where i need to put the code when Vehicle Sink in water . For example i want to use SendClientMessage when vehicle sinks in water . So where i need to use it . in OnVehicleDeath?
Reply
#2

Please just enter the wiki and read the title: https://sampwiki.blast.hk/wiki/OnVehicleDeath
I'll even quote it from there.
"Description:
This callback is called when a vehicle is destroyed - either by exploding or becoming submerged in water."

However if you would like to find it only by water, I have searched the forums and found this code:
pawn Код:
stock IsVehicleInWater(vehicleid)
{
        new Float:water_areas[][] =
        {
                {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}
        };
        for(new t=0; t < sizeof water_areas; t++)
        if(GetVehicleDistanceFromPoint(vehicleid,water_areas[t][1],water_areas[t][2],water_areas[t][3]) <= water_areas[t][0]) return 1;
    return 0;
}
Which can be used like this:
pawn Код:
if(IsVehicleInWater(vehicleid))
{
    SendClientMessageToAll(-1, "Vehicle is in water.");
}
Didn't try it, you are more welcome to edit it and make it your solution.
Reply
#3

Thnx .
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)