19.02.2011, 22:01
pawn Код:
// Create an array that can hold up to 2000 vehicles (samp limit), put this at the top of the script
new StaticVehicles[2000];
// Use this to create a vehicle during OnGameModeInit:
Vehicle_AddStatic(VehicleModel, x, y, z, rotation, color1, color2, spawndelay);
// Example:
Vehicle_AddStatic(462, -475.0, -523.0, 26.0, 90.0, -1, -1, 600);
// The function:
Vehicle_AddStatic(vModel, Float:vX, Float:vY, Float:vZ, Float:vRotation, vC1, vC2, vSpawnDelay)
{
// Create a new static vehicle during GameModeInit
new vid = AddStaticVehicleEx(vModel, vX, vY, vZ, vRotation, vC1, vC2, vSpawnDelay);
// Set this vehicle as a static vehicle
StaticVehicles[vid] = 1;
return vid;
}
// In OnPlayerEnterVehicle:
if (StaticVehicles[vehicleid] == 0) // Check if this isn't a static vehicle
SendClientMessage(playerid, 0xFFFFFFFF, "You entered an admin car");
When an admin spawns a vehicle later with CreateVehicle, the array holds 0 for that vehicle-id, as you didn't use the "Vehicle_AddStatic" function to create the vehicle.