csiguusz
Members-
Posts
500 -
Joined
-
Last visited
Everything posted by csiguusz
-
A loop? local markers = { createMarker ( ... ), createMarker ( ... ), createMarker ( ... ) } for i, v in ipairs ( markers ) do setElementParent ( v, ele ) end
-
Read the wiki page. What you make with that function won't be a real entity in the world, it will youst behave like an element. Eg.: local marker1, marker2 = createMarker ( ... ), createMarker ( ... ) local ele = createElement ( "markers" ) setElementParent ( marker1, ele ) setElementParent ( marker2, ele ) addEventHandler ( "onMarkerHit", ele, function () outputChatBox ( "hit" ) end ) Edit: Great! You are welcome.
-
Create a dummy element with createElement and set this elemenet as parent of your markers with setElementParent. Then define your onMarkerHit event handler attached to the dummy element.
-
OOP is an acronym of Object Oriented Programming, wich is a programming paradigm and not a language. Freeroam was also written in lua as every other scripts. It has a kind of gui "engine" wich builds the windows from the data given in a table. You have to add te abillity to fad in/out windows to this engine to make what you want (gui.lua file).
-
But if you don't know the index of the value you want to remove, then loop through the table to find it. (note: if you use "table" as a variable name it overwrites the global "table", so you can't use table.remove and other table functions.) for i, v in ipairs ( t ) do if v == vehicle8 then table.remove ( t, i ) end end
-
You are welcome.
-
You had a few mistakes. Try this: local sX, sY = guiGetScreenSize() function test2 () dxDrawRectangle(sX/4, sY/4, sX/8, sY/8, tocolor(0,255,0,255), false) showCursor(true) end addEventHandler("onClientRender", root, test2 ) function test ( button, state, x, y ) if (button == 'left' or button == 'right' or state == 'down') then local checkX = ( x > sX/4 and x < 2*sX/4-sX/8 ) local checkY = ( y > sY/4 and y < 2*sY/4-sY/8 ) if ( checkX and checkY ) then outputChatBox("true") end end end addEventHandler("onClientClick", root, test)
-
The onPlayerWasted event handler isn't attached to the function wich you marked as "not working" and the first parameter passed to the handler function of onPlayerWasted is not a player (read it's wiki page). The source is a hidden variable, it musn't be in the parameter list. Both of these should give you an error message in debugscript so I suppose you haven't used it while debugging.
-
Rossz hĂr, de várhatĂł volt sajnos az utĂłbbi idĹ‘ (nem)törtĂ©nĂ©sei alapján. Amit Ărtál már nem igazán az Ă©n terĂĽletem, most maradok mta-nál, aztán majd lehet megnĂ©zem mit tudnĂ©k kihozni a eddigi kĂłdbĂłl.
-
So you want more names in a line? local charLimit = 50 -- maximum charachters in a line addCommandHandler ( "online", function () local line = {} local currLength = 0 for i, v in ipairs ( getElementsByType ( "player" ) ) do local name = getPlayerName ( v ) if currLength + #name > charLimit then outputChatBox ( table.concat ( line, ", " ) ) line = {} currLength = 0 end table.insert ( line, name ) currLength = currLength + #name end end )
-
Yes, you can. Here is a simple example: addCommandHandler ( "online", function () for i, v in ipairs ( getElementsByType ( "player" ) ) do outputChatBox ( getPlayerName ( v ) ) end end )
-
local onlinePlayers = {} for i, v in ipairs ( getElementsByType ( "player" ) ) do table.insert ( onlinePlayers, v ) end
-
It would be more helpful if you didn't just say "it's not working" but say what is it doing instead (e.g what's the error message if there is one). By the way, there is no function called "SetCameraMatrix", use setCameraMatrix. And playerid is not defined, use getLocalPlayer. Edit: oh, and "GetCameraMatrix" is also wrong.
-
local stats = { {69,22}, {70,23}, {71,24}, {72,25}, {73,26}, {74,27}, {75,28}, {76,29}, {77,30}, {78,31}, {79,34} }
-
Ez jĂł ötlet, hasznos lehet, viszont a globális tár a modularitás szempontjábĂłl nem jĂł ötlet. Valahogy lokálisabban (exportált fĂĽggvĂ©nyek használata nĂ©lkĂĽl) kĂ©ne megoldani resource-onkĂ©nt. Penlighthoz: ahogy mondod, tiszta lua "mindössze" az io, os, package library-ket Ă©s a require-t kĂ©ne valahogy helyettesĂteni. De ha az működik, ami kell, akkor nincs gond. Az pedig miĂ©rt is lenne jĂł, a második kĂłdrĂ©szlet, amit Ărtál? Arra kĂ©rnĂ©k egy kis magyarázatot. A self pĂ©ldául mindig t lesz, tehát az a feltĂ©tel sosem fog teljesĂĽlni. A self-nek akkor van Ă©rtelme, ha van egy kĂĽlön __index kezelĹ‘ fĂĽgvĂ©ny Ă©s azt tesszĂĽk a metatáblákba. Az angol szavakhoz: pár szĂł jelentĂ©sĂ©nek azĂ©rt nem árthat utánanĂ©zni, mĂ©g tanulhat is az ember. Itt az inheritation-t öröklĹ‘dĂ©snek szokták hĂvni. Az invoke-nak nem tudom ebben az esetben mi a hivatalos magyar megfelelĹ‘je (ha van egyáltalán) de akkkor legyen használ/bevon. A metametĂłdus meg csĂşnyán hangzik, de a method az metĂłdus magyarul.
-
onPlayerJoin --event --then setCameraMatrix --for moving use the above function with this event: onClientPreRender
-
You are welcome.
-
"onClientKey" event is client-sided only and the account functions are only for server-side.
-
Global functions defined in file1 can be used in file2 if file1 is loaded before file2 in the meta.xml.
-
You can create just rows of text, it is called a label. What do you mean by useful funtions? Create the gridlist, add columns, add rows, set the texts.
-
És akkor exportálni a függvényeket a másik resource-ból? Itt az oop-sek elég csúnyán néznének ki, ha egyáltalán lehetne exportálva használni őket. Line of sight check mire fog kelleni? Penlight meg mta-ban nem fog menni alapból, de nem tudom akarjuk-e ott használni. Végre! Dxgui! Azt szeretem. Elkezdtem korábban egyet csinálni, csak aztán nem folytattam, lehet majd nekiállok megint.
-
EgĂ©szen szĂ©p a kĂłd, ahogy Ăgy átfutottam! De majd azĂ©rt lenne mĂ©g pár kĂ©rdĂ©sem, javaslatom. Ehhez a scite-mta dologhoz: a globális környezet ( _G ) megváltoztatásával könnyen meg lehetne oldani, hogy ugyanaz a kĂłd fusson mindkĂ©t helyen. PĂ©ldául minden kiĂrásnál csak outputChatBoxot vagy printet használni Ă©s lenne egy fájl, amit elsĹ‘nek kĂ©ne betölteni, ami ellenĹ‘rzi hogy most ez mta vagy nem ( már megvan az isMTA fĂĽggvĂ©ny ), aztán az alapján változtat a fĂĽggvĂ©nyeken. Pl.: function print_MTA ( ... ) for i, v in ipairs ( arg ) do outputChatBox ( tostring ( v ) ) end end function require_MTA ( filePath ) assert ( fileExists ( filePath ), filePath .. " not found!" ) -- itt mĂ©g akár a meta.xml-t megnyitva a jĂł sorrendet is ellenĹ‘rizheti. end if isMTA () then _G.print = print_MTA _G.require = require_MTA end print("test")
-
Then you have to brake it into lines by yourself. My solution: function linebreak ( t ) local line = "" local newTable = {} local i = 1 while i <= #t do while line:len () <= 120 and i <= #t do -- I'm not sure what is the character limit. You can try changing the value 120. line = line .. t[ i ] i = i + 1 end newTable[ #newTable + 1 ] = line line = "" end return newTable end local commandsTable = {} local commandsXML = xmlLoadFile("commands.xml") for index,node in pairs(xmlNodeGetChildren(commandsXML)) do if xmlNodeGetName(node) == "command" then checkSound(xmlNodeGetAttribute(node,"sound")) commandsTable[ #commandsTable + 1 ] = colorCode.." /"..xmlNodeGetAttribute(node,"commandName")..textColor end end commandsTable = linebreak ( commandsTable ) addCommandHandler("chatcommands", function(player) outputChatBox(colorCode.."# "..textColor.."Available chatcommands:",player,255,255,255,true) for i, v in ipairs ( commandsTable ) do outputChatBox ( v, player, 255, 255, 255, true ) end end)
-
Read the commands into a table, and then output them from here, only one command for one outputChatBox. local commandsTable = {} local commandsXML = xmlLoadFile("commands.xml") for index,node in pairs(xmlNodeGetChildren(commandsXML)) do if xmlNodeGetName(node) == "command" then checkSound(xmlNodeGetAttribute(node,"sound")) commandsTable[ #commandsTable + 1 ] = colorCode.." /"..xmlNodeGetAttribute(node,"commandName")..textColor end end addCommandHandler("chatcommands", function(player) outputChatBox(colorCode.."# "..textColor.."Available chatcommands:",player,255,255,255,true) for i, v in ipairs ( commandsTable ) do outputChatBox ( v, player, 255, 255, 255, true ) end end)
-
Annyit Ă©n se Ă©rek rá most mint korábban, de persze szinte minden nap ráérnĂ©k valamennyit foglalkozni a dologgal. (Igen, azĂ©rt jĂłval gyorsabb mert az C-ben van megvalĂłsĂtva. Sok alap lua fĂĽggvĂ©nyt meg lehetne Ărni luában is, csak semmi Ă©rtelme, mivel szinte biztos, hogy sokkal lassabb lenne.) Itt a letölthetĹ‘ SDK a modulokhoz Mikrofonnal pedig egyszerűbb lenne, de akkor marad az Ărás.