erisP
Members-
Posts
46 -
Joined
-
Last visited
Everything posted by erisP
-
error passed but script doesn't work I think it's broken
-
local locations = { --{x,y,z,rot} {1213.509765625, -1308.96875, 13.556906700134, 87.241027832031},--LS AS Hospital {1517.7939453125, -1656.39453125, 13.539175033569, 263.27215576172},--LSPD {1584.853515625, 1799.9892578125, 10.828001022339, 3.9798583984375},--LV hospital {1994.919921875, -1443.6484375, 13.566557884216, 173.54541015625},--LS Jefferson Hospital {1345.6220703125, -1045.0859375, 26.6484375, 305.97665405273},--LS LS entrance intersection {1969.9306640625, -2187.93359375, 13.546875, 85.235992431641},--LS Airport {2305.111328125, 2457.5751953125, 10.8203125, 181.2579498291},--LVPD {525.5302734375, -1281.072265625, 17.2421875, 290.99108886719},--Next to BR and Car Shop {1696.177734375, -1102.73046875, 24.078125, 2.9526062011719},--Mullohand Intersection {190.1767578125, -204.0068359375, 1.578125, 140.37719726562},-- BlueBerry {1269.3359375, 321.2626953125, 19.7578125, 331.28405761719},--Montgomery Hospital {-2168.1435546875, -2408.8828125, 30.625, 324.80749511719},--Angel Pine {-2595.1025390625, 613.5771484375, 14.453125, 182.54336547852},--SF Hospital {-1591.6630859375, 718.849609375, 9.458251953125, 13.653472900391},-- SFPD {1736.796875, 1546.666015625, 10.8203125, 105.27536010742},--LV Airport {-285.9541015625, 1055.1142578125, 19.7421875, 81.198455810547},--Fort Carson {405.708984375, 2540.2880859375, 16.546192169189, 173.96838378906},--Desert Airport {-1637.08984375, -531.9189453125, 11.5078125, 40.075988769531}, --SF Airport {-2325.916015625, 2379.19140625, 5.9296875, 18.289764404297},-- BaySide Marina } local markers = {} local PriceMultiplier = 1.5 local transportGUI = {} local hour, min, weather local sm = {} sm.moov = 0 sm.object1,sm.object2 = nil,nil local function removeCamHandler() if(sm.moov == 1)then sm.moov = 0 end end local function camRender() if (sm.moov == 1) then local x1,y1,z1 = getElementPosition(sm.object1) local x2,y2,z2 = getElementPosition(sm.object2) setCameraMatrix(x1,y1,z1,x2,y2,z2) end end addEventHandler("onClientPreRender",root,camRender) function smoothMoveCamera(x1,y1,z1,x1t,y1t,z1t,x2,y2,z2,x2t,y2t,z2t,time) if(sm.moov == 1)then return false end sm.object1 = createObject(1337,x1,y1,z1) sm.object2 = createObject(1337,x1t,y1t,z1t) setElementCollisionsEnabled ( sm.object1, false ) setElementCollisionsEnabled ( sm.object2, false ) setElementAlpha(sm.object1,0) setElementAlpha(sm.object2,0) setObjectScale(sm.object1,0.01) setObjectScale(sm.object2,0.01) moveObject(sm.object1,time,x2,y2,z2,0,0,0,"InOutQuad") moveObject(sm.object2,time,x2t,y2t,z2t,0,0,0,"InOutQuad") sm.moov = 1 setTimer(removeCamHandler,time,1) setTimer(destroyElement,time,1,sm.object1) setTimer(destroyElement,time,1,sm.object2) return true end function createTransportGUI() transportGUI.window = guiCreateWindow(383, 229, 520, 440, "Transfer", false) transportGUI.locationgrid = guiCreateGridList(18,58,298,400, false, transportGUI.window) guiGridListAddColumn(transportGUI.locationgrid, "Location", 0.8) guiGridListAddColumn(transportGUI.locationgrid, "Price", 0.2) transportGUI.playerwarp = guiCreateButton(305,392,145,25,"Travel", false, transportGUI.window) transportGUI.closegui = guiCreateButton(408,398,145,25,"Close", false, transportGUI.window) addEventHandler("onClientGUIClick", transportGUI.closegui, toggletransportGUI, false) addEventHandler("onClientGUIClick", transportGUI.playerwarp, warpPlayer, false) end function transportfillLocationGrid() guiGridListClear(transportGUI.locationgrid) local px,py,pz = getElementPosition(source) for k, marker in pairs(markers) do local row = guiGridListAddRow(transportGUI.locationgrid) local x,y,z = getElementPosition(marker[1]) local rotation = marker[2] local City = getZoneName ( x,y,z, true ) local Zone = getZoneName ( x,y,z) local price = math.floor(getDistanceBetweenPoints3D ( px,py,pz,x,y,z ) * PriceMultiplier) local Data = {x,y,z + 1,rotation,price} guiGridListSetItemData(transportGUI.locationgrid, row, 1, Data) guiGridListSetItemText(transportGUI.locationgrid, row, 1, City.." - "..Zone,false,false) guiGridListSetItemText(transportGUI.locationgrid, row, 2, "$"..tostring(price),false,false) end end function transportRefresh() transportfillLocationGrid() end function toggletransportGUI() --if(not exports.util:isPlayerLoggedIn()) then return end if(isElement(transportGUI.window )) then if(guiGetVisible(transportGUI.window )) then guiSetVisible(transportGUI.window , false) showCursor(false) -- exports.blur:setBlurDisabled() else showCursor(true) guiSetVisible(transportGUI.window , true) -- exports.blur:setBlurEnabled() transportfillLocationGrid() end else createTransportGUI() showCursor(true) -- exports.blur:setBlurEnabled() transportfillLocationGrid() end end function onTransportMarkerHit(hitElement) if(hitElement == localPlayer) then local _,_,z = getElementPosition(localPlayer) local _,_,mz = getElementPosition(source) if(math.abs(z-mz) <= 2) then -- height check if(exports.EZLpoliceWanted:getPlayerWantedLevel(localPlayer) == 0 )then if(not isPedInVehicle(localPlayer)) then toggletransportGUI() transportfillLocationGrid() else outputChatBox("Please exit your vehicle before entering this marker.",255,0,0) end else outputChatBox("You are wanted, You cannot use this marker",255,0,0) end end end end function onTransportMarkerLeave(hitElement) if(hitElement == localPlayer) then if(transportGUI.window)then if(guiGetVisible(transportGUI.window ))then toggletransportGUI() end end end end for k,loc in ipairs(locations)do local element = createMarker ( loc[1], loc[2],loc[3] - 1,"cylinder", 1,255,204,0) if (isElement(element)) then addEventHandler ( "onClientMarkerHit", element, onTransportMarkerHit ) addEventHandler ( "onClientMarkerLeave", element, onTransportMarkerLeave ) element = {element , loc[4]} table.insert(markers,element) end end function cameraTranslate(destinationX, destinationY, destinationZ, destinationZRot) setElementFrozen(localPlayer, true) local maxZ = 290 local px,py,pz = getElementPosition(localPlayer) local x,y,z,lx,ly,lz = getCameraMatrix() smoothMoveCamera(x, y, z, lx, ly, lz, px, py, pz + 15, px, py, pz, 2000) setTimer( function() x,y,z,lx,ly,lz = getCameraMatrix() smoothMoveCamera(x, y, z, lx, ly, lz, px, py, pz + 15 + 40, px, py, pz, 2000) setTimer( function() x, y, z, lx, ly, lz = getCameraMatrix() smoothMoveCamera(x, y, z, lx, ly, lz, px, py, maxZ, px, py, pz, 2000) setTimer(function() weather = getWeather() local h, m = getTime() min = m hour = h setWeather(12) setTime(12,0) end, 2000, 1) setTimer( function() x,y,z,lx,ly,lz = getCameraMatrix() smoothMoveCamera ( x,y,z,lx,ly,lz, destinationX,destinationY,maxZ, destinationX,destinationY,0, 2000 ) setTimer( function() x,y,z,lx,ly,lz = getCameraMatrix() smoothMoveCamera ( x,y,z,lx,ly,lz, destinationX,destinationY,destinationZ + 15 + 20, destinationX,destinationY,0, 2000 ) setTimer( function() x,y,z,lx,ly,lz = getCameraMatrix() smoothMoveCamera ( x,y,z,lx,ly,lz, destinationX,destinationY,destinationZ + 15, destinationX,destinationY,0, 2000 ) setTimer( function() fadeCamera(false) setTimer(function() setWeather(weather) setTime(hour, min) end, 800, 1) setTimer( function() fadeCamera(true) setElementPosition(localPlayer, destinationX, destinationY, destinationZ, false) setElementRotation(localPlayer, 0, 0, destinationZRot) setCameraTarget(localPlayer) setElementFrozen(localPlayer, false) end, 1000, 1 ) end, 2000, 1 ) end, 2000, 1 ) end, 5000, 1 ) end, 5000, 1 ) end, 2000, 1 ) end, 2000, 1 ) end function warpPlayer() local selected = guiGridListGetSelectedItem(transportGUI.locationgrid) if (selected) then local DestinationData = guiGridListGetItemData(transportGUI.locationgrid, selected, 1) -- x,y,z,rotation,price if (getPlayerMoney() >= DestinationData[5]) then --ERROR triggerServerEvent ( "transport.onPlayerWarp", localPlayer,DestinationData[5]) toggletransportGUI() cameraTranslate(DestinationData[1],DestinationData[2],DestinationData[3],DestinationData[4]) else outputChatBox("You do not have enough money!",255,0,0) end end end trans\client.lua:234: attempt to index local 'DestinationData' (a nil value) how do i solve this error
-
It worked, but all pads have immortal functionality.
-
I know but I shouldn't use client.lua.
-
How to create immortal createPed function on server side.
-
Is there any code to prevent the player from dying under the vehicle?
-
-- Tables for the fuel markers local pumpsMarkers = {} local pumps = { -- SF GAS STATION NEAR SFPDZ { {-1672.05, 405.35, 6.85, true }, {-1666.75, 410.37, 6.85 }, {-1679.24, 412.21, 6.85 }, {-1673.81, 417.5, 6.85 }, }, -- SF Juniper Hallow place.Near Jizzys club>Pay N spray Gas station { {-2407.49, 971.53, 44.97, true }, {-2407.56, 982.32, 44.97 }, {-2414.68, 980.48, 44.97 }, {-2414.68, 970.04, 44.97 }, }, -- Angel Pine GAS STATION { {-2249.57, -2558.71, 31.58, true }, {-2239.06, -2563.1, 31.6 }, {-2244.82, -2561.4, 31.6 }, }, -- FLINT COUNTRY TRUCKER JOB GAS STATION { {-95, -1161.41, 1.91, true }, {-99.95, -1173.21, 2.12 }, {-88.1, -1164.68, 1.96 }, {-92.88, -1176.37, 1.88 }, }, -- MONTGOMERY { {1378.92, 458.36, 19.61, true }, {1383.41, 456.51, 19.61 }, {1385.15, 461.04, 19.8 }, {1380.73, 463.16, 19.8 }, }, -- LS DILIMORE PD GAS STATION { {652.66, -560.14, 16.01, true }, {652.74, -570.98, 16.01 }, {658.22, -569.71, 16.01 }, {658.27, -558.89, 16.01 }, }, -- LV NEAR BASEBALL STADIUM GAS STATION { {1590.09, 2190.96, 10.82, true }, {1601.8, 2190.69, 10.82 }, {1590.38, 2196.61, 10.82 }, {1601.84, 2196.18, 10.82 }, {1602.17, 2202.28, 10.82 }, {1590.28, 2201.79, 10.82 }, {1596, 2206.69, 10.82 }, }, -- NORTH OF LV NEAR BURGER SHOT GAS STATION { {2141.41, 2756.27, 10.82, true }, {2153.37, 2756.49, 10.82 }, {2153.23, 2750.65, 10.82 }, {2141.55, 2750.51, 10.82 }, {2147.46, 2740.06, 10.82 }, }, -- NORTH OF LV NEAR LVPD GAS STATION { {2194.45, 2470.04, 10.82, true }, {2194.61, 2480.42, 10.82 }, {2205.36, 2480.33, 10.82 }, {2205.01, 2469.95, 10.82 }, }, -- LV NEAR MF BASE GUNSHOP STOP/CARSHOP GAS STATIONS { {622.3, 1679.94, 6.99, true }, {618.93, 1684.98, 6.99 }, {615.32, 1689.81, 6.99 }, {612.02, 1694.95, 6.99 }, {608.64, 1699.88, 6.99 }, {605.27, 1704.75, 6.99 }, }, -- SOUTH OF LV,GUNSHOP GAS STATION { {2120.77, 928.59, 10.82, true }, {2108.88, 928.72, 10.82 }, {2120.69, 917.61, 10.82 }, {2109.05, 917.79, 10.82 }, }, -- SOUTH EAST OF LV GAS STATION COME A LOT NEAR THE PYRAMID { {2634.68, 1097.78, 10.82, true }, {2645.61, 1097.5, 10.82 }, {2645.34, 1109.25, 10.82 }, {2634.64, 1109.06, 10.82 }, }, -- MF BASE { {283.12, 2000.55, 17.64 }, {282.15, 2033.92, 17.64 }, }, -- FORT CARSON NEAR CLUCKIN BELL { {64.56, 1219.51, 18.82, true }, {70.53, 1218.7, 18.81 }, {76.42, 1217.21, 18.82 }, }, -- EL QUEBRADOS GAS STATION { {-1328.92, 2672.1, 50.06, true }, {-1327.91, 2677.47, 50.06 }, {-1327.51, 2682.94, 50.06 }, }, -- LV DESERT-Tiera Robbada near Cluckin bell { {-1477.61, 1857.44, 32.63, true }, {-1464.91, 1857.88, 32.63 }, {-1465.24, 1865.8, 32.63 }, {-1477.75, 1865.01, 32.63 }, }, -- LS GAS STATION NEAR EX.DOD BASE { {999.97, -940, 42.17, true }, {1007.03, -939.19, 42.17 }, {1007.75, -933.45, 42.17 }, {1000.55, -934.48, 42.17 }, }, -- LS GAS STATION "Little Mexico" { {1944.29, -1776.53, 13.39, true }, {1944.3, -1769.2, 13.39 }, {1938.93, -1769.1, 13.38 }, {1938.91, -1776.63, 13.39 }, }, -- Tiera Robbada Gas Station-Trucker stop. { {-742.21, 2751.14, 47.22, true }, }, -- Whetstone-24/7 shop near Angel Pine Gas station { {-1602.46, -2709.84, 48.53, true }, {-1605.85, -2714.2, 48.53 }, {-1609.22, -2718.53, 48.53 }, }, -- LS airport { {1943.16, -2643.56, 13.54, true }, {1973.68, -2642.29, 13.54 }, {2006.33, -2641.51, 13.54 }, {2042.73, -2640.8, 13.54 }, }, -- LV airport { {11332.48, 1571.46, 10.82, true }, {11332.54, 1609.93, 10.82 }, }, -- SF airport { {-1308.82, 25.31, 14.14, true }, {-1292.43, 8.07, 14.14 }, {-1275.06, -9.45, 14.14 }, }, -- Others { {1326.45, 1391.54, 10.47, true }, }, { { 1910.71, -2335.42, 13.25, true }, }, { {-2175.83, 2427.19, 0.75, true }, }, { { 2372.07, 505.63, 0.47, true }, }, { {2285.01, -2501.6, 0.61, true }, }, { {-11.01, -1656.07, 0.53, true }, }, { {-5061, 94, 12, true }, }, { {-5061, 100, 12, true }, }, { {-1713, -462, 14, true }, }, { {-1705, -462, 14, true }, } } -- Create the markers and blips addEventHandler ( "onClientResourceStart", resourceRoot, function () for ind,tbl in ipairs(pumps) do for i=1,#tbl do local x, y, z = tbl[i][1], tbl[i][2], tbl[i][3] local theMarker = createMarker ( x, y, z -1, "cylinder", 3.0, 135, 132, 134, 70 ) setElementData(theMarker,"ind",ind) table.insert ( pumps, theMarker ) addEventHandler ( "onClientMarkerHit", theMarker, onFuelPumpMarkerHit, false ) addEventHandler ( "onClientMarkerLeave", theMarker, onFuelPumpMarkerLeave, false ) end end end ) -- Function for get all the fuel pump markers function getFuelMarkers () if ( pumpsMarkers ) then return pumpsMarkers else return false end end -- Check if a marker is a fuel marker function isFuelMarker ( theMarker ) for k, aMarker in ipairs ( pumps ) do if ( aMarker == theMarker ) and ( isElementWithinMarker( localPlayer, theMarker ) ) then return true end end return false end
-
there is no such structure
-
addEventHandler ( "onClientResourceStart", resourceRoot, function () for ind,tbl in ipairs(pumps) do for i=1,#tbl do local x, y, z = tbl[i][1], tbl[i][2], tbl[i][3] local theMarker = createMarker ( x, y, z -1, "cylinder", 3.0, 135, 132, 134, 70 ) setElementData(theMarker,"ind",ind) table.insert ( pumps, theMarker ) addEventHandler ( "onClientMarkerHit", theMarker, onFuelPumpMarkerHit, false ) addEventHandler ( "onClientMarkerLeave", theMarker, onFuelPumpMarkerLeave, false ) end end end ) ERROR: fuel\pumps.lua:4: attempt to get length of local 'tbl' (a userdata value) why am i getting this error??
-
I've tried but the fire objects don't go
-
How can I extinguish fire objects with the fire truck
-
I do what you say but still get the same errors
-
addEventHandler("onClientResourceStart", resourceRoot, function() panel = guiCreateWindow(229, 146, 763, 542, "Veh Mods", false) guiSetAlpha(panel, 0.95) guiWindowSetSizable(panel, false) guiSetVisible(panel, false) Information = guiCreateLabel(81, 30, 595, 76, "Using these mods can cause changes in your game, depending on the type of computer you have.\nWe are not responsible for your actions in using these mods.\nIf you use too many mods can cause problems with the limitations of GTA SA (being an old game).\nYou can start see your map starting disappear.\nWhen you're downloading these mods, you should always wait for both files finished it(.dff and .txd).", false, panel) guiSetFont(Information, "default-bold-small") guiLabelSetColor(Information, 225, 100, 0) TAB = guiCreateTabPanel(10, 76, 743, 456, false, panel) VehiclesTAB = guiCreateTab("Vehicles", TAB) gl = guiCreateGridList(11, 13, 722, 359, false, VehiclesTAB) guiGridListSetSortingEnabled(gl, false) guiGridListAddColumn(gl, "ID", 0.12) guiGridListAddColumn(gl, "Vehicle Name", 0.21) guiGridListAddColumn(gl, "Replace With", 0.21) guiGridListAddColumn(gl, "Size", 0.12) guiGridListAddColumn(gl, "Download", 0.13) guiGridListAddColumn(gl, "Enabled", 0.13) VehicleI = guiCreateStaticImage(11, 377, 55, 49, "IMG/Vehicles.png", false, VehiclesTAB) VehicleII = guiCreateStaticImage(678, 376, 55, 49, "IMG/Vehicles.png", false, VehiclesTAB) download = guiCreateButton(75, 396, 111, 25, "Download", false, VehiclesTAB) guiSetFont(download, "default-bold-small") guiSetProperty(download, "NormalTextColour", "F8A5A5A5") del = guiCreateButton(557, 396, 111, 25, "Delete", false, VehiclesTAB) guiSetFont(del, "default-bold-small") guiSetProperty(del, "NormalTextColour", "F8A5A5A5") enable = guiCreateButton(316, 396, 111, 25, "Enable/Disable", false, VehiclesTAB) guiSetFont(enable, "default-bold-small") guiSetProperty(enable, "NormalTextColour", "F8A5A5A5") close = guiCreateButton(679, 23, 74, 24, "[ Close ]", false, panel) guiSetFont(close, "default-bold-small") guiSetProperty(close, "NormalTextColour", "F8A5A5A5") searchEd = guiCreateEdit(644, 76, 104, 23, "", false, panel) guiEditSetMaxLength(searchEd, 20) searchLab = guiCreateLabel(644, 56, 103, 20, "Vehicle Name:", false, panel) guiSetFont(searchLab, "default-bold-small") guiLabelSetColor(searchLab, 253, 220, 1) guiLabelSetHorizontalAlign(searchLab, "center", false) guiLabelSetVerticalAlign(searchLab, "center") CW(panel) end ) local eTable = {} local dTable = {} local enabledIDs = {} function vehModsCmd() local status = not guiGetVisible(panel) guiSetVisible(panel, status) showCursor(status) refreshList() end addEvent ("userpanel_vehmods", true ) addEventHandler ("userpanel_vehmods", root, vehModsCmd ) addCommandHandler("vehmods", vehModsCmd ) addEventHandler('onClientGUIClick', root, function() if ( source == close ) then guiSetVisible(panel, false) showCursor(guiGetVisible(panel)) guiBringToFront(searchEd) elseif ( source == Information ) then guiBringToFront(searchEd) elseif ( source == download ) then local row, col = guiGridListGetSelectedItem(gl) guiBringToFront(searchEd) if ( row ~= -1 and col ~= 0 ) then local name = guiGridListGetItemData(gl, row, 3) downloadMod(name) refreshList() end elseif ( source == enable ) then local row, col = guiGridListGetSelectedItem ( gl ) guiBringToFront(searchEd) if ( not isPedInVehicle(localPlayer) ) then local row, col = guiGridListGetSelectedItem ( gl ) if ( row ~= -1 and col ~= 0 ) then local vehName = guiGridListGetItemData(gl, row, 3) local enab = guiGridListGetItemText( gl, row, 6 ) if ( enab == 'Yes' ) then setModEnabled(vehName, false) savexml() else setModEnabled(vehName, true) savexml() end end else new("Leave your vehicle first!", 255, 0, 0 ) end elseif ( source == del ) then local row, col = guiGridListGetSelectedItem ( gl ) local iDownload = guiGridListGetItemText(gl, row, 5) local iEnable = guiGridListGetItemText(gl, row, 6) local veh = guiGridListGetItemData(gl, row, 3) guiBringToFront(searchEd) if ( iDownload == "Yes" ) then if ( iEnable == "Yes" ) then new("Disable this mod first", 255, 0, 0) return end guiSetEnabled(source, false) guiSetEnabled(enable, false) guiSetEnabled(del, true) guiGridListSetItemText(gl, row, 3, "No", false, false) deleteMod(veh) refreshList() savexml() end elseif ( source == gl ) then local row, col = guiGridListGetSelectedItem(source) guiBringToFront(searchEd) if ( row ~= -1 and col ~= 0 ) then local vehName = guiGridListGetItemData(gl, row, 3) local _, _, dff, txd = getModData(vehName) if ( fileExists("modlar/"..dff) and fileExists("modlar/"..txd) ) then guiSetEnabled( enable, true ) guiSetEnabled(del, true ) guiSetEnabled(download, false ) else guiSetEnabled(download, true ) guiSetEnabled(enable, false) guiSetEnabled(del, false ) end else guiSetEnabled(enable, false ) guiSetEnabled(download, false ) guiSetEnabled(del, false ) end end end ) function deleteMod(name) local _, _, dff, txd = getModData(name) if ( fileExists("modlar/"..txd) ) then fileDelete("modlar/"..txd) new('TXD file has been deleted successfully!', 0, 255, 0) refreshList() end if ( fileExists("modlar/"..dff) ) then fileDelete("modlar/"..dff) new('DFF file has been deleted successfully!', 0, 255, 0) refreshList() end end function setModEnabled(name, state) local _, _, dff, txd, id, _, weirdbool = getModData(name) local row, col = guiGridListGetSelectedItem( gl ) if ( fileExists("modlar/"..dff) ) then if ( fileExists("modlar/"..txd) ) then if ( state == false ) then engineRestoreModel( id ) eTable[name] = false enabledIDs[id] = false guiGridListSetItemText( gl, row, 6, "No", false, false ) else if ( weirdbool ) then if ( enabledIDs[id] ) then new("Another mod already enabled at the same vehicle.", 255, 0, 0 ) return end local txd1 = engineLoadTXD ( "modlar/"..txd ) --171 if ( not txd1 ) then new("Failed to load the mod", 255, 0, 0 ) end if ( not engineImportTXD ( txd1, id ) ) then new("Failed to load the mod", 255, 0, 0 ) end end local dff = engineLoadDFF ( "modlar/"..dff, id ) if ( not dff ) then new("Failed to load the mod", 255, 0, 0) end if ( not engineReplaceModel ( dff , id ) ) then --191 new("Failed to replace the mod", 255, 0, 0) end eTable[name] = true enabledIDs[id] = true guiGridListSetItemText(gl, row, 6, "Yes", false, false) end end end end function downloadMod(name) local _, _, dff, txd = getModData(name) downloadFile('modlar/'..dff) downloadFile('modlar/'..txd) refreshList() dTable[name] = true new('Please wait while downloading your mod!', 0, 255, 0) end function onDownloadFinish (file, success) if ( source == resourceRoot ) then if ( success ) then refreshList() new("Your mod has been successfully downloaded ("..tostring(file)..")", 0, 255, 0) end end end addEventHandler ( "onClientFileDownloadComplete", getRootElement(), onDownloadFinish ) function refreshList() guiGridListClear(gl) for categories, data in pairs(vTable) do local categoryRow = guiGridListAddRow (gl) guiGridListSetItemText(gl, categoryRow, 1, categories, true, false) guiGridListSetItemColor(gl, categoryRow, 1, 30, 125, 255) for _, dataData in pairs (data) do modName, modVehicle, modDFF, modTXD, modModel, modSize = dataData[1], dataData[2], dataData[3], dataData[4], dataData[5], dataData[6] if ( fileExists('modlar/'..modDFF) and fileExists('modlar/'..modTXD) ) then downloaded = 'Yes' else downloaded = 'No' end if ( eTable[modName] ) then ena = 'Yes' else ena = 'No' end row = guiGridListAddRow(gl) guiGridListSetItemText( gl, row, 1, modModel, false, false) guiGridListSetItemText( gl, row, 2, modVehicle, false, false) guiGridListSetItemText( gl, row, 3, modName, false, false) guiGridListSetItemText( gl, row, 4, modSize, false, false) guiGridListSetItemText( gl, row, 5, downloaded, false, false) guiGridListSetItemText( gl, row, 6, ena, false, false) guiGridListSetItemData( gl, row, 2, modVehicle) guiGridListSetItemData( gl, row, 3, modName) guiSetEnabled(enable, false) guiSetEnabled(del, false) guiSetEnabled(download, false) guiSetEnabled(close, true) end end end function searching ( ) if source == searchEd then if guiGetText(source) == "" then return refreshList() end guiGridListClear(gl) for categories, data in pairs(vTable) do local categoryRow = guiGridListAddRow (gl) guiGridListSetItemText(gl, categoryRow, 1, categories, true, false) guiGridListSetItemColor(gl, categoryRow, 1, 30, 125, 255) for _, dataData in pairs (data) do modName, modVehicle, modDFF, modTXD, modModel, modSize = dataData[1], dataData[2], dataData[3], dataData[4], dataData[5], dataData[6] if string.find(modVehicle:lower ( ) , guiGetText(source):lower ( ) ) then if ( fileExists('modlar/'..modDFF) and fileExists('modlar/'..modTXD) ) then downloaded = 'Yes' else downloaded = 'No' end if ( eTable[modName] ) then ena = 'Yes' else ena = 'No' end row = guiGridListAddRow(gl) guiGridListSetItemText( gl, row, 1, modModel, false, false) guiGridListSetItemText( gl, row, 2, modVehicle, false, false) guiGridListSetItemText( gl, row, 3, modName, false, false) guiGridListSetItemText( gl, row, 4, modSize, false, false) guiGridListSetItemText( gl, row, 5, downloaded, false, false) guiGridListSetItemText( gl, row, 6, ena, false, false) guiGridListSetItemData( gl, row, 2, modVehicle) guiGridListSetItemData( gl, row, 3, modName) guiSetEnabled(enable, false) guiSetEnabled(del, false) guiSetEnabled(download, false) guiSetEnabled(close, true) end end if ( not string.find( guiGridListGetItemText(gl, categoryRow, 1) : lower ( ), guiGetText(source):lower ( ) ) ) then guiGridListRemoveRow ( gl, categoryRow ) end end end end addEventHandler("onClientGUIChanged", resourceRoot, searching) function savexml() local file = xmlCreateFile ('@saving.xml', 'data') for categories, data in pairs(vTable) do for _, dataData in pairs (data) do modName, modVehicle, modDFF, modTXD, modModel, modSize = dataData[1], dataData[2], dataData[3], dataData[4], dataData[5], dataData[6] local child = xmlCreateChild( file, 'mod' ) xmlNodeSetAttribute( child, 'name', modName ) xmlNodeSetAttribute( child, 'enabled', tostring( isset( eTable[modName] ) ) ) end end xmlSaveFile( file ) xmlUnloadFile( file ) end addEventHandler("onClientResourceStart", resourceRoot, function ( ) setTimer ( function ( ) refreshList ( ) local file = xmlLoadFile ( '@saving.xml', 'data' ) if file then for i, v in ipairs ( xmlNodeGetChildren( file ) ) do local name = tostring( xmlNodeGetAttribute( v, 'name' ) ) local enabled = toboolean( xmlNodeGetAttribute( v, 'enabled' ) ) if ( getModData(name) and tostring( enabled ):lower ( ) ~= "false" ) then setModEnabled(name, true) eTable[name] = true local _, _, _, _, id = getModData(name) enabledIDs[id] = true end end end end, 500, 1 ) end ) function dm (t, r, g, b) if ( t and r and g and b ) then exports.hud:new(t, r, g, b) end end function getModData ( modName ) for categories, data in pairs (vTable) do for _, dataData in pairs (data) do if ( dataData[1] == modName ) then return dataData[1], dataData[2], dataData[3], dataData[4], dataData[5], dataData[6], dataData[7] end end end end function toboolean ( input ) local input = string.lower ( tostring ( input ) ) if ( input == 'true' ) then return true elseif ( input == 'false' ) then return false else return nil end end function isset ( value ) if ( value ) then return true end return false end function CW(center_window) local screenW, screenH = guiGetScreenSize() local windowW, windowH = guiGetSize(center_window, false) local x, y = (screenW - windowW) /2,(screenH - windowH) /2 guiSetPosition(center_window, x, y, false) end Where should I reuse what you said?
-
function setModEnabled(name, state) local _, _, dff, txd, id, _, weirdbool = getModData(name) local row, col = guiGridListGetSelectedItem( gl ) if ( fileExists("modlar/"..dff) ) then if ( fileExists("modlar/"..txd) ) then if ( state == false ) then engineRestoreModel( id ) eTable[name] = false enabledIDs[id] = false guiGridListSetItemText( gl, row, 6, "No", false, false ) else if ( weirdbool ) then if ( enabledIDs[id] ) then new("Another mod already enabled at the same vehicle.", 255, 0, 0 ) return end local txd1 = engineLoadTXD ( "modlar/"..txd ) --179 if ( not txd1 ) then new("Failed to load the mod", 255, 0, 0 ) end if ( not engineImportTXD ( txd1, id ) ) then new("Failed to load the mod", 255, 0, 0 ) end end local dff = engineLoadDFF ( "modlar/"..dff, id ) if ( not dff ) then new("Failed to load the mod", 255, 0, 0) end if ( not engineReplaceModel ( dff , id ) ) then --191 new("Failed to replace the mod", 255, 0, 0) end eTable[name] = true enabledIDs[id] = true guiGridListSetItemText(gl, row, 6, "Yes", false, false) end end end end Why am I getting this error?
-
I did not understand
-
function onVehicleDamage(attacker, wep, loss, x, y, z, tire) if (exports.team:isPlayerInTeam(source, "TSK") and exports.team:isPlayerInTeam(attacker, "TSK")) then cancelEvent(true) elseif (exports.team:isPlayerInTeam(source, "WSP") and exports.team:isPlayerInTeam(attacker, "WSP")) then cancelEvent(true) end end addEventHandler("onClientVehicleDamage", root, onVehicleDamage) this code doesn't work. what should I do?
-
@IIYAMA thanks
-
I want to disable helicopter blade damage. How should I do?
-
@ IIYAMA successful thanks
-
client.lua setTimer ( function () local theCol = getElementData(root, "BlockExportCol") function isInColExport () if isElement(theCol) and isElementWithinColShape(localPlayer,theCol) then return true else return false end end function ClientExplosionCFunction() if isInColExport () then cancelEvent () end end addEventHandler("onClientExplosion", root, ClientExplosionCFunction) end , 1000, 1 ) shared.lua BlockVehicle = createColCuboid ( 1573.84900,-1637.5,12, 10,6,6 ) setElementData(root, "BlockExportCol", BlockVehicle) I want to block vehicles in more areas how can I do it?
