Jump to content

Edikosh998

Members
  • Posts

    569
  • Joined

  • Last visited

Everything posted by Edikosh998

  1. Fijate que el error es logica. Cada if requiere de un end, porque la funcion va a pasar por ese if. En cambio si pones "elseif", no necesitara ya que es una condicion que se lee solo si el if principal no llega a ser certero (Capaz no me explique bien, pero la conclusion es que uses elseif).
  2. es outputChatBox....no outputChatBox. Recomendacion : 1) No pongas en el output , rootElement si queres decircelo a uno, pone source. 2) Para que un evento lo trigee a uno debes : triggerClientEvent(source,"Esconder",getRootElement()) -- El primer parametro es a quien queres que se lo trigee, el tercero es el source del evento, pero como no lo usas podes poner root. Lo que si, este primer parametro no lo podes usar
  3. ....Tenes que pone el setElementData en onPlayerJoin, en lo que mas te combiene.
  4. skins0 es una tabla.. setElementData(localPlayer, "SkinsSO", skinsSO[1])
  5. Al fin, http://www.lua.org/manual/5.1/es/ http://correo.uan.edu.mx/~iavalos/introprog.htm Programar no lo hace cualquiera, sino no podes...dejalo. Y si queres progrmaar, estudia y esforzate en hacerlo.
  6. Si no podes corregir ese error, te recomiendo que repases scripteo de vuelta. = end of file, expected = se esperaba...
  7. Osea "elvehiculo" sale de la nada, no declaraste de donde sale. Lo que tenes que hacer es que en el triggerServerEvent, agregar esta variable (fijate en la wiki como es lo de los parametros opcionales). Osea, lo declaraste en client-side pero lo tenes que pasar a server.
  8. Te hago el debugger a simple vista : Linea 1 - Server side = No existe esa funcion...Usa getElementPosition(elemento) Linea 41 - Client side = No existe getLocalPlayers...Usa el rootElement si queres poner a todos los jugadores. Linea 30 - Client side = Te falto un "do" Linea 4 - Server side = el primer argumento de la funcion createVehicle, es un nil value (Osea, no declaraste la variable "elvehiculo")
  9. Un label? Aunque en tu caso prefiero el dxText, vas a tener que usar onClientRender XDD.. Ejemplo para que entiendas local label = guiCreateLabel(x,y,w,h,"vida",false) function render() local vida = getElementHealth(localPlayer) guiSetText(label,vida) end addEventHandler("onClientRender",root,render)
  10. La idea es que entiendan los conceptos, porque asi se van avivando. No se hace todo de memoria, hay una logica siempre
  11. Es que para ese tipo de cosas necesitas usar ese evento como el dxText. Seguramente para el hud, usaras un dxDrawImage.
  12. Y no es mejor usar onClientRender?
  13. ...Ahi pedfs devuelve una tabla... LINE NUMBER ON/OFF | EXPAND/CONTRACT | SELECT ALL local pedfs = { createPed ( 49,-1043.95996,-1056.78002,129.211929), createPed ( 49,-1043.95996,-1056.78002,129.211929), createPed ( 49,-1043.95996,-1056.78002,129.211929) } function nopedfs ( ) for i,v in ipairs(pedfs) do if source == v then cancelEvent() end end end addEventHandler ( "onClientPedDamage", getRootElement(), nopedfs )
  14. Osea, el source no se pone, porque seria el "this" (fijate lo que significa en la wiki) del evento. function nopedfs ( ) if source == pedfs then cancelEvent() end end addEventHandler ( "onClientPedDamage", getRootElement(), nopedfs ) pedfs devuelve un elemento no un string .
  15. Edikosh998

    Lua OOP

    So, instead of doing this : function dxText:create( text, x, y, relative ) assert(not self.fX, "attempt to call method 'create' (a nil value)") if ( type(text) ~= "string" ) or ( not tonumber(x) ) or ( not tonumber(y) ) then outputDebugString ( "dxText:create - Bad argument", 0, 112, 112, 112 ) return false end local new = {} setmetatable( new, self) self.__index = self -- Here --Add default settings for i,v in pairs(defaults) do new[i] = v end idAssign = idAssign + 1 new.id = idPrefix..idAssign new.strText = text or new.strText new.fX = x or new.fX new.fY = y or new.fY if type(relative) == "boolean" then new.bRelativePosition = relative end visibleText[new] = true return new end He uses a separate metatable, right? EDIT : New mini-question. I was looking for your script ( bank system) : function Account:open( username, balance ) --local acc = executeSQLSelect( bankSQLInfo.tab, bankSQLInfo.username..", ".. bankSQLInfo.balance, bankSQLInfo.username.." = \"".. username.."\"", 1 ) local acc = getAccount( username ); if acc then return Account:new( username, tonumber( balance ) );-- Here its the same to put : -- return self; end return false end Sorry if I'm bothering with these questions.
  16. Yeaa, it works. Thanks you very much Castillo
  17. Edikosh998

    Anim GUI

    I was using the arc's anim library, for moving a window : function guiSetY(elem, y) -- Mover Y local curX, curY = guiGetPosition(elem, false) guiSetPosition(elem, curX, y, false) end animWindow = Animation.create(MainWindowLogin,{ from = screenY*4, to = screenY/2-200.5, time = 2000, fn = guiSetY }) Error > attempt to index global animation. I put the library into the script folder and then included to the meta.xml
  18. Edikosh998

    Lua OOP

    Now I've got a new doubt. I watched a resource (textLib) as example to understand OOP : dxText = {} dxText_mt = { __index = dxText } Which is the difference between that code and this code : dxText = {} dxText.__index = dxText
  19. Edikosh998

    Lua OOP

    I don't get why did you put a new table, is like a sub-class?
  20. Sese friki. Hay gente que gana 20 lucas por programar, y vos decis friki. Sos un capo chabon, anda tomate una birra.
  21. Edikosh998

    Lua OOP

    Man its not confusing, a very good explanation. Thanks you very much 50p. :) I asked because, I started to study with C#, and well I got how objects works, the problem was the syntax of objects at Lua, but I think that I understood it (Is really similar to C# ). Anyway, if I have any doubt, I will ask.
  22. Es una flasheada jaja... Osea declaran tanto a source y thePlayer, pero no entienden que cuando lo tienen que poner todavia. Usa o localPlayer si estas en client, y sino setias un timer a un comando, pero la verdad las ganas que le ponen...
  23. Edikosh998

    paradise

    Y bueno, usa el XAMMP y configura para que sea en localhost
  24. Edikosh998

    Lua OOP

    wow so useful EDIT : I was reading that link, when I got a doubt : function Account.withdraw (self, v) self.balance = self.balance - v end "self" is like the word "this" on C#? Second question : function Account:withdraw (v) This is like a inheritance property?
  25. function stopEventOnDamage() if getElementHealth( source) >= 900 then cancelEvent() end end addEventHandler("onVehicleDamage", getRootElement(), stopEventOnDamage) This?
×
×
  • Create New...