SA-MP Forums Archive
need help with car saving... - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: need help with car saving... (/showthread.php?tid=71831)



need help with car saving... - introzen - 04.04.2009

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? =)


Re: need help with car saving... - MenaceX^ - 04.04.2009

Use OnPlayerExitVehicle.


Re: need help with car saving... - introzen - 04.04.2009

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


Re: need help with car saving... - Nero_3D - 04.04.2009

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