How to lock a vehicle from the inside?
#1

Hey, I tried something so anyone could lock the vehicle from the inside and only the car owner from the outside. However the person that is inside can't lock it ;S
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;
}
Reply
#2

Bump ;(
Reply
#3

Read 'te forum rules.
Reply
#4

Stop reaching for more post counts, just reply once you got something useful to say, I have never seen anyone over here that obey all of the rules and never seen them getting punished for it or w/e.
Reply
#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
#6

Quote:
Originally Posted by RALL0
Посмотреть сообщение
Stop reaching for more post counts, just reply once you got something useful to say, I have never seen anyone over here that obey all of the rules and never seen them getting punished for it or w/e.
Ha. Ha. Ha. Ha. You think I need more posts? I have the second highest post count and the "competition" is 2,000 posts away from me. I could care less about my post count, so just don't even go there- you know it's a cheap shot.

If you're too ignorant to read and abide by the forum rules, then you shouldn't even be on this forum.

Oh and to the people responding to this topic, remember that giving someone the code doesn't help them learn anything.
Reply
#7

Quote:
Originally Posted by RealCop228
Посмотреть сообщение
Oh and to the people responding to this topic, remember that giving someone the code doesn't help them learn anything.
I only gave the correct code because ToiletDuck fucked it up, look at his code.. he messed up the variables.
Reply
#8

Quote:
Originally Posted by RealCop228
Посмотреть сообщение
Ha. Ha. Ha. Ha. You think I need more posts? I have the second highest post count and the "competition" is 2,000 posts away from me. I could care less about my post count, so just don't even go there- you know it's a cheap shot.

If you're too ignorant to read and abide by the forum rules, then you shouldn't even be on this forum.

Oh and to the people responding to this topic, remember that giving someone the code doesn't help them learn anything.
They should set your status from Godfather to Forum Spammer
Reply
#9

Quote:
Originally Posted by [uL]Pottus
Посмотреть сообщение
They should set your status from Godfather to Forum Spammer
Or "no-lifer" since I'm here too much. lol
Reply
#10

Quote:
Originally Posted by RealCop228
Посмотреть сообщение
Or "no-lifer" since I'm here too much. lol
It's not a cheap shot, it's a fact, you just posted 3x and none of them had nothing to do anything with this help request.. If I would break any of these forum rules then the administrators of this forum should take action, not you. Just click the report button or w/e. However no-one really gives a single damn about the rules here.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)