ramzi
Members-
Posts
90 -
Joined
-
Last visited
Everything posted by ramzi
-
Another error shows up : WARNING: sqlvehicles\vehicles_usefulserver.lua:120: Bad argument @ 'addEventHandler' [Expected element at argument 2, got nil]
-
error msg: SCRIPT ERROR: sqlvehicles\vehicles_usefulserver.lua:137: ')' expected (to close '(' at line 119) near 'return' ERROR: Loading script failed: sqlvehicles\vehicles_usefulserver.lua:137: ')' expected (to close '(' at line 119) near 'return'
-
i did,here is the new code: --[[ +---------------------------------------------------------------------------- | =================== 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",vehicle, 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)") createPrivateVehicle(model, x, y, z, rot, color, upgrades, dataType, allowedTo) end end ,10000, 1, #vehicles, source ) end return vehicle )
-
Okay here is the new one: --[[ +---------------------------------------------------------------------------- | =================== 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",vehicle, 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)") createPrivateVehicle(model, x, y, z, rot, color, upgrades, dataType, allowedTo) end end ,10000, 1, #vehicles, source ) end return vehicle end )
-
Sry mate,if i have wasted ur time,but errors still showing on: SCRIPT ERROR: sqlvehicles\vehicles_usefulserver.lua:137: ')' expected (to close '(' at line 119) near 'return' ERROR: Loading script failed: sqlvehicles\vehicles_usefulserver.lua:137: ')' expected (to close '(' at line 119) near 'return'
-
Note:i added this function in usefulserver.lua,i didnt add it in server/client side.
-
Here: New Lua: --[[ +---------------------------------------------------------------------------- | =================== 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",vehicle, 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)") createPrivateVehicle(model, x, y, z, rot, color, upgrades, dataType, allowedTo) end end ,10000, 1, #vehicles, source ) end ) return vehicle end Error msg: SCRIPT ERROR: sqlvehicles\vehicles_usefulserver.lua:138: '' expected near 'end' ERROR: Loading script failed: sqlvehicles\vehicles_usefulserver.lua:138: '' expected near 'end'
-
Thnx rly for helping meh!,but still got the problem
-
Still not working :\ SCRIPT ERROR: sqlvehicles\vehicles_usefulserver.lua:138: '' expected near 'end' ERROR: Loading script failed: sqlvehicles\vehicles_usefulserver.lua:138: '' expected near 'end'
-
I did and i got another error: SCRIPT ERROR: sqlvehicles\vehicles_usefulserver.lua:133: ')' expected (to close '(' at line 121) near 'end' ERROR: Loading script failed: sqlvehicles\vehicles_usefulserver.lua:133: ')' expected (to close '(' at line 121) near 'end'
-
Hi guys,i have downloaded Sqlvehicles script of Jasper,but i have got some bugs;Vehicles cant be respawned,there is no such function for it,so i have made a function but i got an error!: SCRIPT ERROR: sqlvehicles\vehicles_usefulserver.lua:138: '' expected near 'end' ERROR: Loading script failed: sqlvehicles\vehicles_usefulserver.lua:138: '' expected near 'end' i added the function in the last line: --[[ +---------------------------------------------------------------------------- | =================== 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",vehicle, function () setTimer ( function ( vehicleID, vehicle ) if ( vehicleID and type ( vehicleID ) == "number" ) then table.remove(vehicles, vehicleID) if isElement( vehicle ) then destroyElement ( vehicle ) end function table_lockedvehicles () 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)") end createPrivateVehicle(model, x, y, z, rot, color, upgrades, dataType, allowedTo) end end ,10000, 1, #vehicles, source ) end ) return vehicle end Plz Help
-
Sry mate,am newbie in scripting...
-
Here is the full lua: addEvent ( "onClientTCTToggle", true ) editorForm = { settings = { } } function createMainWindow ( ) editorForm.wnd = guiCreateWindow(42, 73, 717, 462, "Building Panel", false) guiWindowSetSizable ( editorForm.wnd, false ) Meme = guiCreateMemo(9, 39, 171, 303, "This panel is used for events/rps.", false, editorForm.wnd) guiMemoSetReadOnly(Meme, true) editorForm.leftPanel = guiCreateTabPanel ( 185, 17, 294, 435, false, editorForm.wnd ) createEntityTab ( "Object", "objects.xml" ) createEntityTab ( "Vehicle", "vehicles.xml" ) createEntityTab ( "Ped", "peds.xml" ) editorForm.createEdit = guiCreateEdit ( 10, 370, 166, 30, "ID", false, editorForm.wnd ) editorForm.createBtn = guiCreateButton ( 32, 410, 124, 28, "Create", false, editorForm.wnd ) editorForm.createBtn = guiCreateButton ( 28, 385, 115, 20, "Create", false, editorForm.wnd ) editorForm.rightPanel = guiCreateTabPanel ( 479, 17, 228, 435, false, editorForm.wnd ) editorForm.toolsTab = guiCreateTab ( "TooL Hack", editorForm.rightPanel ) editorForm.toolsList = guiCreateGridList ( 0.02, 0.02, 0.42, 0.96, true, editorForm.toolsTab ) guiGridListAddColumn ( editorForm.toolsList, "Editor Gate", 0.8 ) guiGridListSetSortingEnabled ( editorForm.toolsList, false ) guiGridListSetSelectionMode ( editorForm.toolsList, 0 ) editorForm.optionsTab = guiCreateTab ( "Settings", editorForm.rightPanel ) editorForm.optionsScrollPane = guiCreateScrollPane ( 0.04, 0.02, 0.92, 0.96, true, editorForm.optionsTab ) createSetting ( "s_step", { "edit", text = "Step", value = 0.1 } ) createSetting ( "s_saveOffs", { "checkbox", text = "Save offsets", selected = true } ) createSetting ( "s_thelp", { "checkbox", text = "Tool helper", selected = true } ) createSetting ( "s_resetOffs", { "button", text = "Reset offsets", onClick = function ( ) g_entityOffset.reset ( ) end } ) addEventHandler ( "onClientGUIClick", editorForm.wnd, click ) guiSetVisible ( editorForm.wnd, false ) end function click ( ) if getElementType ( source ) == "gui-gridlist" then local selectedRow = guiGridListGetSelectedItem ( source ) if selectedRow < 0 then setSelectedTool ( getToolFromName ( "Default" ) ) for element, _ in pairs ( bindedGridLists ) do guiGridListSetSelectedItem ( element, -1, 0 ) end guiGridListSetSelectedItem ( editorForm.toolsList, -1, 0 ) return end end if source == editorForm.createBtn then local model = tonumber ( guiGetText ( editorForm.createEdit ) ) if model then setSelectedTool ( getToolFromName ( "Default" ) ) for gridlist, _ in pairs ( bindedGridLists ) do guiGridListSetSelectedItem ( gridlist, -1, 0 ) end guiGridListSetSelectedItem ( editorForm.toolsList, -1, 0 ) local element = createEntity ( model, g_entityOffset.calcPosition ( ) ) if element then setEditorTarget ( element ) else outputChatBox ( "WBO: Incorrect object model" ) end else outputChatBox ( "WBO: Incorrect object model" ) end elseif source == editorForm.toolsList then for gridlist, _ in pairs ( bindedGridLists ) do guiGridListSetSelectedItem ( gridlist, -1, 0 ) end local selectedItem = guiGridListGetSelectedItem ( source ) if selectedItem > -1 then local toolName = guiGridListGetItemText ( source, selectedItem, 1 ) setSelectedTool ( getToolFromName ( toolName ) ) end end end addEventHandler ( "onClientTCTToggle", resourceRoot, function ( ) local visible = not guiGetVisible ( editorForm.wnd ) guiSetInputEnabled ( visible ) guiSetVisible ( editorForm.wnd, visible ) showCursor ( visible ) end , false ) function editorCreateEntity ( gridlist, model ) setSelectedTool ( getToolFromName ( "Default" ) ) for element, _ in pairs ( bindedGridLists ) do if element ~= gridlist then guiGridListSetSelectedItem ( element, -1, 0 ) end end guiGridListSetSelectedItem ( editorForm.toolsList, -1, 0 ) local element = createEntity ( tonumber ( model ), g_entityOffset.calcPosition ( ) ) if element then setEditorTarget ( element ) end end function createEntityTab ( name, xmlfile ) local entityTab = { tab = guiCreateTab ( name, editorForm.leftPanel ) } entityTab.gridlist = guiCreateGridList ( 0.02, 0.02, 0.96, 0.96, true, entityTab.tab ) guiGridListSetSortingEnabled ( entityTab.gridlist, false ) guiGridListSetSelectionMode ( entityTab.gridlist, 0 ) guiGridListAddColumn ( entityTab.gridlist, "Object Creator", 0.8 ) guiGridListLoadTable ( entityTab.gridlist, loadList ( "conf\\" .. xmlfile ), editorCreateEntity ) return entityTab end function createSetting ( id, tbl ) editorForm.settings [ id ] = createControl ( tbl, editorForm.optionsScrollPane ) return editorForm.settings [ id ] end function getSettingByID ( id ) return editorForm.settings [ id ] end should i add this line?: btnClose = guiCreateButton(28, 385, 115, 20, "Close", true ) function changeVisibility ( ) -- we check if the gui element is visible guiSetVisible (MainWindow, not guiGetVisible ( MainWindow ) ) end or: addEventHandler ( "onClientGUIClick", editorForm.wnd, click ) guiSetVisible ( editorForm.wnd, false )
-
Hi guys,i had a big problem with creating an exit button for my panel! should i use this function?: this is the original button to create: editorForm.createBtn = guiCreateButton ( 32, 410, 124, 28, "Create", false, editorForm.wnd ) But i want to create Close button,like this: editorForm.createBtn = guiCreateButton ( 32, 410, 124, 28, "Close", false, "problem is here!wht funsciton i use to close the Gui? ) plz help me
-
Hi guys,i have got this code over here,which sets a text down the screen,but it didnt work. Error msg: ERROR: version\text.lua:3: attempt to call global 'guiSetText' (a nil value) lua code: GUIEditor_Label = {} strona = guiSetText (260,571,349,19,"Forums coming soon.",false) guiSetAlpha(strona,1) guiLabelSetColor(strona,255, 0, 0) guiLabelSetVerticalAlign(strona,"top") guiLabelSetHorizontalAlign(strona,"left",false) GUIEditor_Label[1] = guiSetText (715,568,78,17,"DZ RPG V1.0",false) guiLabelSetColor(GUIEditor_Label[1],255,255,255) guiLabelSetVerticalAlign(GUIEditor_Label[1],"top") guiLabelSetHorizontalAlign(GUIEditor_Label[1],"left",false)
-
hi guys,this script over here to show vh health but it doesnt work! check this error msg: MVehicleSettings\vehhealth.lua:2: Bad argument @ 'isPedInVehicle' [Expected ped at argument 1, got nil] Lua code: function vehHealth(check) if (isPedInVehicle(localPlayer)) then vHealth = getElementHealth(getPedOccupiedVehicle(localPlayer)) vHealth = math.floor(vHealth/10) if not (check == "noez" and vHealth >= 95) then exports.Mcommands:sendClientMessage("*INFO* The vehicle health is currently: %" .. vHealth .. ".",255,255,0) end end end function enterVehHealth(thePlayer, seat) if (seat == 0 and thePlayer == localPlayer) then vehHealth("noez") end end addCommandHandler("vh", vehHealth) addEventHandler ( "onClientVehicleEnter", getRootElement(), enterVehHealth)
-
hey guys i have this gate code over here,i wanted it to open for my acc name. error msg: [2015-01-22 19:03:47] WARNING: desert\gate2.lua:12: Bad argument @ 'getAccountName' [Expected account at argument 1, got boolean] [2015-01-22 19:03:49] WARNING: desert\gate2.lua:5: Bad argument @ 'getPlayerAccount' [Expected element at argument 1, got nil] Lua code: gate1 = createObject (980, -13.60, 2067.30,19, 0,0,90 ) gatecol = createColCircle (-13.60, 2067.30, -- s8) --> function OpenGates (thePlayer) if getAccountName(getPlayerAccount(player)) == "shooter" then moveObject (gate1,2000,-13.60,2067.30, 24.799 ) end end addEventHandler( "onColShapeHit", gatecol, OpenGates ) function CloseGates (thePlayer) if getAccountName(getPlayerAccount(player)) == "shooter" then moveObject (gate1,2000,-13.60, 2067.30,19 ) end end addEventHandler( "onColShapeLeave", gatecol, CloseGates )
-
Dude, the server owner gave his server script for Public,i didnt steal,i have all the server but only this 2 scripts dont work for me,and here is the link:https://forum.multitheftauto.com/viewtopic.php?f=108&p=754846
-
Guys i have got scripts of Nurd Gaming,but i had this problems with 2 scripts: NGPhone: Lua Code:Vehicles client side function appFunctions.vehicles:onPanelLoad ( ) guiGridListClear ( pages['vehicles'].grid ) givingVehicle = nil appFunctions.vehicles:ReloadList ( ) guiSetEnabled ( pages['vehicles'].show, false ) guiSetEnabled ( pages['vehicles'].recover, false ) guiSetEnabled ( pages['vehicles'].sell, false ) guiSetEnabled ( pages['vehicles'].warptome, false ) end addEvent ( "NGPhone:App->Vehicles:onClientGetVehicles", true ) addEventHandler ( "NGPhone:App->Vehicles:onClientGetVehicles", root, function ( cList ) vehicleData = { } guiGridListClear ( pages['vehicles'].grid ) if ( #cList == 0 ) then guiGridListSetItemText ( pages['vehicles'].grid, guiGridListAddRow ( pages['vehicles'].grid ), 2, "You have no vehicles.", true, true ) else local impoundedVehicles = 0 for i, v in ipairs ( cList ) do if ( v[11] == 0 ) then local row = guiGridListAddRow ( pages['vehicles'].grid ) guiGridListSetItemText ( pages['vehicles'].grid, row, 1, tostring ( getVehicleNameFromModel ( v[3] ) ), false, false ) guiGridListSetItemData ( pages['vehicles'].grid, row, 1, v[2] ) table.insert ( vehicleData, v[2], v ) else impoundedVehicles = impoundedVehicles + 1 end end if ( impoundedVehicles ~= 0 ) then exports['NGMessages']:sendClientMessage ( "You have "..impoundedVehicles.." vehicles impounded.", 255, 255, 0 ) end end end ) function appFunctions.vehicles:CloseMenu ( ) guiSetText ( pages['vehicles'].show, "Show" ) guiGridListClear ( pages['vehicles'].grid ) showCursor ( false ) vehicleData = nil end function appFunctions.vehicles:ReloadList ( ) guiGridListClear ( pages['vehicles'].grid ) guiGridListSetItemText ( pages['vehicles'].grid, guiGridListAddRow ( pages['vehicles'].grid ), 2, "Loading...", true, true ) triggerServerEvent ( "NGPhone:App->Vehicles:onPanelOpened", localPlayer ) end function appFunctions.vehicles:GetVehicleVisible ( id ) local i = vehicleData[id][9] if ( i == 1 ) then return true else return false end end and:Vehicles server side: addEvent ( "NGPhone:App->Vehicles:onPanelOpened", true ) addEventHandler ( "NGPhone:App->Vehicles:onPanelOpened", root, function ( ) local cars = exports.NGVehicles:getAccountVehicles ( getAccountName ( getPlayerAccount ( source ) ) ) triggerClientEvent ( source, "NGPhone:App->Vehicles:onClientGetVehicles", source, cars ) end ) addEvent ( "NGPhone:Apps->Vehicles:SetVehicleVisible", true ) addEventHandler ( "NGPhone:Apps->Vehicles:SetVehicleVisible", root, function ( id, stat ) local v = exports.NGVehicles:SetVehicleVisible ( id, stat, source ) end ) addEvent ( "NGPhone:Apps->Vehicles:AttemptRecoveryOnID", true ) addEventHandler ( "NGPhone:Apps->Vehicles:AttemptRecoveryOnID", root, function ( id ) exports.NGVehicles:recoverVehicle ( source, id ) end ) addEvent ( "NGPhone:App->Vehicles:sellPlayerVehicle", true ) addEventHandler ( "NGPhone:App->Vehicles:sellPlayerVehicle", root, function ( plr, data ) exports.NGVehicles:sellVehicle ( plr, data ) end ) addEvent ( "NGPhone:Apps->Vehicles:WarpThisVehicleToMe", true ) addEventHandler ( "NGPhone:Apps->Vehicles:WarpThisVehicleToMe", root, function ( id ) if ( not exports.NGVehicles:warpVehicleToPlayer ( id, source ) ) then exports.NGMessages:sendClientMessage ( "Error: Unable to warp vehicle", source, 255, 0, 0 ) end end ) and NGVehicles_s Lua: addEventHandler ( "onResourceStart", resourceRoot, function ( ) exports['NGSQL']:db_exec ( "CREATE TABLE IF NOT EXISTS vehicles ( Owner TEXT, VehicleID INT, ID INT, Color TEXT, Upgrades TEXT, Position TEXT, Rotation TEXT, Health TEXT, Visible INT, Fuel INT, Impounded INT, Handling TEXT )" ) end ) vehicles = { } local blip = { } local texts = { } function getAllAccountVehicles ( account ) local cars = { } local q = exports['NGSQL']:db_query ( "SELECT * FROM vehicles WHERE Owner=? ", tostring(account) ) for i, v in pairs ( q ) do table.insert ( cars, v ) end return cars end function showVehicle ( id, stat, player, msg ) if stat then if ( not isElement ( vehicles[id] ) ) then local q = exports['NGSQL']:db_query ( "SELECT * FROM vehicles WHERE VehicleID=? LIMIT 1", tostring(id) ) if ( q and type ( q ) == 'table' and #q > 0 ) then local d = q[1] local health = tonumber ( d['Health'] ) local owner, vehID = tostring ( d['Owner'] ), tonumber ( d['ID'] ) local color, upgrades = d['Color'], d['Upgrades'] local pos, rot = d['Position'], d['Rotation'] local pos = fromJSON ( pos ) local pos = split ( pos, ', ' ) local x, y, z = tonumber ( pos[1] ), tonumber ( pos[2] ), tonumber ( pos[3] ) local rot = fromJSON ( rot ) local rot = split ( rot, ', ' ) local rx, ry, rz = tonumber ( rot[1] ), tonumber ( rot[2] ), tonumber ( rot[3] ) local color = fromJSON ( color ) local color = split ( color, ', ' ) local r, g, b = tonumber ( color[1] ), tonumber ( color[2] ), tonumber ( color[3] ) local upgrades = fromJSON ( upgrades ) local hndl = fromJSON ( d['Handling'] ) vehicles[id] = createVehicle ( vehID, x, y, z, rx, ry, rz ) setElementData ( vehicles[id], "fuel", tonumber ( d['Fuel'] ) ) setVehicleColor ( vehicles[id], r, g, b ) setElementData ( vehicles[id], "NGVehicles:VehicleAccountOwner", tostring ( owner ) ) setElementData ( vehicles[id], "NGVehicles:VehicleID", id ) setElementHealth ( vehicles[id], tonumber ( health ) ) if ( hndl and type ( hndl ) == "table" ) then for i, v in pairs ( hndl ) do setVehicleHandling ( vehicles [ id ], tostring ( i ), v ) end end for i, v in ipairs ( upgrades ) do addVehicleUpgrade ( vehicles[id], tonumber ( v ) ) end exports['NGSQL']:db_exec ( "UPDATE vehicles SET Visible=? WHERE VehicleID=?", '1', id ) if ( isElement ( blip[id] ) ) then destroyElement ( blip[id] ) end if ( isElement ( texts[id] ) ) then destroyElement ( texts[id] ) end texts[id] = exports['NGJobs']:create3DText ( owner.."'s vehicle", { 0, 0, 0.5 }, { 255, 255, 255 }, vehicles[id], { 5, true } ) if ( isElement ( player ) ) then blip[id] = createBlipAttachedTo ( vehicles[id], 51, 2, 255, 255, 255, 255, 0, 1500, player ) setElementData ( vehicles[id], "NGVehicles:VehiclePlayerOwner", player ) end addEventHandler ( "onVehicleDamage", vehicles[id], function ( ) local health = math.floor ( getElementHealth ( source ) ) if ( health <= 300 ) then local id = getElementData ( source, "NGVehicles:VehicleID" ) local driver = getVehicleOccupant ( source ) if ( driver ) then exports['NGMessages']:sendClientMessage ( "This vehicle is broken and requires a mechanic to fix it.", driver, 255, 0, 0 ) end showVehicle ( id, false ) end end ) addEventHandler ( "onVehicleStartEnter", vehicles[id], function ( p, s ) if ( getVehicleOccupant ( source ) )then local t = getPlayerTeam ( p ) if ( t ) then if ( exports['NGPlayerFunctions']:isTeamLaw ( getTeamName ( t ) ) and getPlayerWantedLevel ( getVehicleOccupant ( source ) ) > 0 and s == 0 ) then setVehicleLocked ( source, false ) return end end end if ( isVehicleLocked ( source ) ) then exports['NGMessages']:sendClientMessage ( "This vehicle is locked.", p, 255, 255, 0 ) cancelEvent ( ) end end ) addEventHandler ( "onVehicleEnter", vehicles[id], function ( p, seat ) local health = getElementHealth ( source ) local id = getElementData ( source, "NGVehicles:VehicleID" ) if ( health <= 300 ) then showVehicle ( id, false ) exports.ngmessages:sendClientMessage ( "This vehicle was hidden due to low health", p, 255, 0, 0 ) return end local acc = getPlayerAccount ( p ) if ( isGuestAccount ( acc ) ) then return end local acc = getAccountName ( acc ) local name = getVehicleNameFromModel ( getElementModel ( source ) ) local owner = getElementData ( source, 'NGVehicles:VehicleAccountOwner' ) if ( acc == owner ) then exports['NGMessages']:sendClientMessage ( "This is your "..name.."!", p, 0, 255, 0 ) else exports['NGMessages']:sendClientMessage ( "This "..name.." belongs to "..owner..".", p, 255, 255, 0 ) end end ) if ( msg ) then exports['NGMessages']:sendClientMessage ( "Your "..getVehicleNameFromModel(vehID).." is located in "..getZoneName(x,y,z)..", "..getZoneName(x,y,z,true).."!",player,0,255,0) end if ( isElement ( player ) and vehID ) then exports['NGLogs']:outputActionLog ( getPlayerName ( player ).." spawned their "..getVehicleNameFromModel ( vehID ) ) end return vehicles[id] end end return vehicles[id] else if ( isElement ( vehicles[id] ) ) then local pos = toJSON ( createToString ( getElementPosition ( vehicles[id] ) ) ) local rot = toJSON ( createToString ( getElementRotation ( vehicles[id] ) ) ) local color = toJSON ( createToString ( getVehicleColor ( vehicles[id], true ) ) ) local upgrades = toJSON ( getVehicleUpgrades ( vehicles[id] ) ) local health, fuel = tostring ( getElementHealth ( vehicles[id] ) ), tonumber ( getElementData ( vehicles[id], "fuel" ) ) local model = getElementModel ( vehicles[id] ) local hdnl = toJSON ( getVehicleHandling ( vehicles [ id ] ) ) exports['NGSQL']:db_exec ( "UPDATE vehicles SET Color=?, Upgrades=?, Position=?, Rotation=?, Health=?, Fuel=?, Handling=? WHERE VehicleID=?", color, upgrades, pos, rot, health, fuel, hdnl, id ) destroyElement ( vehicles[id] ) vehicles[id] = nil exports['NGSQL']:db_exec ( "UPDATE vehicles SET Visible=? WHERE VehicleID=?", '0', id ) if ( isElement ( blip[id] ) ) then destroyElement ( blip[id] ) end if ( isElement ( texts[id] ) ) then destroyElement ( texts[id] ) end if ( isElement ( player ) ) then exports['NGLogs']:outputActionLog ( getPlayerName ( player ).." hid their "..getVehicleNameFromModel ( model ) ) end end end return false end function warpVehicleToPlayer ( id, player ) if ( not isElement ( vehicles [ id ] ) ) then return false end if ( getElementInterior ( player ) ~= 0 or getElementDimension ( player ) ~= 0 ) then return false end if ( getVehicleController ( vehicles [ id ] ) ) then return false end local x, y, z = getElementPosition ( player ) local rot = getPedRotation ( player ) local rx, ry, rz = getElementRotation ( vehicles [ id ] ) setElementPosition ( vehicles [ id ], x, y, z + 1 ) setElementRotation ( vehicles [ id ], rx, ry, rot ) warpPedIntoVehicle ( player, vehicles [ id ] ) return true end function givePlayerVehicle ( player, vehID, r, g, b ) if ( isGuestAccount ( getPlayerAccount ( player ) ) ) then return false end local r, g, b = r or 0, g or 0, b or 0 local ids = exports['NGSQL']:db_query ( "SELECT VehicleID FROM vehicles" ) local id = 1 local idS = { } for i, v in ipairs ( ids ) do idS[tonumber(v['VehicleID'])] = true end while ( idS[id] ) do id = id + 1 end local pos = toJSON ( createToString ( getElementPosition ( player ) ) ) local rot = toJSON ( createToString ( 0, 0, getPedRotation ( player ) ) ) local color = toJSON ( createToString ( r, g, b ) ) local upgrades = toJSON ( { } ) local health = 1000 exports['NGLogs']:outputActionLog ( getPlayerName ( player ).." bought a "..getVehicleNameFromModel ( vehID ) ) exports['NGSQL']:db_exec ( "INSERT INTO `vehicles` (`Owner`, `VehicleID`, `ID`, `Color`, `Upgrades`, `Position`, `Rotation`, `Health`, `Visible`, `Fuel`, `Impounded`, `Handling`) VALUES ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?);", getAccountName(getPlayerAccount(player)), tostring(id), tostring(vehID), color, upgrades, pos, rot, health, '100', '0', '0', toJSON ( getModelHandling ( vehID ) ) ) return id end function getAccountVehicles ( account ) local query = getAllAccountVehicles ( account ) if ( type ( query ) == 'table' and #query >= 1 ) then local rV = { } for i, v in pairs ( query ) do table.insert ( rV, { v['Owner'], v['VehicleID'], v['ID'], v['Color'], v['Upgrades'], v['Position'], v['Rotation'], v['Health'], v['Visible'], v['Fuel'], v['Impounded'], v['Handling'] } ) end return rV else return { } end end function sellVehicle ( player, id ) --showVehicle ( id, false ) local data = exports['NGSQL']:db_query ( "SELECT * FROM vehicles WHERE VehicleID=?", tostring(id) ) local model = tonumber ( data[1]['ID'] ) local price = nil for i, v in pairs ( vehicleList ) do for k, x in ipairs ( v ) do if ( x[1] == model ) then price = math.floor ( x[2] / 1.4 ) + math.random ( 500, 2200 ) if price > x[2] then while ( price >= x[2] ) do price = math.floor ( x[2] / 1.4 ) + math.random ( 100, 1000 ) end end break end end end exports['NGMessages']:sendClientMessage ( "You've sold your "..getVehicleNameFromModel ( model ).." for $"..convertNumber ( price ).."!", player, 0, 255, 0 ) givePlayerMoney ( player, price ) exports['NGSQL']:db_exec ( "DELETE FROM vehicles WHERE VehicleID=?", tostring(id) ) exports['NGLogs']:outputActionLog ( getPlayerName ( player ).." sold their "..getVehicleNameFromModel ( model ).." (ID: "..tostring ( id )..")" ) end addEvent ( "NGVehicles:sellPlayerVehicle", true ) addEventHandler ( "NGVehicles:sellPlayerVehicle", root, sellVehicle ) addCommandHandler ( "hideall", function ( p ) local acc = getPlayerAccount ( p ) if ( isGuestAccount ( acc ) ) then return end local name = getAccountName ( acc ) exports['NGMessages']:sendClientMessage ( "All of your vehicles have been hidden.", p, 0, 255, 0 ) for i, v in pairs ( vehicles ) do if ( getElementData ( v, "NGVehicles:VehicleAccountOwner" ) == name ) then showVehicle ( i, false ) end end end ) function createToString ( x, y, z ) return table.concat ( { x, y, z }, ", " ) end addEventHandler ( "onResourceStop", resourceRoot, function ( ) for i, v in pairs ( vehicles ) do showVehicle ( i, false ) end end )
-
Guys i have a Ped.ifp file but i didnt know how to import it for mta server,so all players can have the same animations,can someone gives me the code please?
-
didnt work,anyway thnx so much for ur help!
-
sure: function createPrivateVehicle(model, x, y, z, rot, color, upgrades, dataType, allowedTo) local vehicle = createVehicle(tonumber(model),x,y,z,0,0,rot) if (vehicle) then setElementData(vehicle, "dataType", dataType) setElementData(vehicle, "allowedTo", allowedTo) if (color and color ~= nil) then setVehicleColor(vehicle, unpack(fromJSON(color))) end if (upgrades and upgrades ~= nil) then for index, upgrade in ipairs(fromJSON(upgrades)) do addVehicleUpgrade(vehicle, upgrade) end end table.insert(vehicles, vehicle) addEventHandler("onVehicleExplode",vehicle, function () setTimer ( function ( vehicleID, vehicle ) if ( vehicleID and type ( vehicleID ) == "number" ) then table.remove(vehicles, vehicleID) if isElement( vehicle ) then destroyElement ( vehicle ) end local veh = executeSQLQuery("SELECT * FROM private_vehicles WHERE vehicleID = '".. tonumber(vehicleID) .."'")[1] local x,y,z = getElementPosition(veh) local c1,c2,c3,c4 = getVehicleColor(veh) local upgrades = getVehicleUpgrades(veh) local mode = getElementModel(veh) createPrivateVehicle(model, x, y, z, rot, color, upgrades, dataType, allowedTo) end end ,10000, 1, #vehicles, source ) end ) return vehicle end end