need help with car saving...
#1

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? =)
Reply
#2

Use OnPlayerExitVehicle.
Reply
#3

Quote:
Originally Posted by MenaceX^
Use OnPlayerExitVehicle.
yeah but how?
Reply
#4

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]);
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)