04.04.2009, 16:04
pawn Код:
new PlayerLastVehicleID[MAX_PLAYERS],
Float:VehicleSpawnLocations[MAX_VEHICLES][4];
pawn Код:
stock CreateVehicleEx(vehicletype, Float:x, Float:y, Float:z, Float:rotation, color1, color2, respawn_delay)
{
new vehicleid = CreateVehicle(vehicletype, 0.0, 0.0, 0.0, 0.0, color1, color2, respawn_delay);
VehicleSpawnLocations[vehicleid - 1][0] = x;
VehicleSpawnLocations[vehicleid - 1][1] = y;
VehicleSpawnLocations[vehicleid - 1][2] = z;
VehicleSpawnLocations[vehicleid - 1][3] = rotation;
OnVehicleSpawn(vehicleid);
return vehicleid;
}
pawn Код:
//OnPlayerStateChange
if(newstate == STATE_DRIVER || newstate == STATE_PASSENGER)
PlayerLastVehicleID[playerid] = GetPlayerVehicleID(playerid);
else if(oldstate == STATE_DRIVER || oldstate == STATE_PASSENGER)
{
new vehicleid = PlayerLastVehicleID[playerid];
GetVehiclePos(vehicleid,
VehicleSpawnLocations[vehicleid - 1][0],
VehicleSpawnLocations[vehicleid - 1][1],
VehicleSpawnLocations[vehicleid - 1][2]);
GetVehicleZAngle(vehicleid,
VehicleSpawnLocations[vehicleid - 1][3]);
}
pawn Код:
//OnVehicleSpawn
SetVehiclePos(vehicleid,
VehicleSpawnLocations[vehicleid - 1][0],
VehicleSpawnLocations[vehicleid - 1][1],
VehicleSpawnLocations[vehicleid - 1][2]);
SetVehicleZAngle(vehicleid,
VehicleSpawnLocations[vehicleid - 1][3]);