How to lock a vehicle from the inside?
#5

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.");
    new Float: x, Float: y, Float: z; // define the X, Y, Z
    GetVehiclePos(id, x, y, z); // Get the Vehicle Position of the car
    if(IsPlayerInRangeOfPoint(playerid, 3.0, x, y, z)) // If player near in the vehicle
    {
        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;
}
Reply


Messages In This Thread
How to lock a vehicle from the inside? - by RALL0 - 22.07.2013, 21:59
Re: How to lock a vehicle from the inside? - by RALL0 - 22.07.2013, 23:41
Re: How to lock a vehicle from the inside? - by Scenario - 23.07.2013, 00:04
Re: How to lock a vehicle from the inside? - by RALL0 - 23.07.2013, 00:38
Re: How to lock a vehicle from the inside? - by ToiletDuck - 23.07.2013, 01:06
Re: How to lock a vehicle from the inside? - by Scenario - 23.07.2013, 02:43
Re: How to lock a vehicle from the inside? - by Kar - 23.07.2013, 02:50
Re: How to lock a vehicle from the inside? - by Pottus - 23.07.2013, 04:11
Re: How to lock a vehicle from the inside? - by Scenario - 23.07.2013, 04:31
Re: How to lock a vehicle from the inside? - by RALL0 - 23.07.2013, 14:54

Forum Jump:


Users browsing this thread: 1 Guest(s)