Search the Community
Showing results for tags 'getelementdata'.
-
Hi! l need help exporting data from 'GetElementData' using executeBrowserJavascript Here is a snippet from the code: Client: local browser = guiGetBrowser(guiCreateBrowser(0, 0, 1920, 1080, true, true, true)) addEventHandler("onClientBrowserCreated", browser, function () loadBrowserURL(source, "http://mta/account/Characters/MainMenuChar.html") showCursor(true) setDevelopmentMode(true, true) end) addEventHandler("onClientBrowserDocumentReady", browser, function () executeBrowserJavascript(source, "document.getElementById('nickname').innerHTML = '" .. getElementData(thePed,"account:charselect:name") .. "'"); end) it does not work with CEF(HTML) files, when you call 'GetElementData' using the GUI, everything works and is displayed correctly. When entering a standart varible, for example getPlayerName(localplayer) everything is also displayed in CEF and in the GUI Problems with the HTML file are excluded, except that there are no additional scripts using JavaScript (tell me, are they required?) P.S Thank you in advance for each of your answers, maybe they will help not only me, but also other newcomers in our community
- 2 replies
-
- getelementdata
- html
-
(and 1 more)
Tagged with:
-
Estou fazendo um sistema de Porte de Armas + Venda de Armas. E eu quero deixar assim, só quem pode comprar arma é quem tem o porte de armas. Quem não tem, não consegue comprar as armas. Alguém que possa me ajudar?
- 19 replies
-
- programação em lua
- porte de armas
- (and 11 more)
-
Ola Eu estou aqui com esse erro: Bad argument @ 'getElementData' [Expected element at argument 1, got nil] Queria saber como eu arrumaria isso. Codigo: ----------------------------------Função começo trabalho---------------------------------- function trabalho (source, player) if isElementWithinMarker(source, MarkerTrab)then if veh[source] and isElement( veh[source] ) then destroyElement( veh[source] ) veh[source] = nil end x,y,z = getElementPosition(source, player) trabalho = true veh[source] = createVehicle(408, 2150.14453125, -1977.4909667969, 13.546875) warpPedIntoVehicle (source, veh[source]) setElementData( source, "Emprego", "Lixeiro" ) outputChatBox ( "#007ff7Você agora esta empregado", getRootElement(), 255, 0, 0, true ) setElementVisibleTo(MarkerTrab1, source, true) setElementVisibleTo(BlipTrab1, source, true) end end addEventHandler("onMarkerHit", MarkerTrab, trabalho) ------------------------------------------------------------------------------------------- ----------------------------------------1Mark---------------------------------------------- function congelar1( hitElement, mesmaDimensao, source ) if getElementType(hitElement) == "vehicle" and mesmaDimensao then -- O Elemento que atingir a marca deve ser veículo if getElementData(source, "Lixeiro" , "Emprego") then setElementFrozen( hitElement, true ) -- true: Congelado | false: Descongelado setTimer( function(veh) setElementFrozen( veh, false ) end, 10000, 1, hitElement ) outputChatBox ( "#0077ff====================", getRootElement(), 255, 0, 0, true ) outputChatBox ( "#00ff77Aguardando pegar o lixo", getRootElement(), 255, 0, 0, true ) outputChatBox ( "#0077ff====================", getRootElement(), 255, 0, 0, true ) destroyElement (MarkerTrab1) destroyElement (BlipTrab1) else outputChatBox ( "#0077ffVocê não é um lixeiro", getRootElement(), 255, 0, 0, true ) end end -- fechando a condição end -- fechando a função addEventHandler("onMarkerHit", MarkerTrab1, congelar1)
-
My problem is that it's not storing the data in the local mg = {}. The debugscript says: bad argumentum @ 'setElememtData' expected element at argument 1, got table Thanks in advance! function mg_pos() createMG(-2861.9, 19.4, 15.83, 0, 0, 188) end addEventHandler ( "onResourceStart", getResourceRootElement(getThisResource()), mg_pos) --MG 1 local mg = {} function createMG(posX,posY,posZ,rotX,rotY,rotZ) local weapon_base = createObject ( 1897, posX,posY,posZ,rotX,rotY,rotZ) local weapon = createObject ( 356, 0,0,0) attachElements ( weapon, weapon_base, -0.55, 0, 0.75, 0, 0, 0) setElementData ( mg, "weapon_base", weapon_base) setElementData ( mg, "weapon", weapon) end
- 14 replies
-
- setelementdata
- getelementdata
-
(and 2 more)
Tagged with:
-
Hello guys, for some reason debugscript is saying this..Heres my script piece: setElementData(p, "acc:admin", 7) if not getElementData(p, "acc:admin") > 0 then return end Nothing else changes acc:admin. Edit: Found the solution: setElementData(p, "acc:admin", 7) if not (getElementData(p, "acc:admin") > 0) then return end But, i still don't understand, so can someone explain me whats the difference between those code blocks?
-
Hello there, I've almost finished my vehicle shop / saving / control system but i got this error when i log out or reconnect: ERROR: wangcars/shop_server.lua:16: Couldn't convert userdata argument to JSON, only valid resources can be included for this function. I've tested and the result is table but toJSON says that it is userdata. It still saves it to accountdata in toJSON and i can unpack it with fromJSON. So is this mta bug or what? Saving function: addEventHandler("onPlayerLogout", root, function(account) local data = getElementData(source, "wangcars.data") if data then if account and not isGuestAccount(account) then if isElement(wangvehicle[source]) then local id = getElementData(wangvehicle[source], "wangcars.id") local x, y, z = getElementPosition(wangvehicle[source]) local rx, ry, rz = getElementRotation(wangvehicle[source]) data[id][6] = x..", "..y..", "..z..", "..rx..", "..ry..", "..rz data[id][8] = getElementHealth(wangvehicle[source]) setElementData(source, "wangcars.data", data) destroyElement(wangvehicle[source]) wangvehicle[source] = nil end setAccountData(account, "wangcars.data", toJSON(getElementData(source, "wangcars.data"))) -- error there, but it still saves it setElementData(source, "wangcars.data", false) triggerClientEvent(source, "wangcars.refreshgrid", source) end end end ) I have almost same function when player quit but no need to post it. I could just ignore this, but it's anoying because it always outputs error in debugscript when somebody disconnects and i'm trying to keep debug clean as possible.