COOKIE2 Posted April 22, 2010 Share Posted April 22, 2010 i need help at roll5-6 the rest is just for now addCommandHandler("roll", function(player,comd) local roll = math.random(1,6) if roll == 1 then outputChatBox("u won", player) -- no player was specified, message'd be shown to all elseif roll == 2 then outputChatBox("u lost blablabla", player) elseif roll == 3 then setPlayerMuted(player, true) -- as i recall, "source" is not passed by command handler, use "player", but i may be wrong setTimer(setPlayerMuted, 30000, 1, player, false) -- what's more, setTimer parameters were messed up, 30000 executions with 1ms interval. elseif roll == 4 then outputChatBox("u win", player) elseif roll == 5 then givePlayerMoney(source,3500) elseif roll == 6 then takePlayerMoney(source,4500) end end ) Link to comment
Xierra Posted April 23, 2010 Share Posted April 23, 2010 Hmm, why not try this way? addCommandHandler("roll", function(player,comd) local roll = math.random(1,6) if roll == 1 then outputChatBox("u won", player) -- no player was specified, message'd be shown to all elseif roll == 2 then outputChatBox("u lost blablabla", player) elseif roll == 3 then setPlayerMuted(player, true) -- as i recall, "source" is not passed by command handler, use "player", but i may be wrong setTimer(setPlayerMuted, 30000, 1, player, false) -- what's more, setTimer parameters were messed up, 30000 executions with 1ms interval. elseif roll == 4 then outputChatBox("You win!", player) elseif roll == 5 then setPlayerMoney( source, +3500 ) --Add $3500 to the money you have. elseif roll == 6 then setPlayerMoney( source, -4500 ) --Reduce $4500 from the money amount you have. end end ) If this still doesn't work, try changing 5 and 6 to: elseif roll == 5 then setPlayerMoney(player, +3500) elseif roll== 6 then takePlayerMoney(player, -4500) The way to put codes is by: [lua]inside it is code, then end it with "/" in front of "lua" Link to comment
50p Posted April 23, 2010 Share Posted April 23, 2010 Use takePlayerMoney and givePlayerMoney. They are there for a reason. setPlayerMoney will set player's money; it will not add the amount you pass in 2nd parameter. If you'll takePlayerMoney with negative value, you may see weird money behaviour (either going way too high or down too low). @COOKIE2, LEARN LEARN LEARN... You don't have source in your function anywhere... You have player in function parameter list, why don't you use it, master-helper? Link to comment
Xierra Posted April 23, 2010 Share Posted April 23, 2010 Ow, so using setPlayerMoney by adding or decreasing it cause bugs right? So the: function(player,comd) is a function parameter (inside the bracket)? COOKIE doesn't have "source" on the parameter. Link to comment
Aibo Posted April 23, 2010 Share Posted April 23, 2010 why dont you stick with your previous topic? why dont you put code in lua tags? why dont you read comments in the code you're trying to edit? i commented that code about "player" instead of "source", if you'd bother to pay any attention to that your code would work and save people here from another cookie topic. addCommandHandler("roll", function(player,comd) local roll = math.random(1,6) if roll == 1 then outputChatBox("u won", player) elseif roll == 2 then outputChatBox("u lost blablabla", player) elseif roll == 3 then setPlayerMuted(player, true) -- as i recall, "source" is not passed by command handler, use "player", but i may be wrong setTimer(setPlayerMuted, 30000, 1, player, false) elseif roll == 4 then outputChatBox("You win!", player) elseif roll == 5 then givePlayerMoney(player, 3500) -- Add $3500 to the money you have. outputChatBox("You won $3500!", player) -- it's a good practice to inform player what happend to his cash, you know elseif roll == 6 then takePlayerMoney(player, 4500) -- Reduce $4500 from the money amount you have. outputChatBox("You lost $4500!", player) end end ) Link to comment
COOKIE2 Posted April 23, 2010 Author Share Posted April 23, 2010 xbost ty for all youre help i try to ask less question Link to comment
raulrobi Posted April 24, 2010 Share Posted April 24, 2010 STOP STEAHLING.I REPORT U TO MODERATOR Link to comment
Taalasmaa Posted April 24, 2010 Share Posted April 24, 2010 STOP STEAHLING.I REPORT U TO MODERATOR Raulrobi.... He's allowed to use these scripts.. You've posted them for a public.. But COOKIE12 should learn something by himself. Link to comment
raulrobi Posted April 24, 2010 Share Posted April 24, 2010 yeah but i post.he put it on notepad and he makes topic with that was maked and says It doesen't work Link to comment
COOKIE2 Posted April 24, 2010 Author Share Posted April 24, 2010 taalasmaa i agree i made 2 scripts yesterday 1: shows serial and ip when someone logs in 2: stats , it saves ur wins/deaths/cash Link to comment
karlis Posted April 24, 2010 Share Posted April 24, 2010 cookie no you didnt make anything, you ripped it off wiki... Link to comment
Taalasmaa Posted April 24, 2010 Share Posted April 24, 2010 cookie no you didnt make anything, you ripped it off wiki... Fail Link to comment
COOKIE2 Posted April 24, 2010 Author Share Posted April 24, 2010 (edited) OMFG STAY ON THE FUCKING TOPIC I DONT WANNA ARGUE ABOUT NOTHING where is a moderator if i need one Edited April 24, 2010 by Guest Link to comment
Taalasmaa Posted April 24, 2010 Share Posted April 24, 2010 dont make me prove im right and still complaining ! Link to comment
karlis Posted April 24, 2010 Share Posted April 24, 2010 o yeah? https://community.multitheftauto.com/index.php?p= ... includes=1 pwnt Link to comment
Taalasmaa Posted April 24, 2010 Share Posted April 24, 2010 o yeah?https://community.multitheftauto.com/index.php?p= ... includes=1 pwnt Script took from MTA Wiki, which is in that resource. Link to comment
karlis Posted April 24, 2010 Share Posted April 24, 2010 talasma are u arguing me?then you got it wrong, i said it to cookie Link to comment
Taalasmaa Posted April 24, 2010 Share Posted April 24, 2010 talasma are u arguing me?then you got it wrong, i said it to cookie Wut? Link to comment
Taalasmaa Posted April 24, 2010 Share Posted April 24, 2010 nevermind Oh, sorry i looked that COOKIE2 wrote that Sorry karlis. Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now