Jump to content

Patrick

Moderators
  • Posts

    1,141
  • Joined

  • Last visited

  • Days Won

    42

Everything posted by Patrick

  1. Welcome. Your thread has been moved to Portuguese section.
  2. This way works for me, to send data as JSON. function sendDiscordMessage(message) local data = { content = "Example:", username = "Webhook - Example", embeds = { { title = "Webhook - Example", description = "```Some user have typed \"help\" command.```", footer = { text = "I want to do this...", } } } } local jsonData = toJSON(data) jsonData = string.sub(jsonData, 3, #jsonData - 2) local sendOptions = { headers = { ["Content-Type"] = "application/json" }, postData = jsonData, } fetchRemote ( discordWebhookURL, sendOptions, WebhookCallback ) end
  3. Yeah, and there are some other problems. - author subtable's syntax is incorrect, you have to use = instead of : and put index names inside [ ] (or use them withouth " ") - fetchRemote's syntax is incorrect, a callback function is required Don't forget to use /debugscript 3 Here is a tutorial of how to send Discord messages trough webhook:
  4. Hi. local hasCharacter = tonumber(hasCharacter) local verificationQuery = dbQuery(db, "SELECT `hascharacter` FROM `accounts` WHERE `hascharacter` = '?'", hasCharacter) -- use argument binding, instead of string concatenation (it's always a better way) local verificationResult = dbPoll(verificationQuery, -1) local countOfResults = #verificationResult -- table length if countOfResults > 0 then --this is the line which I don't know how to use properly outputChatBox('Verification value is TRUE', thePlayer, 100, 255, 100) else outputChatBox('Verification value is FALSE', thePlayer, 255, 100, 100) end
  5. Welcome. Your thread has been moved to Portuguese section.
  6. Hi. There is a dedicated event for this: https://wiki.multitheftauto.com/wiki/OnClientProjectileCreation Event's first parameter is the creator who throws the projectile. Cancel effect This event cannot be cancelled. To remove the projectile you can use setElementPosition (some where far away) and then destroyElement (which makes it explode).
  7. Welcome! Your thread has been moved to Spanish section.
  8. Welcome! Your thread has been moved to Turkish section.
  9. Welcome. Your thread has been moved to Portuguese section.
  10. Wrong language, your thread has been moved to Portuguese section.
  11. Patrick

    Register Once

    Hi! I moved your thread to Scripting section, next time ask your scripting related questions here. You have to check "bRegisteredOnce[source] == true" before(!) calling addAccount. Should look like this: bRegisteredOnce = {} function registerPlayer(source, username, password ) if bRegisteredOnce[source] == true then outputChatBox("You already registered on this server!",source) else local accountAdded = addAccount(username, password) if (accountAdded) then triggerClientEvent (client, "createNotification", client, "#33aaccCogratuation #ffffffyour have account now .", "success") bRegisteredOnce[source] = true end end end addEvent("register", true) addEventHandler("register", root, registerPlayer) - Of course, this works until the next resource/server restart. Probably a better solution if you use getAccountsBySerial to check is there any associated account to player's serial. function registerPlayer(source, username, password ) local serial = getPlayerSerial(source) local serialAccounts = getAccountsBySerial(serial) if serialAccounts and #serialAccounts > 0 then outputChatBox("You already registered on this server!",source) else local accountAdded = addAccount(username, password) if (accountAdded) then triggerClientEvent (client, "createNotification", client, "#33aaccCogratuation #ffffffyour have account now .", "success") end end end addEvent("register", true) addEventHandler("register", root, registerPlayer)
  12. Welcome! I moved your thread to Portuguese section, please keep Portuguese posts there.
  13. Welcome! Scripting section is for scripting related questions, not for resource requests. I moved your thread to Resources section.
  14. getElementsByType-al lekéred a "player"-eket, majd végig loopolod a táblát amit kapsz és mindegyiknél megnézed hogy abban a dimenzióban van-e ami neked kell (getElementDimension). Ezeket a játékosokat meg kigyűjtheted egy külön táblába, vagy csak megszámolod őket.
  15. Hi. No, you can't use the old one, but as you can see on the page it's still under development. Please send me your file in private message, and I'll find out what is the problem and fix it. Thanks. (fixed)
  16. Wrong language, moved to Portuguese scripting.
  17. Your thread has been moved to Portuguese section.
  18. Is it a hardcoded default MTA message? If yes, probably the only way of you cancel the onClientChatMessage event. addEventHandler("onClientChatMessage", root, function(text) if text == "say: You are muted" then cancelEvent() end end)
  19. Try it with a little delay. local object = createObject(1265, 0,0,3) setTimer(setElementVelocity, 100, 1, object, 0,0,0)
  20. This is just a bug, the list does not appear completely over ~50 players. That's "normal". Also, this is not a scripting related question, I close your thread.
  21. Welcome. Your thread has been moved to Portuguese scripting section.
  22. Hi. Your thread has been moved to Resources section for better results.
  23. People who can't see the marker, can hit it? Try to check is marker visible for "thePlayer" first, with isElementVisibleTo.
×
×
  • Create New...