[SOLVED] Need help with respawning a vehicle - 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: [SOLVED] Need help with respawning a vehicle (
/showthread.php?tid=130290)
[SOLVED] Need help with respawning a vehicle -
Hiitch - 26.02.2010
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
Re: Need help with respawning a vehicle -
Finn - 26.02.2010
pawn Код:
SetTimerEx("CarRespawnTimer", 10000, false, "d", vehicleid);
Re: Need help with respawning a vehicle -
[HiC]TheKiller - 26.02.2010
https://sampwiki.blast.hk/wiki/AddStaticVehicleEx
Re: Need help with respawning a vehicle -
Finn - 26.02.2010
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.
Re: Need help with respawning a vehicle -
Mike Garber - 26.02.2010
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.
Re: Need help with respawning a vehicle -
gotenks918 - 26.02.2010
Do as finn says, saves on CPU.
Re: Need help with respawning a vehicle -
Hiitch - 26.02.2010
Quote:
Originally Posted by Finn
pawn Код:
SetTimerEx("CarRespawnTimer", 10000, false, "d", vehicleid);
|
This worked perfectly, thank you very much Finn