darhal Posted March 10, 2015 Share Posted March 10, 2015 Post the code you dont understand what i say Link to comment
ramzi Posted March 10, 2015 Author Share Posted March 10, 2015 Here it is: --[[ +---------------------------------------------------------------------------- | =================== Script made by Jasper~ =================== | | Please, respect my work -> do not remove the copyrights. | This script took me 45 minutes of my wonderfull life | Bugs/Suggestions? Add me on skype! +----------------------------------------------------------------------------- ]]-- function lock_newvehicles(player, seat, jacked) if isPedOnGround(player) == true then if getElementData(source, "whoLocked") == "team" then local lock = getElementData(source, "lockedTo") if seat == 0 then if getTeamName(getPlayerTeam(player)) == lock then return true else cancelEvent()exports.DZcommands:sendClientMessage("This vehicle is locked for the following team(s): "..lock..".", player, 255, 255, 255) end end elseif getElementData(source, "whoLocked") == "class" then local lock = getElementData(source, "lockedTo") if seat == 0 then if getElementData(player, "class") == lock then return true else cancelEvent() exports.DZcommands:sendClientMessage("This vehicle is locked for the following class(es): "..lock..".", player, 255, 255, 255) end end elseif getElementData(source, "whoLocked") == "account" then local lock = getElementData(source, "lockedTo") local accName = getAccountName(getPlayerAccount(player)) if seat == 0 then if accName == lock then return true else cancelEvent() exports.DZcommands:sendClientMessage("This vehicle is locked and belongs to the following user(s): "..lock..".", player, 255, 255, 255) end end elseif getElementData(source, "whoLocked") == "acl" then local lock = getElementData(source, "lockedTo") local accName = getAccountName(getPlayerAccount(player)) if seat == 0 then if isObjectInACLGroup("user."..accName, aclGetGroup(lock)) then return true else cancelEvent() exports.DZcommands:sendClientMessage("This vehicle is locked for the following group(s): "..lock..".", player, 255, 255, 255) end end end end end addEventHandler("onVehicleStartEnter", getRootElement(), lock_newvehicles) function add_new_vehicle (source, command, whoLock, ...) local accName = getAccountName(getPlayerAccount(source)) if isObjectInACLGroup("user."..accName, aclGetGroup("Admin")) then if isPedInVehicle(source) == true then if not isPedDead(source) == true then local newlock = whoLock if newlock == "team" or newlock == "class" or newlock == "acl" or newlock == "account" then if #arg > 0 then local occupiedVeh = getPedOccupiedVehicle(source) local model = getElementModel(occupiedVeh) local x,y,z = getElementPosition(occupiedVeh) local rx,ry,rz = getElementRotation(occupiedVeh) local lock = table.concat(arg, " ") local groupLock = whoLock local r1, g1, b1, r2, g2, b2 = getVehicleColor(occupiedVeh, true) local color = tostring(r1.. "," ..g1.. "," ..b1.. "," ..r2.. "," ..g2.. "," ..b2) local addVeh = executeSQLQuery("INSERT INTO newprivatevehicles (Model,X,Y,Z,RX,RY,RZ,LOCK,GROUPLOCK,Color) VALUES(?,?,?,?,?,?,?,?,?,?)", tonumber(model), tonumber(x), tonumber(y), tonumber(z), tonumber(rx), tonumber(ry), tonumber(rz), lock, groupLock, tostring(color)) exports.DZcommands:sendClientMessage("Vehicle successfuly created, info: "..groupLock.." - "..lock..".", source, 0,255,0) local newVehicle = createVehicle (tonumber(model),tonumber(x),tonumber(y),tonumber(z), tonumber(rx), tonumber(ry), tonumber(rz)) setElementData(newVehicle, "lockedTo", lock) setElementData(newVehicle, "whoLocked", whoLock) setVehicleColor (newVehicle, tonumber(r1), tonumber(g1), tonumber(b1), tonumber(r2), tonumber(g2), tonumber(b2)) warpPedIntoVehicle(source, newVehicle) else exports.DZcommands:sendClientMessage("Wrong command usage, try '/addveh '.", source, 255, 255, 255) end else exports.DZcommands:sendClientMessage("Wrong command usage, try '/addveh '.", source, 255, 255, 255) end exports.DZcommands:sendClientMessage("You are dead, respawn to make this vehicle!", source, 255, 255, 255) end elseexports.DZcommands:sendClientMessage("You are not in a vehicle, go in a vehicle to create one!", source, 255, 255, 255) end end end addCommandHandler("addveh", add_new_vehicle) -- remove function function remove_lockedvehicle (source) local accName = getAccountName(getPlayerAccount(source)) if isObjectInACLGroup("user."..accName, aclGetGroup("Admin")) then local vehicle = getPedOccupiedVehicle(source) local lock = getElementData(vehicle, "lockedTo") if isPedInVehicle(source) == true then if getElementData(vehicle, "lockedTo") ~= "" then executeSQLQuery("DELETE FROM newprivatevehicles WHERE LOCK=?", lock) destroyElement(vehicle) exports.DZcommands:sendClientMessage("Vehicle has successfully been removed from the database.", source, 255, 255, 255) else exports.DZcommands:sendClientMessage("* This is not a private vehicle, take another vehicle!", source, 255, 255, 255) end else exports.DZcommands:sendClientMessage("* You must be in a vehicle in order to remove this vehicle.", source, 255, 255, 255) end end end addCommandHandler("remveh", remove_lockedvehicle) addEventHandler("onVehicleExplode",root, function () setTimer ( function ( vehicleID, vehicle ) if ( vehicleID and type ( vehicleID ) == "number" ) then table.remove(vehicles, vehicleID) if isElement( vehicle ) then destroyElement ( vehicle ) end executeSQLQuery("CREATE TABLE IF NOT EXISTS newprivatevehicles (Model NUMERIC, X NUMBERIC, Y NUMERIC, Z NUMERIC, RX NUMERIC, RY NUMERIC, RZ NUMERIC, LOCK TEXT, GROUPLOCK TEXT, Color TEXT)") fixVehicle(model, x, y, z, rot, color, upgrades, dataType, allowedTo) end end ,10000, 1, #vehicles, source ) return vehicle end ) Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now