SA-MP Forums Archive
Dynamic vehicle system. - 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: Dynamic vehicle system. (/showthread.php?tid=449676)



Dynamic vehicle system. - lean1337 - 09.07.2013

Hello, I'm working on a dynamic filterscript. However there is one issue, when I spawn the vehicle it wont assign the correct id to the correct vehicle.
pawn Код:
stock SpawnCars()
{
    for(new ID = 0; ID < sizeof(VehInfo); ID++)
    {
        if(!(VehInfo[ID][VehCreated] == 0))
        {
        new plate[12];
        VEHICL[ID] = CreateVehicle(VehInfo[ID][VehType], VehInfo[ID][VehSpawnX], VehInfo[ID][VehSpawnY], VehInfo[ID][VehSpawnZ], VehInfo[ID][VehZAngle], VehInfo[ID][VehColor1], VehInfo[ID][VehColor2], -1);
        }
    }
    return 1;
}

pawn Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
        new string[64];
        format(string, sizeof(string),"you enterd vehicle ID :%d",VEHICL[vehicleid]);
        SCM(playerid, COLOR_GREEN, string);
        return 1;
}
I also have a command to teleport me to a specifyed vehicle and it dosent take me to the correct vehicleID I get when I enter the vehicle


Re: Dynamic vehicle system. - Calabresi - 09.07.2013

pawn Код:
stock SpawnCars()
{
    for(new ID = 0; ID < sizeof(VehInfo); ID++)
    {
        if(VehInfo[ID][VehCreated] == 0)
        {
              new plate[12];
              VEHICL[ID] = CreateVehicle(VehInfo[ID][VehType], VehInfo[ID][VehSpawnX], VehInfo[ID][VehSpawnY], VehInfo[ID][VehSpawnZ], VehInfo[ID][VehZAngle], VehInfo[ID][VehColor1], VehInfo[ID][VehColor2], -1);
              VehInfo[ID][VehCreated] = 1;
        }
    }
    return 1;
}
Try this.


Re: Dynamic vehicle system. - lean1337 - 09.07.2013

With that it wont spawn any vehicle, VehInfo[ID][VehCreated] is already defined in the database file.