SA-MP Forums Archive
[HELP] Spawned cars - 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)
+--- Thread: [HELP] Spawned cars (/showthread.php?tid=372572)



[HELP] Spawned cars - anito - 27.08.2012

Hey. This is my problem:
1. I come to some place.
2. I type /hydra
3. It spawns hydra and put me into hydra.
4. I left that place and come back later.
5. There is another hydra spawned at place where i spawned first hydra.

If you need any code, i will give you.


Re: [HELP] Spawned cars - Sig Hansen - 27.08.2012

Yes OFC We Need Code


Re: [HELP] Spawned cars - anito - 27.08.2012

But what should i give you?

pawn Код:
COMMAND:hydra(playerid, params[])
{
    if(IsPlayerInAnyVehicle(playerid))
    {
        DestroyVehicle(GetPlayerVehicleID(playerid));
        PutPlayerInVehicle(playerid, CreateVehicle(520, X, Y, Z+2, VAngle, -1, -1, -1), 0);
    }
    else
    {
        PutPlayerInVehicle(playerid, CreateVehicle(520, X, Y, Z+2, Angle, -1, -1, -1), 0);
    }
    return 1;
}



Re: [HELP] Spawned cars - xtreamer - 27.08.2012

and where did you defined the X, Y , Z coordinateS?


Re: [HELP] Spawned cars - anito - 27.08.2012

I just figured out that when i die in the spawned car and come back to place where its been spawned, there it is spawned.


Re: [HELP] Spawned cars - xtreamer - 27.08.2012

try changing this:

if(IsPlayerInAnyVehicle(playerid))
{
DestroyVehicle(GetPlayerVehicleID(playerid));
PutPlayerInVehicle(playerid, CreateVehicle(520, X, Y, Z+2, VAngle, -1, -1, -1), 0);
}



to this



if(IsPlayerInAnyVehicle(playerid))
{
DestroyVehicle(GetPlayerVehicleID(playerid));
PutPlayerInVehicle(playerid, CreateVehicle(520, X, Y, Z+2, VAngle, -1, -1, -1), 0);
return 1;

} This way, it may not conflict with the else. I think this should be the problem. The script goes to the if, but it doesn't stop, and then it goes to the else also.


Re: [HELP] Spawned cars - Ranama - 27.08.2012

Is it that when you spawn your car and it explode it respawn at the spawning location, if it is then you'll have to use
https://sampwiki.blast.hk/wiki/OnVehicleDeath
and destroy the car that "died".
Hope it helped


Re: [HELP] Spawned cars - xtreamer - 27.08.2012

yeah I think that's the trick, but it still sounds strange that he found 2 hydras at the same spot. I mean after he was saying, he came back with the hydra that he creadet, at the place where he created the hydra, and found another hydra in that place...


Re: [HELP] Spawned cars - anito - 27.08.2012

Ranama's solution not working.
xtreamer's solution not working.


Re: [HELP] Spawned cars - RedJohn - 28.08.2012

Maybe you need streamer.