I want to exclude some vehicles from respawn | I TRIED EVERYTHING
#1

Код HTML:
public RACtime(playerid)
{
      for(new player=0; player<MAX_PLAYERS; player++)
      {
      if(!IsVehicleOccupied(player)) SetVehicleToRespawnEx(player);
      }
      for(new car = 1; car <= 1300; car++)
      {
          if(!IsVehicleOccupied(car)) SetVehicleToRespawnEx(car);

      }
      return 1;
}
Reply
#2

Can you show the SetVehicleToRespawnEx stock?
Btw what do you exactly want these codes to do? Explain it so that i can help better
Reply
#3

Here:
pawn Код:
stock SetVehicleToRespawnEx(vehicleid)
{

    foreach(Player, v)
    {
        if(vehicleid == playerVariables[v][pCarID1] && playerVariables[v][pCarModel1] >= 1)
        {
            DestroyVehicle(playerVariables[v][pCarID1]);
            playerVariables[v][pCarID1] = CreateVehicle(playerVariables[v][pCarModel1], playerVariables[v][pCarPos1][0], playerVariables[v][pCarPos1][1], playerVariables[v][pCarPos1][2], playerVariables[v][pCarPos1][3], playerVariables[v][pCarColour1][0], playerVariables[v][pCarColour1][1], -1);
            for(new i = 0; i < 13; i++)
            {
                if(playerVariables[v][pCarMods1][i] >= 1) AddVehicleComponent(playerVariables[v][pCarID1], playerVariables[v][pCarMods1][i]);
            }
            if(playerVariables[v][pCarPaintjob] >= 0) ChangeVehiclePaintjob(playerVariables[v][pCarID1], playerVariables[v][pCarPaintjob]);
            return 1;
        }
        if(vehicleid == playerVariables[v][pCarID2] && playerVariables[v][pCarModel2] >= 1) {

            DestroyVehicle(playerVariables[v][pCarID2]);
            playerVariables[v][pCarID2] = CreateVehicle(playerVariables[v][pCarModel2], playerVariables[v][pCarPos2][0], playerVariables[v][pCarPos2][1], playerVariables[v][pCarPos2][2], playerVariables[v][pCarPos2][3], playerVariables[v][pCarColour2][0], playerVariables[v][pCarColour2][1], -1);

            for(new i = 0; i < 13; i++)
            {
                if(playerVariables[v][pCarMods2][i] >= 1) AddVehicleComponent(playerVariables[v][pCarID2], playerVariables[v][pCarMods2][i]);
            }
            if(playerVariables[v][pCarPaintjob2] >= 0) ChangeVehiclePaintjob(playerVariables[v][pCarID2], playerVariables[v][pCarPaintjob2]);
            return 1;
        }
        if(vehicleid == playerVariables[v][pCarID3] && playerVariables[v][pCarModel3] >= 1) {

            DestroyVehicle(playerVariables[v][pCarID3]);
            playerVariables[v][pCarID3] = CreateVehicle(playerVariables[v][pCarModel3], playerVariables[v][pCarPos3][0], playerVariables[v][pCarPos3][1], playerVariables[v][pCarPos3][2], playerVariables[v][pCarPos3][3], playerVariables[v][pCarColour3][0], playerVariables[v][pCarColour3][1], -1);

            for(new i = 0; i < 13; i++)
            {
                if(playerVariables[v][pCarMods3][i] >= 1) AddVehicleComponent(playerVariables[v][pCarID3], playerVariables[v][pCarMods3][i]);
            }
            if(playerVariables[v][pCarPaintjob3] >= 0) ChangeVehiclePaintjob(playerVariables[v][pCarID3], playerVariables[v][pCarPaintjob3]);
            return 1;
        }
        if(vehicleid == playerVariables[v][pCarID4] && playerVariables[v][pCarModel4] >= 1) {

            DestroyVehicle(playerVariables[v][pCarID4]);
            playerVariables[v][pCarID4] = CreateVehicle(playerVariables[v][pCarModel4], playerVariables[v][pCarPos4][0], playerVariables[v][pCarPos4][1], playerVariables[v][pCarPos4][2], playerVariables[v][pCarPos4][3], playerVariables[v][pCarColour4][0], playerVariables[v][pCarColour4][1], -1);

            for(new i = 0; i < 13; i++)
            {
                if(playerVariables[v][pCarMods4][i] >= 1) AddVehicleComponent(playerVariables[v][pCarID4], playerVariables[v][pCarMods4][i]);
            }
            if(playerVariables[v][pCarPaintjob4] >= 0) ChangeVehiclePaintjob(playerVariables[v][pCarID4], playerVariables[v][pCarPaintjob4]);
            return 1;
        }
    }
    for(new x; x < MAX_VEHICLES; x++)
    {
        if(vehicleVariables[x][vVehicleScriptID] == vehicleid)
        {
            DestroyVehicle(vehicleVariables[x][vVehicleScriptID]);
            vehicleVariables[x][vVehicleScriptID] = CreateVehicle(vehicleVariables[x][vVehicleModelID], vehicleVariables[x][vVehiclePosition][0], vehicleVariables[x][vVehiclePosition][1], vehicleVariables[x][vVehiclePosition][2], vehicleVariables[x][vVehicleRotation], vehicleVariables[x][vVehicleColour][0], vehicleVariables[x][vVehicleColour][1], 60000);
            return 1;
        }
        else if(AdminSpawnedVehicles[x] == vehicleid)
        {
            SetVehicleToRespawn(AdminSpawnedVehicles[x]);
            return 1;
        }
    }
    return 1;
}
Reply
#4

I want to EXCLUDE some vehiecle ids from respawn.
Reply
#5

It compiled fine , but how can i exclude the truck trailers from rac? (respawn all cars)
Reply
#6

Create a table, where you will store the IDs of truck trailers, and you will need to use if statement, as showed above, which is excluding valid vehicles from respawn.

Like this:
pawn Код:
if(!IsValidVehicle(car)) continue;
But with your truck trailers table created. Create your table at the top, of your script, somewhere under the includes. If you need to find the IDs of trailers, look for them in SA-MP's wiki, there are all the IDs of vehicles and its attachments (trailers etc.)
Reply
#7

I already have my all cars stored on mysql with car ids and samp car ids how can i exclude them using statement?
What statement give me an example.
Reply
#8

Did I say anything about MySQL database, or table (array)? Try to find more informations about it, do your own research, and you will find what you.

About the "if statement", it has been described at wiki.sa-mp - ALSO, I have literally told you everything, what you need to do, to get it done. Method of tries and mistakes will never let you down.

Before you post your next post.. TRY.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)