Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 05/12/16 in all areas

  1. Mother of indentation.. press "Tab" once a while. http://pastebin.com/Y9ri2wxi
    2 points
  2. I have released a self-hosted Discord relay some time ago, but didn't bother posting here or adding documentation. @specahawk, you can tell me to remove this post if you don't want to have this advertising in your thread. Anyway, the code is on GitHub (Necktrox/mta-discord-bot) and it's being used by Mr.Green, one unknown guy and my clan's server. It doesn't support any commands, but the implementation is up to you (the bot recognizes commands with dot (.) prefix). It's running perfectly stable for months.
    2 points
  3. My PC freezed so i wasted a lot of time, but the error occurred when i replaced the constant strings ("logVal" and "passVal") with the js: document.getElementById("login").value (added also the divs) EDIT: so you solved the issue double id... didn't noticed but i was near so i had no fun resolving this. i hate you. lol
    1 point
  4. @pa3ck @LoPollo Thanks for all your help guys i really appreciate that! And the problem was in here : <div class="sign-in-htm"> <div class="group"> <label for="user" class="label">اسم المستخدم</label> <input id="user" type="text" class="input" id="login"> </div> <div class="group"> <label for="pass" class="label">كلمة المرور</label> <input id="pass" type="password" class="input" data-type="password" id="password"> </div> it should be : <div class="sign-in-htm"> <div class="group"> <label for="user" class="label">اسم المستخدم</label> <input id="aLogin" type="text" class="input"> </div> <div class="group"> <label for="pass" class="label">كلمة المرور</label> <input id="aPass" type="password" class="input" data-type="password" > </div> I dont know how did i do that but maybe i'm sleepy now it works and i'm going to complete my project tomorrow thanks to you guys again!
    1 point
  5. اخوي انت مفكر ان اذا رديت ع المواضيع بكذا بكون متابع القسم ؟ ,, غلطان ترا متابعين ولكن بصمت وماله داعي اقفل الموضوع يمكن بعد فتره بسيطه من الوقت يواجه احد اعضاء المنتدي نفس المشكلة وبكذا بيفتح موضوع جديد فـ انا اترك الموضوع مفتوح حتي وإن تمت الافاده
    1 point
  6. I (over)simplified your code @iPrestege, and this is working: <html> <head> <meta charset="UTF-8"> <title>MTA Arabs Login</title> <script> function aCall(command){ var login = "logVal"; var password = "passVal"; mta.triggerEvent("aOnCallMtaEvent", login, password, command); } </script> <link rel='stylesheet prefetch' href='http://fonts.googleapis.com/css?family=Open+Sans:600'> <link rel="stylesheet" href="css/style.css"> </head> <body> <div class="login-form"> <div class="group"> <input type="submit" class="button" value="Press me, i'm a button" onclick=aCall("login")> </div> </div> </body> </html> function aHTML ( login,password,command ) outputChatBox( login.." "..password.." "..command ) end addEvent("aOnCallMtaEvent", true) addEventHandler("aOnCallMtaEvent", root, aHTML) local screenWidth, screenHeight = guiGetScreenSize() local page = "http://mta/"..getResourceName( resource ).."/index.html" local initBrowser = guiCreateBrowser(screenWidth/4, screenHeight/4, screenWidth/2, screenHeight/2, true, false, false) local theBrowser = guiGetBrowser(initBrowser) addEventHandler("onClientBrowserCreated", theBrowser, function() loadBrowserURL(source, page) showCursor(true) end ) When i press the button i get the 3 values i requested. Now i'm going to add your other code till problem happens
    1 point
  7. Read what I said about JavaScript, HTML doesn't really care about the tags, it won't throw errors or anything, that couldn't be the problem.
    1 point
  8. Because in JavaScript, you have to put ";" after the lines, but you clearly didn't. What I suggest you is, test everything in your browser using Google Chrome Dev tools and the console should point out errors like that. Also, what LoPollo said, pay attention to the default HTML layout, <html><head></head><body></body></html> etc... EDIT: I don't know if you know it already, but you also have to include all the files in the meta.xml, including JS files and CSS.
    1 point
  9. I'm going to do tests... but html has no body tag?
    1 point
  10. Seriously, guys . You were asked about the exact methods you are going to use FLA. I guess developers need to understand how exactly they should implement it. It's not yes/no voting.
    1 point
  11. I think than an example may give an idea. This is the serverside. IT'S ONLY AN EXAMPLE; PLUS IT'S UNTESTED. THERE MAY BE ERRORS AND MISSING THINGS local playersVotes = {} --playersVotes.player = 1 or 2 (see below) or whatever, event true, false and nil can be used local poll = {} --poll.question, poll.answers[1 or 2 or some index, up to you] (poll.answers is a table) addEvent( "onClientVote", true ) --when clients make vote, they will trigger this event --! --! @brief Starts a poll. --! --! @param playerSource The player who started the poll, the one who typed /k q; a1; a2(;) --! @param cmd The command --! --! @return None. But it will let players know that a poll is started using onPollStart --! function startPoll( playerSource, cmd, ... ) --infos about ... and arg are available here: https://www.lua.org/pil/5.2.html if poll.question ~= nil then --or poll ~= {}, or similar. Make sure every poll request while a poll is ongoing is ignored local splitSeparator = "; " local argTable = split( table.concat(arg," "), splitSeparator) --recreate the full line with concat, then separate question from the 2 answers using split if #argTable < 3 then outputChatBox("Not enough arguments supplied") else --unpack can also be used if you want. Fill the poll infos poll.question = argTable[1] poll.answers = { argTable[2], argTable[3] } triggerClientEvent( root, "onPollStart", resourceRoot, poll.question, poll.answers ) --Clients! The poll is started! poll.timer = setTimer( endPoll, 30*1000, 1 ) --end the poll end else outputChatBox( "A poll is already ongoing!", playerSource, 255, 0, 0 ) --yes client, you got ignored :P end end addCommandHandler( "k", startPoll ) --! --! @brief Triggered from clients when they vote. --! --! @param theVotedAnswer The index of the answer the client has chose --! --! @return None. But will trigger onVoteUpdate to let players know the vote each answer has after each vote is made --! function handleClientVote(theVotedAnswer) --pass the index of the answer, you can pass nil to remove the vote local thePlayer = client --easier to read lol, everyone has its own style playersVotes.thePlayer = theVotedAnswer --keep track of the vote triggerClientEvent( root, "onVoteUpdate", resourceRoot, countVotes() ) --count them and let the players know the count end addEventHandler( "onClientVote", root, handleClientVote ) --! --! @brief Counts the number of votes each answer has. --! --! @return A table: [1] number of votes for first answer, [2] number of votes for second answer. --! function countVotes() local votesCount = {} for thePlayerWhoVoted,theVotedAnswer in pairs(playersVotes) do --assuming theVotedAnswer is the index 1 or 2, as Descrition says votesCount[theVotedAnswer] = votesCount[theVotedAnswer] + 1 --sum all votes end return votesCount end --! --! @brief Called when a poll ends. Reset to default the variables --! --! @return None. But triggers onPollEnd to the clients, informing them about the results --! function endPoll() --Here players will get the gui hidden/disabled/whatever you need. Makes them unable to vote. --Also inform them with the result of the poll. Remember that's a table with 1 and 2 as index triggerClientEvent( root, "onVoteUpdate", resourceRoot, countVotes() ) triggerClientEvent( root, "onPollEnd", resourceRoot ) poll = {} playersVotes = {} end -- --In clientside, you must implement: --onPollStart -> show the gui --onVoteUpdate -> update votes, so players know how poll is going and which answer is "winning" --onPollEnd -> disable the gui, players MUST NOT vote anymore. Hide completely the gui after some time if you decide only to disable it to let the results be shown there -- I tried to explain as much as i could, let me know if you have doubts or questions. If you want to work on the already existing script, we're still here. If you want to rewrite it, this can help you with the start.
    1 point
  12. 1 point
  13. المايك ماتقدر تسجل صوته لكن... تقدر اذا كانت لك خبرة عالية نسبياً لانها تحتاج متصفحات وجافسكربت واتش ام ال بما ان ام تي ايه اضافت المتصفحات تقدر تسفيد منها مثلا اقرا الاقتباس هذا طبعا تقدر تسفيد من امكانيات المكتبة وتسجل الصوت الطريقة انك تسوي متصفح وتحط فيه صفحة تسجيل الصوت( اذا كان متصفح اللعبة نفسه يدعم تسجيل الصوت ) وبعدين تحفظه لكن الحفظ مو امن نسبيا تقدر تشفره وتحفظه وتفك تشفيره وهذي الية العمل اعرف انك راح تقول صعبة وماتقدر تسوي
    1 point
  14. addCommandHandler("k", function(_,...) if #arg < 3 then outputChatBox("Not enough arguments supplied") else local q,a1,a2 = unpack(split(table.concat(arg," ",2),",")) outputChatBox("Question: "..q) outputChatBox("Answer 1: "..a1) outputChatBox("Answer 2: "..a2) end end ,false,false) Usage: /k Is this a question?, Yes it is, No it's not
    1 point
  15. Вы используете не ту функцию, dbExec не возвращает результат в виде таблицы, она только делает запрос. Чтобы получить значения полей используйте функции dbQuery + dbPoll. Я советую почитать вот эти уроки, чтобы понимать как работать с MySQL/SQLite в MTA:
    1 point
  16. root = وجودها زي عدمها بالفنكشن , ومو الكل بيشوف الكلام
    1 point
×
×
  • Create New...