[Solved] Alternative DestroyVehicle(); -
Blt950 - 24.07.2010
Hey, I got this problem, I have some car rental system sat up at my server that I scripted self.
I'm creating the cars with "AddStaticVehicle()"
But when people unrent it, I need to make it spawn back at its position. But I got no DestroyVehicle(); that acts like the vehicle would have exploded. Beacuse then it respawns. With DestroyVehicle(); it doesn't.
Is it some kind of way to destroy the vehicle, but let it respawn as it was destroyed normally?
I've tried setting it high up in air and tried to explode it, and even drown it. None of them worked.
>> Solved <<
Re: Alternative DestroyVehicle(); -
selten98 - 24.07.2010
set pos in the water (or under the map) than destroy (you wont see the explosion)
Re: Alternative DestroyVehicle(); -
Blt950 - 24.07.2010
Tried, wont work. It just never exploded or removed in the water
Re: Alternative DestroyVehicle(); -
[DK]JaloNik - 24.07.2010
Why don't you use AddStaticVehicleEx?
Re: Alternative DestroyVehicle(); -
WillyP - 24.07.2010
or maybe isplayerconnected?
edit:
not that.
lol something like if(vehicle,unrented blablabla
Re: Alternative DestroyVehicle(); -
Mauzen - 24.07.2010
You can set the position of the vehicle to somewhere far away first, and then set its health to 0. Takes ~5 secs to explode and another 5 to respawn.
Re: Alternative DestroyVehicle(); -
Blt950 - 24.07.2010
Quote:
Originally Posted by [DK]JaloNik
Why don't you use AddStaticVehicleEx?
|
I do xD Just didn't said it. It wont make any difference anyway.
Quote:
Originally Posted by Mauzen
You can set the position of the vehicle to somewhere far away first, and then set its health to 0. Takes ~5 secs to explode and another 5 to respawn.
|
Tell me a place far away that you could do something like that. There players never are... :P
Re: Alternative DestroyVehicle(); -
Mauzen - 24.07.2010
for example 0|3333|-10
Should be somewhere in the ocean, 300m north of the coast :P
Re: Alternative DestroyVehicle(); -
Blt950 - 24.07.2010
That doesnt work, if you didnt get that. The car never explodes. I follow it self.
Re: Alternative DestroyVehicle(); -
coole210 - 24.07.2010
RespawnVehicle?
Re: Alternative DestroyVehicle(); -
[DK]JaloNik - 24.07.2010
Quote:
Originally Posted by Blt950
I do xD Just didn't said it. It wont make any difference anyway.
|
If you set the time to be like, 3-5 mn without any player in, it's kinda the same.

Will go fast. XD
Re: Alternative DestroyVehicle(); -
Mauzen - 24.07.2010
Hm, thought it would, tested it sometimes. But maybe it doesnt explode because its streamed out.
Another idea: put it to its spawnpoint "by hand", meaning just set the position. You could also put it together with a repair, but you would need to save its spawn point then (maybe a CreateStaticVehicleExEx and a RespawnVehicle)
Re: Alternative DestroyVehicle(); -
Blt950 - 25.07.2010
If just samp had a simple function as "RespawnVehicle(vehicleid);" That would solve it xD
EDIT: I just found out that it has it lol! https://sampwiki.blast.hk/wiki/SetVehicleToRespawn
Gotta check it out :3
Re: Alternative DestroyVehicle(); -
Mauzen - 25.07.2010
Oops xD
Hm, just thought there would be such a command for players only
Re: Alternative DestroyVehicle(); -
Blt950 - 25.07.2010
Indeed I thought that too..
The command just worked 100%, it even fixes the vehicle and all stuff
They should add this command under "Related Functions" at the wiki. Then I would have found it ages ago xD
Edit: Also made a little edit on the wiki now
https://sampwiki.blast.hk/wiki/RemovePlayerFromVehicle shows a related link to
https://sampwiki.blast.hk/wiki/SetVehicleToRespawn
And even a little extra example of use
Re: Alternative DestroyVehicle(); -
[DK]JaloNik - 25.07.2010
What about this:
pawn Код:
if(strcmp(cmd, "/unrentcar", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(HireCar[playerid] != 299)
{
if(idcar == HireCar[playerid])
{
TogglePlayerControllable(playerid, 1);
}
SetVehicleToRespawn(HireCar[playerid]);
HireCar[playerid] = 299;
GameTextForPlayer(playerid, "~w~You no longer rent a car", 5000, 3);
}
}
return 1;
}
It fits into my system + works perfectly. :P