Jump to content

what did i do wrong


Recommended Posts

Posted (edited)

i tried it and it doesnt give error but when i do /roll nothing happens :roll:

addCommandHandler("roll",
function(player,comd)
   randomroll = math.random(1, 3000)
   lossorwin = math.random(1, 3)
if lossorwin == 1 then
givePlayerMoney(player, 3500)
outputChatBox ( ' .. getPlayerName ( thePlayer ) .. ' roll and wins ' .. randomroll .. ' !', getRootElement(), 255, 255, 0)
    elseif lossorwin == 2 then
      takePlayerMoney(player, 3252)
      outputChatBox ( ' .. getPlayerName ( thePlayer ) .. ' roll and losses ' .. randomroll .. ' !', getRootElement(), 255, 255, 0)
elseif lossorwin == 3 then
setPlayerMuted(player, true)
setTimer(setPlayerMuted, 30000, 1, player, false)   
end
end
)

Edited by Guest
Posted

Look at the code again. You're messing up the strings in outputChatBox. And use debugscript.

Do NOT PM ME for help unless invited. - New MTA Script Editor

Scripting help "etiquette": understandable language, relevant code (ALL code if unsure), [Lua] tags, error messages with line numbers. Super simple stuff.

Posted

The fact that even the syntax highlighting in your code above is broken is a good sign you've done something wrong.

Posted

look at the lines 8-10 .. its all red.. something MUST be wrong then :P happy finding

Multi theft auto tools - replace cars and peds, move your map or compile your Lua files online!

programista php rzeszów

Need free webhosting for your small site? PM me. Need help with portforwarding? PM me. Do not PM me asking for help with scripting.

Having problems with port forwarding? Send me pm, I can do whole thing for you using TeamViewer (already helped about 20 people, no worries)!

Posted
addCommandHandler("roll",
function(player,comd)
   randomroll = math.random(1, 3000)
   lossorwin = math.random(1, 3)
if lossorwin == 1 then
givePlayerMoney(player, 3500)
outputChatBox ( getPlayerName ( thePlayer ) .. ' roll and wins ' .. randomroll .. ' !', getRootElement(), 255, 255, 0)
elseif lossorwin == 2 then
takePlayerMoney(player, 3252)
outputChatBox (  getPlayerName ( thePlayer ) .. ' roll and losses ' .. randomroll .. ' !', getRootElement(), 255, 255, 0)
elseif lossorwin == 3 then
setPlayerMuted(player, true)
setTimer(setPlayerMuted, 30000, 1, player, false)   
end
end
)

Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...