Respawn, but not deleting a car. - 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: Respawn, but not deleting a car. (
/showthread.php?tid=188641)
Respawn, but not deleting a car. -
blackwave - 08.11.2010
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
Re: Respawn, but not deleting a car. -
Sascha - 08.11.2010
Код:
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
Re: Respawn, but not deleting a car. -
blackwave - 08.11.2010
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
Re: Respawn, but not deleting a car. -
DVDK - 08.11.2010
> Bullshit story here <
Re: Respawn, but not deleting a car. -
HrvojeCro - 09.11.2010
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