OnPlayerEnterVehicle
#4

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");
The array StaticVehicles will hold "1" for every static vehicle you created during OnGameModeInit.
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.
Reply


Messages In This Thread
OnPlayerEnterVehicle - by DokerJr - 18.02.2011, 21:08
Re: OnPlayerEnterVehicle - by OKStyle - 19.02.2011, 03:30
Re: OnPlayerEnterVehicle - by DokerJr - 19.02.2011, 21:20
Re: OnPlayerEnterVehicle - by PowerPC603 - 19.02.2011, 22:01
Re: OnPlayerEnterVehicle - by Vince - 19.02.2011, 22:18
Re: OnPlayerEnterVehicle - by DokerJr - 20.02.2011, 13:44
Re: OnPlayerEnterVehicle - by rjjj - 20.02.2011, 14:26

Forum Jump:


Users browsing this thread: 1 Guest(s)