Jump to content

csiguusz

Members
  • Posts

    500
  • Joined

  • Last visited

Everything posted by csiguusz

  1. Hogy gyorsabb-e azt most nem tudom, majd csinálok pár tesztet, de mindenképpen rövidebb. Edit: megvolt a teszt. Szerintem hasonló kérést kaptam én is amúgy. Újrakezdhetjük megint, de akkor végre talán úgy kéne elkezdeni, hogy megfeleljen a céloknak. A collosion check-et te nem tudom hogy gondolod, de előbb azzal is lehetne kicsiben próbálkozni. Nekem volt egy töletem rá, az így, példákkal be is mutattam, de kiváncsi lennék arra, te hogyan képzeted azt. Aztán ha így kicsiben, egyszerű példákkal mennek a dolgok, be is lehet építeni az osztályokba. Skypon majd bejelöllek. TS-en tényleg nincs képernyőmegosztás, de beszédre szerintem sokkal alkalmasabb mint a Skype.
  2. Oops. Sorry, i forgot to remove a line... Copy my code again.
  3. getfenv function is also blocked, but you can use debug.getfenv instead.
  4. There are some problems with your script: You are trying to add a new event handler at every frame, but this should give you an error message in debugscript. Something like this doesn't have much sense: username = dxDrawRectangle(...) Dx drawing functions return a boolean (true/false) wich just indicates if tha drawing was successful or not. They don't return an element like the gui functions. Some other (general dx) optimization tips: Use local variables where possible, and avoid using/creating globals every frame. Avoid calculation of static values at every frame, use locals instead. This also makes things easier to change. Don't do something at every frame wich is enough to be done once. local isLoginVisible = false local WalkWay = dxCreateFont( "WalkWay.ttf" ) local sX, sY = guiGetScreenSize() local color1 = tocolor(85, 50, 205, 255) local color2 = tocolor(255, 255, 255, 255) local color3 = tocolor(31, 31, 31, 255) function LoginMain () dxDrawImage(0, 0, sX, sY, "images/bg.png", 0, 0, 0, color2, false) dxDrawRectangle(sX/6.5, sY/4, sX/3, sY/35, color1, true) dxDrawRectangle(sX/6.5, sY/3.6, sX/3, sY/3, color3, false) dxDrawText("Login Panel", sX/3.4, sY/3.95, sX/2, sY/2, color2, sX*0.0008, "default-bold", "left", "top", false, false, true, false, false) dxDrawText("Username", sX/6, sY/3.35, sX/2, sY/2, color2, sX*0.0006, "default-bold", "left", "top", false, false, true, false, false) dxDrawText("Password", sX/6, sY/2.615, sX/2, sY/2, color2, sX*0.0006, "default-bold", "left", "top", false, false, true, false, false) dxDrawRectangle(sX/6, sY/3.15, sX/6, sY/30, color2, false) dxDrawRectangle(sX/6, sY/2.50, sX/6, sY/30, color2, false) dxDrawRectangle(sX/1.7, sY/4, sX/4, sY/35, color1, true) dxDrawRectangle(sX/1.7, sY/3.6, sX/4, sY/3, color3, true) dxDrawText("Changelog", sX/1.45, sY/3.95, sX/2, sY/2, color2, sX*0.0008, "default-bold", "left", "top", false, false, true, false, false) end function toggle () if isLoginVisible then removeEventHandler("onClientRender", root, LoginMain ) else addEventHandler("onClientRender", root, LoginMain ) end isLoginVisible = not isLoginVisible showCursor ( isLoginVisible ) end addCommandHandler ( "t", toggle ) And finnaly, my way to test the performance of a drawing: function ptest() local start = getTickCount () for i = 1,30000 do LoginMain () end outputChatBox ( "t: " .. (getTickCount () - start) ) end addCommandHandler("pt", ptest ) This calculates how much time is needed to draw 30000 frames. ( wich would be normally be drawn over 12.5 minutes at a framerate of 40)
  5. csiguusz

    Events

    And the parachute resource has an "isPlayerParachuting" exported function.
  6. Do you mean something like this? local faded = false function fade ( player ) if faded then fadeCamera ( player, true ) else fadeCamera ( player, false, 1, 255, 0, 0 ) end faded = not faded end addEvent("fadeCamera", true) addEventHandler("fadeCamera", root, function () setTimer ( fade, 1000, 10, source ) end) You can play around with the numbers or even assign then timer to a variable and give it infinite repetions and then kill it when you want.
  7. Don't want to list all color codes... do it with a pattern: function connect ( name ) if name:find ( "#%x%x%x%x%x%x" ) then cancelEvent ( true, "no colorcodes!" ) end end addEventHandler ( "onPlayerConnect", root, connect )
  8. Why don't you search it on google, if nobody wants/can help you here? I did a search and it seems to be possible with innoDB engine. one, two
  9. A megbeszéléshez: most nézem, hogy a hangouts-hoz kel google+, abba én viszont nem vagyok hajlandó belépni, sajnálom. Azt kérném, hogy legközelebb ne ott akarjuk tartani.
  10. Ez aranyos volt. Tehát pont ugyanazt csinálja, mint a string.rep, csak itt a ismételendő stringet két paraméterként kapott stringből állítja össze: string.rep ( s1..s2, iter ). Az ultimate esszé jól hangzik, várom.
  11. Possibly it would work with a timer too, but a better way to make sure that one script file gets loaded before an other is to put it before the another file in the meta.xml.
  12. It should work, but if the key variable is defined in an another file this file must be loaded before the file wich contains the bindKey, and don't use local in that case.
  13. This is likely because you are not targeting anything with the type 'object'. Edit: great!
  14. This can happen, if the played dindn't target anything wich can be detected by this event. To avoid the error do one mor check: if isElement ( hitElement ) and getElementType(hitElement) == "object" then
  15. Én fönt voltam gmail-en kilenckor, de mivel más nem volt, ki is léptem kicsivel később. Akkor a kódhoz: open.lua utility / adstring.lua Egyéb A kódot átolvasva, ezek tűntek fel nekem főleg. Megbeszélés valóban nem fontos az íráshoz, csak az, hogy tudja az ember mit kell írni. Ezt nem tudom. Esetleg vmi fejlesztési terv, vagy csak annyi, hogy kéne egy ilyen meg egy ilyen dolog, ami azt fogja csinálni és akkor az meg is lesz.
  16. My solution is to run MTA in a lower resouliton and windowed mode, so I don't evet use alt+tab just click to the another window. But this migth not work, if your monitor has a rather low maximum resolution.
  17. A jövő héten akár délelőtt is ráérnék, ha az jobb valakinek, de nekem jelenleg megfelel az időpont.
  18. Try this. function getNicks(player, command, nick) local accounts = getAccounts () local result for i, v in ipairs ( accounts ) do local named = getAccountData ( v, "name" ) if named then if named == nick then local nameacc = getAccountPlayer(v) result = true if nameacc then local name = getPlayerName( nameacc ) outputChatBox("[Nick]: Player: ".. named ..", real nick: ".. name ..", account: ".. getAccountName ( v ) .."", player, 0,175,255, false) else outputChatBox("[Nick]: nobody is logged in with this account", player, 0,175,255, false) end break else --outputChatBox("[Nick]: no result", player, 0,175,255, false) end else --outputChatBox("[Nick]: this acc has no named!", player, 0,175,255, false) end end if not result then outputChatBox("[Nick]: no result", player, 0,175,255, false) end end addCommandHandler("getNick", getNicks)
  19. Always use "/debugscript 3" while testing, it would have told you the errors. You are using the tostring function wrong. It can make a string from anything so you will be able to output it as a text. But where you need an element, don't use tostring(v). (v is the account element)
  20. It's a good idea, and possibly the best way to do what you want. Store the player elements and their "real names" in a table and save it only when the resource stops. ( or even save it eg. every 10 minutes with a timer if you want to be sure that nothing will get lost ). Searching in that table would be easier. Your code looks good. It should work, I've just notived one problem: you can't output the "v" variable. use tostring(v) or getAccountName(v).
  21. There's an example of the loop: local accounts = getAccounts () for i, v in ipairs ( accounts ) do local name = getAccountData ( v, "name" ) -- do other things here... end Edit: replaced getElementData with getAccount data... sorry for the wrong function
×
×
  • Create New...