CMD:lock isn't locking?
#1

pawn Код:
CMD:lock(playerid, params[])
{
    new engine, lights, alarm, doors, bonnet, boot, objective;
    new keycar = PlayerInfo[playerid][pPcarkey];
    if(keycar != 9999)
    {
        new Float:X,Float:Y,Float:Z;
        GetVehiclePos(keycar,X,Y,Z);
        if(IsPlayerInRangeOfPoint(playerid, 10,X,Y,Z))
        {
            if(CarInfo[keycar][cLock] == 1)
            {
                SCM(playerid, COLOR_LIGHTBLUE, "Vehicle Unlocked!");
                CarInfo[keycar][cLock] = 0;
                GetVehicleParamsEx(keycar2, engine, lights, alarm, doors, bonnet, boot, objective);
                SetVehicleParamsEx(keycar2, engine, lights, alarm, 0, bonnet, boot, objective);
                OnPropUpdate(4,keycar);
                return 1;
            }
            else if(CarInfo[keycar][cLock] == 0)
            {
                SCM(playerid, COLOR_LIGHTBLUE, "Vehicle Locked!");
                CarInfo[keycar][cLock] = 1;
                GetVehicleParamsEx(keycar2, engine, lights, alarm, doors, bonnet, boot, objective);
                SetVehicleParamsEx(keycar2, engine, lights, alarm, 1, bonnet, boot, objective);
                OnPropUpdate(4,keycar);
                return 1;
            }
        }
       
        // Car 2
        new keycar2 = PlayerInfo[playerid][pPcarkey2];
        if(keycar2 != 9999)
        {
            new Float:X2,Float:Y2,Float:Z2;
            GetVehiclePos(keycar2,X2,Y2,Z2);
            if(IsPlayerInRangeOfPoint(playerid, 10,X2,Y2,Z2))
            {
                if(CarInfo[keycar2][cLock] == 1)
                {
                    SCM(playerid, COLOR_LIGHTBLUE, "Vehicle 2 Unlocked!");
                    CarInfo[keycar2][cLock] = 0;
                    GetVehicleParamsEx(keycar2, engine, lights, alarm, doors, bonnet, boot, objective);
                    SetVehicleParamsEx(keycar2, engine, lights, alarm, 0, bonnet, boot, objective);
                    OnPropUpdate(4,keycar2);
                    return 1;
                }
                else if(CarInfo[keycar2][cLock] == 0)
                {
                    SCM(playerid, COLOR_LIGHTBLUE, "Vehicle 2 Locked!");
                    CarInfo[keycar2][cLock] = 1;
                    GetVehicleParamsEx(keycar2, engine, lights, alarm, doors, bonnet, boot, objective);
                    SetVehicleParamsEx(keycar2, engine, lights, alarm, 1, bonnet, boot, objective);
                    OnPropUpdate(4,keycar2);
                    return 1;
                }
            }
        }
        else
        {
            SCM(playerid, COLOR_GREY,"* You must be near or in your vehicle to lock it!");
            return 1;
        }
    }
    else
    {
        SCM(playerid, COLOR_GREY, "* You don't have a vehicle at slot 1/2!");
        return 1;
    }
    return 1;
}
Have I made a stupid mistake here, or why do cars not lock?

I don't see why they shudn't? They use the correct params, says it locked etc, but doors do not lock?
Reply
#2

if(IsPlayerConnected(playerid) && Vehicle[GetPlayerVehicleID(playerid)][IsLocked] == 0){

maybe add?
Reply
#3

That wont work.
Reply
#4

pawn Код:
new keycar

SetVehicleParamsEx(keycar2
Reply
#5

The guy above me is right. ^
pawn Код:
CMD:lock(playerid, params[])
{
    new engine, lights, alarm, doors, bonnet, boot, objective;
    new keycar = PlayerInfo[playerid][pPcarkey];
    if(keycar != 9999)
    {
        new Float:X,Float:Y,Float:Z;
        GetVehiclePos(keycar,X,Y,Z);
        if(IsPlayerInRangeOfPoint(playerid, 10,X,Y,Z))
        {
            if(CarInfo[keycar][cLock] == 1)
            {
                SCM(playerid, COLOR_LIGHTBLUE, "Vehicle Unlocked!");
                CarInfo[keycar][cLock] = 0;
                GetVehicleParamsEx(keycar, engine, lights, alarm, doors, bonnet, boot, objective);
                SetVehicleParamsEx(keycar, engine, lights, alarm, 0, bonnet, boot, objective);
                OnPropUpdate(4,keycar);
                return 1;
            }
            else if(CarInfo[keycar][cLock] == 0)
            {
                SCM(playerid, COLOR_LIGHTBLUE, "Vehicle Locked!");
                CarInfo[keycar][cLock] = 1;
                GetVehicleParamsEx(keycar, engine, lights, alarm, doors, bonnet, boot, objective);
                SetVehicleParamsEx(keycar, engine, lights, alarm, 1, bonnet, boot, objective);
                OnPropUpdate(4,keycar);
                return 1;
            }
        }
       
        // Car 2
        new keycar2 = PlayerInfo[playerid][pPcarkey2];
        if(keycar2 != 9999)
        {
            new Float:X2,Float:Y2,Float:Z2;
            GetVehiclePos(keycar2,X2,Y2,Z2);
            if(IsPlayerInRangeOfPoint(playerid, 10,X2,Y2,Z2))
            {
                if(CarInfo[keycar2][cLock] == 1)
                {
                    SCM(playerid, COLOR_LIGHTBLUE, "Vehicle 2 Unlocked!");
                    CarInfo[keycar2][cLock] = 0;
                    GetVehicleParamsEx(keycar2, engine, lights, alarm, doors, bonnet, boot, objective);
                    SetVehicleParamsEx(keycar2, engine, lights, alarm, 0, bonnet, boot, objective);
                    OnPropUpdate(4,keycar2);
                    return 1;
                }
                else if(CarInfo[keycar2][cLock] == 0)
                {
                    SCM(playerid, COLOR_LIGHTBLUE, "Vehicle 2 Locked!");
                    CarInfo[keycar2][cLock] = 1;
                    GetVehicleParamsEx(keycar2, engine, lights, alarm, doors, bonnet, boot, objective);
                    SetVehicleParamsEx(keycar2, engine, lights, alarm, 1, bonnet, boot, objective);
                    OnPropUpdate(4,keycar2);
                    return 1;
                }
            }
        }
        else
        {
            SCM(playerid, COLOR_GREY,"* You must be near or in your vehicle to lock it!");
            return 1;
        }
    }
    else
    {
        SCM(playerid, COLOR_GREY, "* You don't have a vehicle at slot 1/2!");
        return 1;
    }
    return 1;
}
Reply
#6

Hmm that worked.

What did I do wrong, please could you explain for future referance,

What bit of code was wrong?
Reply
#7

In the first car script.

new keycar = PlayerInfo[playerid][pPcarkey];

SetVehicleParamsEx(keycar2, engine, lights, alarm, 0, bonnet, boot, objective);

Clear enough ?
Reply
#8

Quote:
Originally Posted by Unte99
Посмотреть сообщение
In the first car script.

new keycar = PlayerInfo[playerid][pPcarkey];

SetVehicleParamsEx(keycar2, engine, lights, alarm, 0, bonnet, boot, objective);

Clear enough ?
Omd, stupid spelling mistake ;l. Thanks
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)