need help with car saving...
#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


Messages In This Thread
need help with car saving... - by introzen - 04.04.2009, 09:41
Re: need help with car saving... - by MenaceX^ - 04.04.2009, 10:56
Re: need help with car saving... - by introzen - 04.04.2009, 15:45
Re: need help with car saving... - by Nero_3D - 04.04.2009, 16:04

Forum Jump:


Users browsing this thread: 1 Guest(s)