Jump to content

Search the Community

Showing results for tags 'nil'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Multi Theft Auto: San Andreas 1.x
    • Support for MTA:SA 1.x
    • User Guides
    • Open Source Contributors
    • Suggestions
    • Ban appeals
  • General MTA
    • News
    • Media
    • Site/Forum/Discord/Mantis/Wiki related
    • MTA Chat
    • Other languages
  • MTA Community
    • Scripting
    • Maps
    • Resources
    • Other Creations & GTA modding
    • Competitive gameplay
    • Servers
  • Other
    • General
    • Multi Theft Auto 0.5r2
    • Third party GTA mods
  • Archive
    • Archived Items
    • Trash

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Member Title


Gang


Location


Occupation


Interests

Found 4 results

  1. Hello! I ran into some problems while coding: Server: function VoteSystem(title) outputChatBox ("Your Vote Title: " .. title, client) end addEvent("VoteConnection", true) addEventHandler("VoteConnection", resourceRoot, VoteSystem) Client: sx, sy = guiGetScreenSize() ClientGUI = {} function VoteCommand (commandName, ...) local title = table.concat ( { ... }," " ) TextDraw = tostring(title) triggerServerEvent ( "VoteConnection", resourceRoot, tostring(title) ) outputChatBox(title) end addCommandHandler ( "vote", VoteCommand ) --ClientGUI[3] = guiCreateStaticImage( sx*0.03, sy*0.03, sx*0.5, sy*0.5, "/files/BG.png", false ) guiMoveToBack(ClientGUI[3]) addEventHandler("onClientRender", root, function() ClientGUI[2] = dxDrawRectangle(sx*0.2, sy*0.3, sx*0.6, sy*0.5, tocolor(0,0,0,150)) ClientGUI[1] = dxDrawText(TextDraw, sx*0.21, sy*0.31, sx, sy, tocolor(255,0,0,255), 2) end) After running the code and entering /debugscript 3, the following error appears: WARNING: vote\votes_c.lua:17: Bad argument @'dxDrawText' [Expected string at argument 1, got nil] [DUP x213] WARNING: vote\votes_c.lua:17: Bad argument @'dxDrawText' [Expected string at argument 1, got nil] WARNING: vote\votes_c.lua:17: Bad argument @'dxDrawText' [Expected string at argument 1, got nil] [DUP x214] WARNING: vote\votes_c.lua:17: Bad argument @'dxDrawText' [Expected string at argument 1, got nil] WARNING: vote\votes_c.lua:17: Bad argument @'dxDrawText' [Expected string at argument 1, got nil] [DUP x215] WARNING: vote\votes_c.lua:17: Bad argument @'dxDrawText' [Expected string at argument 1, got nil] WARNING: vote\votes_c.lua:17: Bad argument @'dxDrawText' [Expected string at argument 1, got nil] [DUP x213] WARNING: vote\votes_c.lua:17: Bad argument @'dxDrawText' [Expected string at argument 1, got nil] WARNING: vote\votes_c.lua:17: Bad argument @'dxDrawText' [Expected string at argument 1, got nil] [DUP x212] WARNING: vote\votes_c.lua:17: Bad argument @'dxDrawText' [Expected string at argument 1, got nil] WARNING: vote\votes_c.lua:17: Bad argument @'dxDrawText' [Expected string at argument 1, got nil] [DUP x79] WARNING: vote\votes_c.lua:17: Bad argument @'dxDrawText' [Expected string at argument 1, got nil] WARNING: vote\votes_c.lua:17: Bad argument @'dxDrawText' [Expected string at argument 1, got nil] [DUP x71] WARNING: vote\votes_c.lua:17: Bad argument @'dxDrawText' [Expected string at argument 1, got nil] WARNING: vote\votes_c.lua:17: Bad argument @'dxDrawText' [Expected string at argument 1, got nil] [DUP x87] WARNING: vote\votes_c.lua:17: Bad argument @'dxDrawText' [Expected string at argument 1, got nil] But the code works and by writing /vote [text], the text [text] is entered into dxDrawText How do I fix the error? The second problem: In the client file: sx, sy = guiGetScreenSize() ClientGUI = {} --General function VoteCommand (commandName, ...) local title = table.concat ( { ... }," " ) TextDraw = tostring(title) triggerServerEvent ( "VoteConnection", resourceRoot, tostring(title) ) outputChatBox(title) end addCommandHandler ( "vote", VoteCommand ) ClientGUI[3] = guiCreateStaticImage( sx*0.03, sy*0.03, sx*0.5, sy*0.5, "/files/BG.png", false ) -- Image Background guiMoveToBack(ClientGUI[3]) addEventHandler("onClientRender", root, function() ClientGUI[2] = dxDrawRectangle(sx*0.2, sy*0.3, sx*0.6, sy*0.5, tocolor(0,0,0,150)) ClientGUI[1] = dxDrawText(TextDraw, sx*0.21, sy*0.31, sx, sy, tocolor(255,0,0,255), 2) -- Title end) --General ENDho How do I put " ClientGUI[3] = guiCreateStaticImage( sx*0.03, sy*0.03, sx*0.5, sy*0.5, "/files/BG.png", false )" under "ClientGUI[1] = dxDrawText(TextDraw, sx*0.21, sy*0.31, sx, sy, tocolor(255,0,0,255), 2)" ?
  2. Attempt to do arithmetic on a nil value. And the code is: --Here you have the tables playersT = {"VaporZ"} moneyT = {"100"} addCommandHandler("deposit", function(player, commandName, amount) --Here is our "nil" value (I often use "100" for "amount", when I have $12,000) for k, v in ipairs(playersT) do if(string.match(playersT[k], getPlayerName(player))) then if amount and (tonumber(amount) <= getPlayerMoney(player)) then local i = table.find(players, getPlayerName(player)) local am = tonumber(amount) --Setting "am" as "amount", but changed into number takePlayerMoney(player, am) --Here's everyting ok moneyToLow = tonumber(moneyT[i]) - am --But here is a problem with "am" IDK why ("Attempt to do arithmetic on a nil value") moneyT[i] = tostring(moneyToLow) outputChatBox ("#09ff00Transfered into bank account #ffffff$" .. amount .. "#09ff00!", player, 255, 255, 255, true) end elseif(not string.match(playersT[k], getPlayerName(player))) then local size = table.size(playersT) local i = size + 1 playersT[i] = getPlayerName(player) moneyT[i] = amount takePlayerMoney(player, tonumber(amount)) outputChatBox ("#09ff00Transfered to bank account #ffffff$" .. amount .. "#09ff00!", player, 255, 255, 255, true) end end end) I will say only one thing - What The *F word here*?! Help!
  3. O problema é que quando um dos valores é nil a mensagem não é enviada. function soma(thePlayer, commandName, um, dois) local num1 = tonumber(um) local num2 = tonumber(dois) local resultado = um + dois if commandName then if (num1 and num2) >= 0 then outputChatBox("A soma entre "..num1.. "e "..num2.." é igual a "..resultado..".", thePlayer, 255,255,255, true) elseif (num1 or num2) == nil then outputChatBox("Você precisa digitar os dois números para fazer a conta.", thePlayer) end end end addCommandHandler("somar", soma)
  4. The connection is okay but dbQuery and dbPoll first argument got nil. ( sorry for my bad english ) ERROR: MYSQL CONNECTION CODE: "felhasznalo" SCRIPT:
×
×
  • Create New...