SA-MP Forums Archive
vehicles in water - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: vehicles in water (/showthread.php?tid=188255)



vehicles in water - Ribber - 06.11.2010

well players in my server pushes vehicles into the water and then they won't respawn..
So my question, how can I fix this?


Re: vehicles in water - The_Moddler - 07.11.2010

With GetVehiclePos, if Z is equal or less than 0, you set it to respawn. Obviusly you will have to check for certain areas, like for example the quarry, that is very deep and Z goes to -45 aprox, so make an exeption to that area.


AW: vehicles in water - Ribber - 07.11.2010

hmm, isn't there a more uncomplicated way? :S


Re: vehicles in water - [L3th4l] - 07.11.2010

pawn Код:
AddStaticVehicleEx(vehicleid,......,RESPAWNTIME);
https://sampwiki.blast.hk/wiki/AddStaticVehicleEx


Re: vehicles in water - Steven82 - 07.11.2010

Well, if you think that is too complicated, then! your going to have to deal with it.


AW: vehicles in water - Ribber - 07.11.2010

already tried, still the same -> no respawning when pushing into the water.


Re: vehicles in water - [L3th4l] - 07.11.2010

If you say so,

under OnVehicleDeath(vehicleid)
{

pawn Код:
SetVehicleToRespawn(vehicleid);
}


Re: vehicles in water - The_Moddler - 07.11.2010

Quote:
Originally Posted by [L3th4l]
Посмотреть сообщение
If you say so,

under OnVehicleDeath(vehicleid)
{

pawn Код:
SetVehicleToRespawn(vehicleid);
}
It's not called OnVehicleDeath, it's only called if the vehicle is occupied.

Quote:
Originally Posted by Ribber
Посмотреть сообщение
hmm, isn't there a more uncomplicated way? :S
There isn't.


Re: vehicles in water - [WSF]ThA_Devil - 07.11.2010

try SA-MP CreateVehicle https://sampwiki.blast.hk/wiki/CreateVehicle
it works for me great... and it respawns after some time


Re: vehicles in water - (SF)Noobanatior - 07.11.2010

just respawn all the unoccupied cars every 30mins or so


Re: vehicles in water - silvan - 07.11.2010

what about for RP servers?


AW: vehicles in water - Ribber - 07.11.2010

there must be an easier solution...
Isn't it possible that a timer checks for the stand-position for all vehicles every 10 seconds, and the radius is 10 or so, and if this vehicle is without a driver and the radius is more than 10 it will be respawned..

or a respawn command for the closest vehicles would be also good (that admins can respawn them)..


Re: vehicles in water - Th3Angel - 07.11.2010

pawn Код:
/*    ================================
      ====[FS] And Stocks Made By:====
      =========== Th3Angel ===========
      ================================
      -----Don't remove credits.------
*/

#include <a_samp>

#define CHECK_TIME_SECS 30 //uncomment if you want to use and comment CHECK_TIME_MINS
//#define CHECK_TIME_MINS 1 //uncomment if you want to use and comment CHECK_TIME_SECS

#if defined CHECK_TIME_SECS

public OnFilterScriptInit()
{
    print("\n--------------------------------------");
    print(" Blank Filterscript by your name here");
    print("--------------------------------------\n");
    SetTimer("VehicleInWater", CHECK_TIME_SECS*1000, true);
    return 1;
}

#else

public OnFilterScriptInit()
{
    print("\n--------------------------------------");
    print(" Blank Filterscript by your name here");
    print("--------------------------------------\n");
    SetTimer("VehicleInWater", CHECK_TIME_MINS*60000, true);
    return 1;
}

#endif

public OnFilterScriptExit()
{
    return 1;
}

forward VehicleInWater();
public VehicleInWater()
{
    for(new v = 0; v < MAX_VEHICLES; v++)
    {
        if(IsVehicleInWater(v))
        {
            if(!IsBoat(v))
            {
                SetVehicleToRespawn(v);
            }
        }
    }
}

stock IsVehicleInWater(vehicleid)
{
    new Float:x,Float:y,Float:pz;
    GetVehiclePos(vehicleid, x, y, pz);
    if(IsVehicleInArea(vehicleid, 381.7009, 782.9656, 710.9611, 965.2859)) return 0;
    if(
    (IsVehicleInArea(vehicleid, 2032.1371, 1841.2656, 1703.1653, 1467.1099) && pz <= 9.0484)
    || (IsVehicleInArea(vehicleid, 2109.0725, 2065.8232, 1962.5355, 10.8547) && pz <= 10.0792)
    || (IsVehicleInArea(vehicleid, -492.5810, -1424.7122, 2836.8284, 2001.8235) && pz <= 41.06)
    || (IsVehicleInArea(vehicleid, -2675.1492, -2762.1792, -413.3973, -514.3894) && pz <= 4.24)
    || (IsVehicleInArea(vehicleid, -453.9256, -825.7167, -1869.9600, -2072.8215) && pz <= 5.72)
    || (IsVehicleInArea(vehicleid, 1281.0251, 1202.2368, -2346.7451, -2414.4492) && pz <= 9.3145)
    || (IsVehicleInArea(vehicleid, 2012.6154, 1928.9028, -1178.6207, -1221.4043) && pz <= 18.45)
    || (IsVehicleInArea(vehicleid, 2326.4858, 2295.7471, -1400.2797, -1431.1266) && pz <= 22.615)
    || (IsVehicleInArea(vehicleid, 2550.0454, 2513.7588, 1583.3751, 1553.0753) && pz <= 9.4171)
    || (IsVehicleInArea(vehicleid, 1102.3634, 1087.3705, -663.1653, -682.5446) && pz <= 112.45)
    || (IsVehicleInArea(vehicleid, 1287.7906, 1270.4369, -801.3882, -810.0527) && pz <= 87.123)
    || (pz < 1.5)
    )
    {
        return 1;
    }
    return 0;
}

stock IsVehicleInArea(vehicleid, Float:minx, Float:maxx, Float:miny, Float:maxy)
{
    new Float:x, Float:y, Float:z;
    GetVehiclePos(vehicleid, x, y, z);
    if(x > minx && x < maxx && y > miny && y < maxy) return 1;
    return 0;
}

stock IsBoat(vehicleid)
{
    switch(GetVehicleModel(vehicleid))
    {
        case 472,473,493,595,484,430,453,452,446,454,539:
        return 1;
    }
    return 0;
}
This will respawn all vehicles except for boats and vortex if they are in water.
Vehicles in the Quarry won't respawn.
Please credit me if you use this FS or the stocks.


Re: vehicles in water - GaGlets(R) - 07.11.2010

Nope thats not the problem, if vehicle have not been used for a while and its pushed in water then it will not respawn automaticly, only manually with command or smth. Probably sa-mp bug or maybe it is made with reason of something.


Re: vehicles in water - Th3Angel - 07.11.2010

How do you use a vehicle in water? :/
That FS does just exactly that...