[HELP] Spawned cars
#1

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.
Reply
#2

Yes OFC We Need Code
Reply
#3

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;
}
Reply
#4

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

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.
Reply
#6

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.
Reply
#7

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
Reply
#8

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...
Reply
#9

Ranama's solution not working.
xtreamer's solution not working.
Reply
#10

Maybe you need streamer.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)