[SOLVED] Need help with respawning a vehicle
#1

SOLVED: Info below.

Hey everyone, I currently am scripting on a server, but I have a problem with this.

I am currently trying to do the following:

Respawn the vehicle when the player exits it.

But, I don't have any luck, even after trying to create a timer to work, but I think it only will respawn the vehicle ID 0, so let me explain what I did.

Created a timer:
pawn Код:
forward CarRespawnTimer(vehicleid);
public CarRespawnTimer(vehicleid)
{
   SetVehicleToRespawn(vehicleid);
}
then: Under OnPlayerExitVehicle(playerid, vehicleid)


pawn Код:
OnPlayerExitVehicle(playerid, vehicleid)
{
   SetTimer("CarRespawnTimer", 10000, false);
}
I Tried to do this, but it didn't work unfortunately, so please help me figure this out.


Solved:
Quote:
Originally Posted by Finn
pawn Код:
SetTimerEx("CarRespawnTimer", 10000, false, "d", vehicleid);
This worked perfectly, thank you very much Finn
Reply
#2

pawn Код:
SetTimerEx("CarRespawnTimer", 10000, false, "d", vehicleid);
Reply
#3

https://sampwiki.blast.hk/wiki/AddStaticVehicleEx
Reply
#4

Quote:
Originally Posted by [HiC
How does that help him?

Obviously he knows how to add vehicles, he just wants them to respawn when player exits one.

He just needs to use SetTimerEx instead of SetTimer and it'll work.
Reply
#5

Use either CreateVehicle or AddStaticVehicleEx.
This saves lines in the script.

AddStaticVehicleEx & CreateVehicle allow you to set a timer when the vehicle should respawn
when there's no driver on the same line, instead of creating a timer.
Reply
#6

Do as finn says, saves on CPU.
Reply
#7

Quote:
Originally Posted by Finn
pawn Код:
SetTimerEx("CarRespawnTimer", 10000, false, "d", vehicleid);
This worked perfectly, thank you very much Finn
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)