02.01.2015, 16:37
I'm putting in random vehicles in my script using AddStaticVehicleEx() there are also some vehicles that were created using CreateVehicle() mainly for dealership vehicles. I scripted it in that if the player is an admin and spawns a "temporary vehicle", it would automatically turn the engine on. It's weird that when the vehicle ID reached 200, it stopped working. Any fixes on this?
I already tried this:
and it shows 2000, which is correct.
Here is the code:
I already tried this:
pawn Код:
printf("MAX VEHICLES: %d", MAX_VEHICLES);
Here is the code:
pawn Код:
new TempVehicles[MAX_VEHICLES] = {INVALID_VEHICLE_ID, ...};
command(randomveh, playerid, params[])
{
#pragma unused params
if(IsPlayerConnected(playerid) && Player[playerid][AdminLevel] >= 3)
{
new Float:X, Float:Y, Float:Z, Float:R;
GetPlayerPos(playerid, X, Y, Z);
GetPlayerFacingAngle(playerid, R);
new vid = random(sizeof(RandomVehicles));
new v = RandomVehicles[vid];
new color1 = random(128);
new color2 = random(128);
new vehicle = CreateVehicle(v, X, Y, Z, R, 0, 0, 60000);
ChangeVehicleColor(vehicle, color1, color2);
PutPlayerInVehicle(playerid, vehicle, 0);
for(new i = 0; i < sizeof(TempVehicles); i++)
{
if(TempVehicles[i] == INVALID_VEHICLE_ID)
{
TempVehicles[i] = vehicle;
break;
}
}
}
return 1;
}
public OnPlayerStateChange(playerid, newstate, oldstate)
{
if(IsPlayerConnected(playerid))
{
if(newstate == PLAYER_STATE_DRIVER)
{
if(Player[playerid][AdminLevel] >= 3)
{
new vehicle = GetPlayerVehicleID(playerid);
new engine, lights, alarm, doors, hood, trunk, objective;
if(TempVehicles[vehicle])
{
GetVehicleParamsEx(vehicle, engine, lights, alarm, doors, hood, trunk, objective);
SetVehicleParamsEx(vehicle, VEHICLE_PARAMS_ON, lights, alarm, doors, hood, trunk, objective);
}
}
}
}
return 1;
}