Jump to content

csiguusz

Members
  • Posts

    500
  • Joined

  • Last visited

Everything posted by csiguusz

  1. Sorry, there was a typo. Copy my code again. Edit: Ah, thanks Krzo, you were faster.
  2. Read: https://wiki.multitheftauto.com/wiki/OnPlayerChat There's a small example: addEventHandler ( "onPlayerChat", root, function ( msg, msgType ) if msgType == 1 then cancelEvent () -- cancel default /me -- then you can handle the message as you want end end )
  3. function containsNumber ( str ) if str:find ( "%d" ) then return true end return false end
  4. Yes, every player can have his own table with his own datas of any kind. local data = {} addEventHandler ( "onPlayerJoin", root, function () data [ source ] = {} end ) function setThings ( player ) data[ player ].vehicle = createVehicle ( ... ) data[ player ].timer1 = setTimer ( ... ) data[ player ].timer2 = setTimer ( ...) data[ player ].likes = "Trains" end addEventHandler ( "onPlayerQuit", root, function () data [ source ] = nil -- don't forget to clear a player's data after quitting to save memory and even kill his timers if needed end )
  5. Store the timers in a table for example. local timers = {} function doSomething ( player ) if isTimer ( timers[ player ] ) then killTimer ( timers[ player ] ) end timers[ player ] = setTimer ( ... ) end
  6. Örülök, hogy sikerült. Nincsmit.
  7. Ha esetleg nem a legfrissebb admin lenne fönt szerveren, innen letöltheted a legfrissebb resource csomagot, aből frissítheted az admint, hogy biztos legyen, hogy nem a szkripttel van a gond: https://mirror.multitheftauto.com/mtasa/resources/ És ha nem azzal van a gond akkor az ACL problémán kívűl más nem jut eszembe. Ellenőrizd, hogy a Console ACL csoportjában ott van-e a "command.unmute". Ha nem találod a hibát beteheted ide is az acl.xml-ed, megnézem én is vagy akár privátban is küldheted, ha nem akarod, hogy mindenki lássa.
  8. Ez is valami. Most nem vagyok gépnél, de később ránézek mi okozhat ilyen hibát. Edit: Megnéztem, az a hibaüzenet azért elég ritka esetekben állhat elő (Például ha valaki bejelentkezik, megnyitja a panelt, kijelentkezik, majd megpróbál csinálni valamit ). De az unmute-nak mennie kéne alapból. Az ACL-ben nem állítgattál dolgokat? A Console-nak megvannak a jogai? A next map-os dologhoz meg: hozzá kell adni a "Moderator" csoportot is a race modhoz, hogy neki is engedélyezve legyen az. A race meta.xml-jében vagy admin panel, resources fül, listából race-t kikeres, settings és ott van valami olyasmi, hogy admingroups. Na oda kell hozzáírni a Moderatort.
  9. Lehetne, hogy nem ilyen színnel írsz? Bántja a szememet. Alap adminpanelt használsz? Érdemes nézni a hibaüzeneteket, mikor unmute-olnia kéne. (/debugscript 3). Lehet ACL probléma pl., tehát hogy a szkriptnek nincs joga az unmute-hoz. Ugyanígy érdemes megnézni, hogy van-e hibaüzenet a Nex Map gombra való kattintáskor és akkor lenne mi alapján elindulni.
  10. Pedig csak a warpPedIntoVehicle függvénnyel lehet betenni egy pedet egy autóba... Itt egy egyszerű szerveroldali példa, hogy működik az. A /ped parancsra letesz egy pedet és ha beszállsz egy kocsiba melléd rakja, ha kiszállsz kiszedi. local ped local owner function create ( player ) if not ped then local x, y, z = getElementPosition ( player ) owner = player ped = createPed ( 123, x + 3, y, z ) addEventHandler ( "onVehicleEnter", root, function ( p ) if p == owner then warpPedIntoVehicle ( ped, source, 1 ) end end) addEventHandler ( "onVehicleExit", root, function ( p ) if p == owner then removePedFromVehicle ( ped ) end end) end end addCommandHandler ( "ped", create )
  11. csiguusz

    ChatMsg

    Yes, much cleaner and better now.
  12. csiguusz

    URGENT!

    You can change the ports in the mtaserver.conf file.
  13. csiguusz

    ChatMsg

    Sorry, just won the challenge by my edit. No offense.
  14. csiguusz

    ChatMsg

    Mine would work perfectly except for that extra output, but I've corrected that. Yours wouldn't work at all. So there are different between mistakes, but I admit, that I also made a small one. Oh, and there wouldn't be any extra number at the output, since the number of the arguments isn't an indexed part of the table but it has a name 'n', and table.concat concatenate only indexed values.
  15. csiguusz

    ChatMsg

    Have you tried it? arg == { ... } Edit: I've read after, just for you. I forgot that the hidden variable 'arg' has an extra value, wich is the number of the arguments passed to the function. So using that maybe wasn't a good idea, there might be an extra number at the output.
  16. csiguusz

    ChatMsg

    Try this: function writetoID( player, command, id, ... ) local plName = getElementByID ( 'ID' .. tostring(id) ) if plName == nil then outputChatBox ("??? ?????? ??? ???? ID.", player ) else local myName = tostring(getPlayerName(plName)) local r,g,b = getPlayerNametagColor(plName) local rn = string.format("#%02X%02X%02X", r,g,b) local text = table.concat ( { ... }, " " ) source = player sendMSG( rn..''..myName..'#ffffff, ' ..text, 0 ) end end addCommandHandler( 'n', writetoID ) Edit: @tosfera: that won't work, text is not a table but a string, and every word is passed as a different argument to the handler function of the command, to catch all these arguments, you have to use '...' (three dots).
  17. Az úgy jó, hogy nullára állítod az id-t, vagy akár ki is veszed azt a sort, de a client.lua-ban van a támadós rész. Valami ilyesmi talán megfelel (a client.lua tartalmát cseréld ezzel): http://pastebin.com/5TTmukJL
  18. csiguusz

    back loop

    You are welcome. At this third parameter you can use any number you want, even negative ones.
  19. csiguusz

    back loop

    Use: for i=4, 1, -1 do outputChatBox(i) end
  20. What is confusing about it? myTable[1] will return the value of myTable at index 1. If it is 'true', then it will return true. But tables can be changed easly! For example, if you don't want to allow players to use the same skinf you could use something like this: local skins = {} function setSkin ( player, skinID ) if skins [ skinID ] then outputChatBox ( "This skin is already in use!" ) else skins [ getElementModel ( player ) ] = false -- mark old skin as unused skins [ skinID ] = true -- mark new skin as used setElementModel ( player, skinID ) end end -- note: this is just an example, not a really useful and perfect script And you can extend it by adding options to it by using tables. A hardcoded "if true then" can't be changed by a script but a table value can be (or even manually by editing the file), so this is the difference between "if true then" and "if myTable[1] then" local skins = {} local options = { [ "skinChange" ] = false } function setSkin ( player, skinID ) if options.skinChange then -- or options["skinChange"], but using . (dot) is a bit more efficient if skins [ skinID ] then outputChatBox ( "This skin is already in use!", player ) else skins [ getElementModel ( player ) ] = false -- mark old skin as unused skins [ skinID ] = true -- mark new skin as used setElementModel ( player, skinID ) end else outputChatBox ( "Sorry, changing skin is not allowed!", player ) end end -- note: this is just an example, not a really useful and perfect script
  21. getResources ipairs getResourceState And the file functions if you want to write the result to a file.
  22. name1 = "Sam ß Winchester" --==> Wrong! name2 = "Sam% Wichester" --==> Wrong! name3 = "Sám Wínchestér" --==> Wrong! name4 = "Sam Winchester" --==> Ok! name4 = "Robert J Thommas" --==> Ok! function isValid ( name ) name = name:upper () for char in name:gmatch ( "." ) do local code = char:byte () if (code < 65 or code > 90) and code ~= 32 then return false end end return true end outputChatBox ( tostring ( isValid ( name1 ) ) ) outputChatBox ( tostring ( isValid ( name2 ) ) ) outputChatBox ( tostring ( isValid ( name3 ) ) ) outputChatBox ( tostring ( isValid ( name4 ) ) )
  23. csiguusz

    Clear Table

    myTable = {} is the same as myTable = nil. The garbage collector at the next cycle will clear the memory used by the table in both cases. The only difference is that if you used nil, and want to use the variable again as a table you have to declare it again like myTable = {}.
  24. Table values can't be local. It's enough if you define the table as local.
×
×
  • Create New...