Car Lock and Unlock System By ZainGamingNinjaPro

Started by zainraza1789, Nov 29, 2024, 02:26 PM

Previous topic - Next topic

zainraza1789

Car Lock System By ZainGamingNinjaPro


Paste This Code in Onplayercommand


else if (cmd == "unlockcar") {
    if (!player.IsSpawned) {
        MessagePlayer("[#ff4500][WARNING][#ffffff] You must be spawned to use this command!", player);
    } else if (!text) {
        MessagePlayer("[#1e90ff][USAGE][#ffffff] /unlockcar <Vehicle ID>", player);
    } else if (!IsNum(text)) {
        MessagePlayer("[#ff4500][ERROR][#ffffff] Vehicle ID must be a numeric value.", player);
    } else {
        local veh = FindVehicle(text.tointeger());
        if (!veh) {
            MessagePlayer("[#ff0000][ERROR][#ffffff] No vehicle found with the given ID.", player);
        } else {
            MessagePlayer("[#32cd32][SUCCESS][#ffffff] Vehicle [#ffa500]" + GetVehicleNameFromModel(veh.Model) + " [#ffffff]has been unlocked.", player);
            veh.Locked = false;
        }
    }
    return 0;
}

else if (cmd == "lockcar") {
    if (!player.IsSpawned) {
        MessagePlayer("[#ff4500][WARNING][#ffffff] You must be spawned to use this command!", player);
    } else if (!text) {
        MessagePlayer("[#1e90ff][USAGE][#ffffff] /lockcar <Vehicle ID>", player);
    } else if (!IsNum(text)) {
        MessagePlayer("[#ff4500][ERROR][#ffffff] Vehicle ID must be a numeric value.", player);
    } else {
        local veh = FindVehicle(text.tointeger());
        if (!veh) {
            MessagePlayer("[#ff0000][ERROR][#ffffff] No vehicle found with the given ID.", player);
        } else {
            MessagePlayer("[#32cd32][SUCCESS][#ffffff] Vehicle [#ffa500]" + GetVehicleNameFromModel(veh.Model) + " [#ffffff]has been locked.", player);
            veh.Locked = true;
        }
    }
    return 0;
}