SA-MP Forums Archive
Vehicle lock - 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)
+--- Thread: Vehicle lock (/showthread.php?tid=451265)



Vehicle lock - RALL0 - 16.07.2013

Hey guys, I am using AVS FS and I am wondering how can I lock all cars from the inside unless you got the keys for it. Here are the codes
pawn Код:
CMD:lock(playerid, params[])
{
    new vehicleid;
    new engine, lights, alarm, doors, bonnet, boot, objective;
    GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
    if(!vehicleid) return SendClientMessage(playerid, COLOR_DARKRED, "[SERVER] {FFFFFF}You aren't near your vehicle.");
    new id = GetVehicleID(vehicleid);
    if(!IsValidVehicle(id)) return SendClientMessage(playerid, COLOR_DARKRED, "[SERVER] {FFFFFF}You don't have the keys for that.");
    if(GetPlayerVehicleAccess(playerid, id) < 2)
    return SendClientMessage(playerid, COLOR_DARKRED, "[SERVER] {FFFFFF}You don't have the keys for that.");
    if(doors == 1 || GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
    {
        doors = 0;
        VehicleLock[id] = 0;
        SendClientMessage(playerid, COLOR_GREEN, "Unlocked.");
    }
    else
    {
        doors = 1;
        VehicleLock[id] = 1;
        SendClientMessage(playerid, COLOR_RED, "Locked.");
    }
    SetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
    SaveVehicle(id);
    return 1;
}



Re: Vehicle lock - RALL0 - 16.07.2013

Bump