-
Posts
1,273 -
Joined
-
Last visited
-
Days Won
1
Everything posted by GTX
-
Use processLineOfSight to check which object ID is below you or an object.
-
You can save it anywhere, as long as it's correct JSON syntax in the file. file = fileOpen"Json.lua" if file then table = fromJSON(fileRead(file, fileGetSize(file))) end
-
Of course... creating editbox is great idea... every frame? Not. edit = guiCreateEdit(...) guiSetAlpha(edit, 0) -- No need for properties. addEventHandler("onClientRender", root, function() -- DX functions. end )
-
You can't hide binds... Unless you set a macro out of MTA.
-
local deathTimer function theLocator ( ) local allLocations = { "Las Venturas", "San Fierro", "Whetstone", "Flint County", "Red County", "Los Santos" } local allPlayers = getElementsByType ( "player" ) local allVehicles = getElementsByType ( "vehicle" ) for index, thePlayer in ipairs ( allPlayers ) do local theLocation = getElementZoneName ( thePlayer, true ) for index, allLocations in ipairs ( allLocations ) do if ( theLocation == allLocations ) then if not isTimer(deathTimer) then deathTimer = setTimer(killPed, 10000, 1, thePlayer ) end else if isTimer(deathTimer) then killTimer(deathTimer) end end end end for index, theVehicle in ipairs ( allVehicles ) do local theLocation = getElementZoneName ( theVehicle, true ) for index, allLocations in ipairs ( allLocations ) do if ( theLocation == allLocations ) then if not isTimer(deathTimer) then deathTimer = setTimer(blowVehicle, 10000, 1, theVehicle ) end else if isTimer(deathTimer) then killTimer(deathTimer) end end end end end
-
function thisistest(score) addEventHandler("onClientRender", root, hello) end addEvent("justfortest1", true) addEventHandler("justfortest1", root, thisistest) addCommandHandler("removedx", function () local dim = getElementDimension(localPlayer) if (dim == 1) then removeEventHandler("onClientRender", root, hello) end end )
-
This is not a request forum. We won't script for you. Use pre-made DX GUI.
-
What do you mean when map ends?
-
You can't. You can only "fake" value. local healthValue = (getElementHealth(vehicle)-250)/750*100 This will get vehicle's health 0-100.
-
Upgrade all command just upgrades deprecated functions. It is totally different.
-
I didn't understand a thing you say. What are you even trying to do???
-
local mysql = exports.mysql function saveFunc(xPosition, yPosition, zPosition, rotPosition, nameLocation, descriptionLocation) local insertid = mysql:query_insert_free("INSERT INTO locations SET x='" .. mysql:escape_string(tonumber(xPosition)) .. "', y='" .. mysql:escape_string(tonumber(yPosition)) .. "', z='" .. mysql:escape_string(tonumber(zPosition)) .. "', rot='" .. mysql:escape_string(tonumber(rotPosition)) .. "', name='" .. mysql:escape_string(nameLocation) .."', description='" .. mysql:escape_string(descriptionLocation).."'" ) if (insertid) then outputChatBox("Location:"..nameLocation.. "has successfully been saved!", source, 0, 255, 0) else outputChatBox("An error occured! Please contact an Administrator!", source, 255, 0, 0) end end addEvent("saveFunc:saveLocation", true) addEventHandler("saveFunc:saveLocation", root, saveFunc)
-
It's same way multigamemode works. You can't magically start race for one dimension and stop the other at the same time.
-
local cjclothesmarker = { [1]={x=1648.5601806641,y=1732.7150878906,z=10.671875,dim=0,int=0} } local cjTable = { ["Torso"] = 100, ["Hair"] = 130, ["Legs"] = 150, ["Shoes"] = 170, ["Left Upper Arm"] = 110, ["Left Lower Arm"] = 110, ["Right Upper Arm"] = 110, ["Right Lower Arm"] = 110, ["Black Top"] = 120, ["Left Chest"] = 120, ["Right Chest"] = 120, ["Stomach"] = 140, ["Lower Back"] = 140, ["Extra1"] = 200, ["Extra2"] = 230, ["Extra3"] = 260, ["Extra4"] = 250 } addEventHandler("onResourceStart",resourceRoot, function () for index, pos in pairs(cjclothesmarker) do local cjmarker = createMarker(pos.x, pos.y, pos.z-1, "cylinder", 1.6, 247,187, 7, 120) setElementInterior(cjmarker, pos.int) setElementDimension(cjmarker, pos.dim) addEventHandler("onMarkerHit",cjmarker,onCJMarkerHit) end end) function onCJMarkerHit(player, dim) if not dim then return end if getElementType(player) == "player" then if getElementModel(player) > 0 then outputChatBox("Clothing Shop: You need the CJ skin to be able to buy clothes.",player,255,0,0) return end local result = {} local texture, model -- get all clothes result.allClothes = {} result.playerClothes = {} for type=0,17 do table.insert(result.allClothes, {type = type, name = getClothesTypeName(type)}) texture, model = getPedClothes(player, type) if texture then result.playerClothes[type] = {texture = texture, model = model} end end triggerClientEvent(player,"cjshop:show",player,result) end end addEvent("cjshop:buy",true) addEventHandler("cjshop:buy",root, function (n) local cashToPay = 0 if cjTable[n] then cashToPay = cashToPay + tonumber(cjTable[n]) end if getPlayerMoney(client) >= cashToPay then outputChatBox("CJ Shop: you don't have money to buy clothes.",client,255,0,0) for index, cloth in pairs(tempTable) do addPedClothes(client, cloth[1], cloth[2], getTypeIndexFromClothes(cloth[1], cloth[2])) end saveNewClothing(client) takePlayerMoney(client, tonumber(cashToPay)) outputChatBox("Clothing shop: Come back soon!",client,0,255,0) else outputChatBox("Clothing shop: You need "..tonumber(cashToPay) .." to buy this clothing.",client,255,0,0) end end) function saveNewClothing(player) for type=0,17 do local texture, model = getPedClothes(player, type) setAccountData(getPlayerAccount(player),"clothes_".. type,tostring(texture) ..",".. tostring(model)) end end cjwindow = guiCreateWindow(519,174,313,332,"CJ",false) guiSetVisible (cjwindow, false) buybtn = guiCreateButton(13,297,131,27,"Buy",false,cjwindow) rejectbtn = guiCreateButton(170,297,131,27,"Cancel",false,cjwindow) cjGrid = guiCreateGridList(9,20,295,274,false,cjwindow) guiGridListSetSelectionMode(cjGrid,0) guiGridListAddColumn(cjGrid,"CJ Clothes:",0.85) addEvent("cjshop:show",true) addEventHandler("cjshop:show",root, function (cjTable) guiSetVisible(cjwindow,true) showCursor(true) guiGridListClear(cjGrid) for i,v in ipairs (cjTable.allClothes) do local row = guiGridListAddRow (cjGrid) guiGridListSetItemText (cjGrid, row, 1, v.name, false, false) end end) addEventHandler ("onClientGUIClick", root, function () if (source == rejectbtn) then guiSetVisible(cjwindow,false) showCursor(false) elseif (source == buybtn) then local row,col = guiGridListGetSelectedItem(cjGrid) if row and col and row ~= -1 and col ~= -1 then guiSetVisible(cjwindow,false) showCursor(false) local clothes = guiGridListGetItemText (cjGrid, guiGridListGetSelectedItem (cjGrid), 1) triggerServerEvent("cjshop:buy",localPlayer, clothes) else outputChatBox("CJ Clothes Shop: You didn't selecte your clothes.",121,180,23) end end end)
-
Remove the loops. They're completely unnecessary. function sortRecords() table.sort(toptimes, function(a, b) return a[1] < b[1] end) -- Note that a[1] must exist and must be your timestamp. end
-
It should work. I never set any number in the script I gave you.
-
It does work. I used: local tablex = { [1] = {900,"WonderfulNick52"}, [2] = {100,"WonderfulNick52"}, [3] = {1,"WonderfulNick52"}, [4] = {69,"WonderfulNick52"} } table.sort(tablex, function(a,b) return a[1] < b[1] end)
-
guiGridListSetItemText (cjGrid, row, 1, v.type, false, false)
-
It does work, you just don't use it correctly. It is better and convenient using ORDER BY than table.sort, because if you use table.sort, it needs to process data twice.
-
Just use table.sort, you don't need to loop or anything. If you're using MySQL you can use ORDER BY.