04.04.2009, 09:41
Hey, I wonder how you do so whenever a person exits ANY car... It will change the spawn location for that car to that location...
Please help? =)
Please help? =)
Originally Posted by MenaceX^
Use OnPlayerExitVehicle.
|
new PlayerLastVehicleID[MAX_PLAYERS],
Float:VehicleSpawnLocations[MAX_VEHICLES][4];
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;
}
//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]);
}
//OnVehicleSpawn
SetVehiclePos(vehicleid,
VehicleSpawnLocations[vehicleid - 1][0],
VehicleSpawnLocations[vehicleid - 1][1],
VehicleSpawnLocations[vehicleid - 1][2]);
SetVehicleZAngle(vehicleid,
VehicleSpawnLocations[vehicleid - 1][3]);