SA-MP Forums Archive
This code instead of re-spawning cars, they remove it. - 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: This code instead of re-spawning cars, they remove it. (/showthread.php?tid=127991)



This code instead of re-spawning cars, they remove it. - HydraX - 15.02.2010

pawn Код:
forward VehicleReset();
public VehicleReset()
{
    new inVeh;
    for( new i = 0; i < MAX_VEHICLES; i++ )
    {
    inVeh = false;
        for( new j = 0; j < MAX_PLAYERS; j++ )
        {
        if(IsPlayerInVehicle( j, i ))
            {
                inVeh = true;
                break;
            }
        }
        if(!inVeh)
        {
            SetVehicleToRespawn(i);
            DestroyVehicle(i);
        }
    }
}



Re: This code instead of re-spawning cars, they remove it. - Fedee! - 15.02.2010

Whats your problem? If you dont wanna destroy them just delete DestroyVehicle.


Re: This code instead of re-spawning cars, they remove it. - HydraX - 15.02.2010

Quote:
Originally Posted by Fedee!
Whats your problem? If you dont wanna destroy them just delete DestroyVehicle.
That doesn't work, It respawns a car, but not the same one that was moved.


Re: This code instead of re-spawning cars, they remove it. - Onyx09 - 15.02.2010

that was Epic delete destroyvehicle lol


Re: This code instead of re-spawning cars, they remove it. - Fedee! - 15.02.2010

Quote:
Originally Posted by HydraX
Quote:
Originally Posted by Fedee!
Whats your problem? If you dont wanna destroy them just delete DestroyVehicle.
That doesn't work, It respawns a car, but not the same one that was moved.
If I understanded, you wanna delete the car first, and then put it to respawn?


Re: This code instead of re-spawning cars, they remove it. - HydraX - 15.02.2010

Quote:
Originally Posted by Fedee!
Quote:
Originally Posted by HydraX
Quote:
Originally Posted by Fedee!
Whats your problem? If you dont wanna destroy them just delete DestroyVehicle.
That doesn't work, It respawns a car, but not the same one that was moved.
If I understanded, you wanna delete the car first, and then put it to respawn?
Shbingo.


Re: This code instead of re-spawning cars, they remove it. - HydraX - 15.02.2010

Quote:
Originally Posted by [GM
LeGenDy ]
that was Epic delete destroyvehicle lol
You don't even know what were talking about do you? Post something useful instead.


Re: This code instead of re-spawning cars, they remove it. - Fedee! - 16.02.2010

Try thisNot TESTED!)
Quote:
Originally Posted by HydraX
pawn Код:
#include <gl_common>
forward VehicleReset();
public VehicleReset()
{
    new inVeh;
    for( new i = 0; i < MAX_VEHICLES; i++ )
    {
    inVeh = false;
        for( new j = 0; j < MAX_PLAYERS; j++ )
        {
        if(IsPlayerInVehicle( j, i ))
            {
                inVeh = true;
                break;
            }
        }
        if(!inVeh)
        {
            SetVehicleToRespawn(i);
            DestroyVehicle(i);
              total_vehicles_from_files += LoadStaticVehiclesFromFile("vehicles/vehicles.cfg"); //Put a file on yourserver/scripfiles/vehicles called vehicles.cfg and you put it like this : modelid,x,y,z,rot,color1,color2
        }
    }
}
That should work.