Respawn, but not deleting a car.
#1

How to do this example:

I made a car: AddStaticVehicle. And a player went away from his spawn point.

and I'd like to know how to make a new car in this place after a player move away from the coordinates I chose for the car, but not deleting the car that is the player into
Reply
#2

Код:
new vspawn[MAX_VEHICLES][4];
forward vehiclecheck();

public OnGameModeInit()
{
    SetTimer("vehiclecheck", 1000, true);
    return 1;
}

public OnVehicleSpawn(vehicleid)
{
    GetVehiclePos(vehicleid, vspawn[vehicleid][0], vspawn[vehicleid][1], vspawn[vehicleid][2]);
    GetVehicleZAngle(vehicleid, vspawn[vehicleid][3]);
    return 1;
}

public vehiclecheck()
{
    for(new v=0; v<MAX_VEHICLES; v++){
        new Float:x, Float:y, Float:z;
        GetVehiclePos(v, x, y, z);
        if(x != vspawn[v][0] || y != vspawn[v][1] || z != vspawn[v][2]){
            AddStaticVehicle(GetVehicleModel(v), vspawn[v][0], vspawn[v][1], vspawn[v][2], vpsawn[v][3], -1, -1);
        }
    }
    return 1;
}
I don't know whether this works as I just wrote it up, but it's worth a try
Reply
#3

I tried it, but didn't work though, and had to set timer to at least 10000, or else'd lag my gta.. S=
Any other suggestions? anyone please

I tried another way, editing your code too
Reply
#4

> Bullshit story here <
Reply
#5

pawn Код:
new vehicle[4];
vehicle[1] = CreateVehicle(......); // put 60 respawn time
public OnPlayerEnterVehicle
if(IsPlayerInVehicle(playerid, vehicle[1]))
{
if(IsPlayerInRangeOfPoint(playerid, 25, x,y,z))//x,y,z of create vehicle
{
}
else
{
vehicle[2] = CreateVehicle(...);//same as vehicle[1]
}
return 1;
}
if(IsPlayerInVehicle(playerid, vehicle[2]))
{
if(IsPlayerInRangeOfPoint(playerid, 25, x,y,z))//x,y,z of create vehicle
{
}
else
{
vehicle[3] = CreateVehicle(...);
}
return 1;
}
but create only 2, 3 or 4 vehicle on same place so when car destroys that doesnt spawn on car in same spawn point
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)