can someone check my car lock's code please
#1

hello guys me again got an error with the locks in cars
can someone take a look an see what the problem might be..
in game car alarm and electrical locks not working, standard lock works fine

http://pastebin.com/MsRsKzXM

will +rep for any help
Reply
#2

Fix that pastebin link
Reply
#3

please fix the pastebin link first.
Reply
#4

sorry http://pastebin.com/MsRsKzXM

EDIT: sorry i missed the actual lock command
http://pastebin.com/NR5BzJiD
Reply
#5

Your OnDialogResponse:
pawn Код:
if(dialogid == DIALOG_CDLOCKMENU)
    {
        if(response)
        {
            new idx = PlayerInfo[playerid][InBusiness];
            if(IsNumeric(inputtext))
            {
                new pvid = (strval(inputtext) - 1);
                if(PlayerVehicleInfo[playerid][pvid][pvId] == INVALID_PLAYER_VEHICLE_ID)
                {
                    SendClientMessage(playerid, COLOR_GRAD4, "ERROR: You don't have a vehicle in this slot.");
                    SetPVarInt(playerid, "lockmenu", 0);
                    return 1;
                }
                new var = GetPVarInt(playerid, "lockmenu");
                if(var != 1 && var != 2)
                {
                    SetPVarInt(playerid, "lockmenu", 0);
                    return SendClientMessage(playerid, 0xFF000FF, "Invalid selection.");
                }
                if(PlayerVehicleInfo[playerid][pvid][pvLock] == var)
                {
                    SendClientMessage(playerid, COLOR_GRAD4, "ERROR: You already have this item installed on this vehicle.");
                    SetPVarInt(playerid, "lockmenu", 0);
                    return 1;
                }
                SendClientMessage(playerid, COLOR_GRAD4, ((var == 1) ? ("   You have purchased an alarm lock!") : ("   You have Purchased an industrial lock!")));
                SendClientMessage(playerid, COLOR_YELLOW, "HINT: You can now use /pvlock to lock your car.");
                PlayerInfo[playerid][pCash] -= ((var == 1) ? (BizInfo[idx][bProductsPrice11]) : (BizInfo[idx][bProductsPrice12]));
                BizInfo[idx][bMoney] += ((var == 1) ? (BizInfo[idx][bProductsPrice11]) : (BizInfo[idx][bProductsPrice12]));
                BizInfo[idx][bSupplies]--;
                PlayerVehicleInfo[playerid][pvid][pvLock] = var;
                SetPVarInt(playerid, "lockmenu", 0);
            }
        }
        return 1;
    }
//--------------------------------------------//
    if(dialogid == DIALOG_ELOCK1)
    {
        if(GetPVarInt(playerid, "lockmenu") == 4)
        {
            if(IsNumeric(inputtext))
            {
                new pvid = strval(inputtext)-1;
                if(PlayerVehicleInfo[playerid][pvid][pvId] == INVALID_PLAYER_VEHICLE_ID)
                {
                    SendClientMessageEx(playerid, COLOR_GRAD4, "ERROR: You don't have a vehicle in this slot.");
                    SetPVarInt(playerid, "lockmenu", 0);
                    return 1;
                }
                if(PlayerVehicleInfo[playerid][pvid][pvLock] == 3)
                {
                    SendClientMessageEx(playerid, COLOR_GRAD4, "ERROR: You already have this item installed on this vehicle.");
                    SetPVarInt(playerid, "lockmenu", 0);
                    return 1;
                }
                new String[128];
                SendClientMessageEx(playerid, COLOR_GRAD4, "   You have successfuly installed an electric shock lock!");
                SendClientMessageEx(playerid, COLOR_YELLOW, "HINT: You can now use /pvlock to lock your car.");
                PlayerVehicleInfo[playerid][pvid][pvLock] = 3;
                SetPVarInt(playerid, "lockmenu", 0);
                format(String, sizeof(String), "{AA3333}AdmWarning{FFFF00}: %s (ID %d) has successfuly installed the Electric Shock Lock to their Vehicle", GetPlayerNameEx(playerid), playerid);
                ABroadCast(COLOR_YELLOW, String, 2);
            }
        }
        return 1;
    }
I have no idea where this code is even from??:
pawn Код:
}
    else if(PlayerVehicleInfo[i][v][pvLocked] == 1 && PlayerVehicleInfo[i][v][pvLock] == 1) {
        GetVehicleParamsEx(newcar,engine,lights,alarm,doors,bonnet,boot,objective);
        SetVehicleParamsEx(newcar,engine,lights,VEHICLE_PARAMS_ON,doors,bonnet,boot,objective);
        SetTimerEx("DisableVehicleAlarm", 20000, 0, "d",  newcar);
    }
    else if(PlayerVehicleInfo[i][v][pvLocked] == 1 && PlayerVehicleInfo[i][v][pvLock] == 3) {
        new string[49 + MAX_PLAYER_NAME];
        if(AdminDuty[playerid] == 1)
        {
            format(string, sizeof(string), "* %s has been stunned by an electric shock lock ",GetPlayerNameEx(playerid));
            ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
            new Float:X, Float:Y, Float:Z, Float:HP;
            GetPlayerPos(playerid, X, Y, Z);
            //SendAudioToRange(64, 100, X, Y, Z, 20.0);
            SetPlayerPos(playerid, X + 1, Y, Z);
            RemovePlayerFromVehicle(playerid);
            SetPVarInt(playerid, "IsFrozen", 1);
            TogglePlayerControllable(playerid,0);
            SetTimerEx("ReleasePlayer", 10000, 0, "d", playerid);
            GameTextForPlayer(playerid,"~r~STUNNED!",11000,3);
            GetPlayerHealth(playerid,HP);
            SetPlayerHealth(playerid,HP-15);
        }
        else
        {
            format(string, sizeof(string), "Warning: This %s is owned by %s.", GetVehicleName(newcar), GetPlayerNameEx(i));
            SendClientMessage(playerid, COLOR_GREY, string);
        }
    }
    return 1;
}
Reply
#6

Quote:
Originally Posted by Threshold
Посмотреть сообщение
Your OnDialogResponse:
pawn Код:
if(dialogid == DIALOG_CDLOCKMENU)
    {
        if(response)
        {
            new idx = PlayerInfo[playerid][InBusiness];
            if(IsNumeric(inputtext))
            {
                new pvid = (strval(inputtext) - 1);
                if(PlayerVehicleInfo[playerid][pvid][pvId] == INVALID_PLAYER_VEHICLE_ID)
                {
                    SendClientMessage(playerid, COLOR_GRAD4, "ERROR: You don't have a vehicle in this slot.");
                    SetPVarInt(playerid, "lockmenu", 0);
                    return 1;
                }
                new var = GetPVarInt(playerid, "lockmenu");
                if(var != 1 && var != 2)
                {
                    SetPVarInt(playerid, "lockmenu", 0);
                    return SendClientMessage(playerid, 0xFF000FF, "Invalid selection.");
                }
                if(PlayerVehicleInfo[playerid][pvid][pvLock] == var)
                {
                    SendClientMessage(playerid, COLOR_GRAD4, "ERROR: You already have this item installed on this vehicle.");
                    SetPVarInt(playerid, "lockmenu", 0);
                    return 1;
                }
                SendClientMessage(playerid, COLOR_GRAD4, ((var == 1) ? ("   You have purchased an alarm lock!") : ("   You have Purchased an industrial lock!")));
                SendClientMessage(playerid, COLOR_YELLOW, "HINT: You can now use /pvlock to lock your car.");
                PlayerInfo[playerid][pCash] -= ((var == 1) ? (BizInfo[idx][bProductsPrice11]) : (BizInfo[idx][bProductsPrice12]));
                BizInfo[idx][bMoney] += ((var == 1) ? (BizInfo[idx][bProductsPrice11]) : (BizInfo[idx][bProductsPrice12]));
                BizInfo[idx][bSupplies]--;
                PlayerVehicleInfo[playerid][pvid][pvLock] = var;
                SetPVarInt(playerid, "lockmenu", 0);
            }
        }
        return 1;
    }
//--------------------------------------------//
    if(dialogid == DIALOG_ELOCK1)
    {
        if(GetPVarInt(playerid, "lockmenu") == 4)
        {
            if(IsNumeric(inputtext))
            {
                new pvid = strval(inputtext)-1;
                if(PlayerVehicleInfo[playerid][pvid][pvId] == INVALID_PLAYER_VEHICLE_ID)
                {
                    SendClientMessageEx(playerid, COLOR_GRAD4, "ERROR: You don't have a vehicle in this slot.");
                    SetPVarInt(playerid, "lockmenu", 0);
                    return 1;
                }
                if(PlayerVehicleInfo[playerid][pvid][pvLock] == 3)
                {
                    SendClientMessageEx(playerid, COLOR_GRAD4, "ERROR: You already have this item installed on this vehicle.");
                    SetPVarInt(playerid, "lockmenu", 0);
                    return 1;
                }
                new String[128];
                SendClientMessageEx(playerid, COLOR_GRAD4, "   You have successfuly installed an electric shock lock!");
                SendClientMessageEx(playerid, COLOR_YELLOW, "HINT: You can now use /pvlock to lock your car.");
                PlayerVehicleInfo[playerid][pvid][pvLock] = 3;
                SetPVarInt(playerid, "lockmenu", 0);
                format(String, sizeof(String), "{AA3333}AdmWarning{FFFF00}: %s (ID %d) has successfuly installed the Electric Shock Lock to their Vehicle", GetPlayerNameEx(playerid), playerid);
                ABroadCast(COLOR_YELLOW, String, 2);
            }
        }
        return 1;
    }
I have no idea where this code is even from??:
pawn Код:
}
    else if(PlayerVehicleInfo[i][v][pvLocked] == 1 && PlayerVehicleInfo[i][v][pvLock] == 1) {
        GetVehicleParamsEx(newcar,engine,lights,alarm,doors,bonnet,boot,objective);
        SetVehicleParamsEx(newcar,engine,lights,VEHICLE_PARAMS_ON,doors,bonnet,boot,objective);
        SetTimerEx("DisableVehicleAlarm", 20000, 0, "d",  newcar);
    }
    else if(PlayerVehicleInfo[i][v][pvLocked] == 1 && PlayerVehicleInfo[i][v][pvLock] == 3) {
        new string[49 + MAX_PLAYER_NAME];
        if(AdminDuty[playerid] == 1)
        {
            format(string, sizeof(string), "* %s has been stunned by an electric shock lock ",GetPlayerNameEx(playerid));
            ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
            new Float:X, Float:Y, Float:Z, Float:HP;
            GetPlayerPos(playerid, X, Y, Z);
            //SendAudioToRange(64, 100, X, Y, Z, 20.0);
            SetPlayerPos(playerid, X + 1, Y, Z);
            RemovePlayerFromVehicle(playerid);
            SetPVarInt(playerid, "IsFrozen", 1);
            TogglePlayerControllable(playerid,0);
            SetTimerEx("ReleasePlayer", 10000, 0, "d", playerid);
            GameTextForPlayer(playerid,"~r~STUNNED!",11000,3);
            GetPlayerHealth(playerid,HP);
            SetPlayerHealth(playerid,HP-15);
        }
        else
        {
            format(string, sizeof(string), "Warning: This %s is owned by %s.", GetVehicleName(newcar), GetPlayerNameEx(i));
            SendClientMessage(playerid, COLOR_GREY, string);
        }
    }
    return 1;
}
thanks for the reply mate, but its still not locking the doors on the car, can you look at my second post i did paste the pastebin link please, sorry to be a pain man just buggin me badly lol
Reply
#7

I know, I didn't work on that. I don't know where the bottom code is even from? You haven't explained it very well.
Reply
#8

the bottom code is what happens when the lock is activated i guess
http://pastebin.com/NR5BzJiD
Reply
#9

You guess?

I realise that, but WHERE is it? What callback does it originate from?
Reply
#10

this is all that i could find along with the other stuff i posted earlier
http://pastebin.com/AGEgjAYA
Reply


Forum Jump:


Users browsing this thread: 4 Guest(s)