Jump to content

[TUT]Roll Script


GanJaRuleZ

Recommended Posts

Posted (edited)

How to make a roll script like in DDC , i bet that many of you wanted it :)

So lets stars

THIS SCRIPT ISN'T MINE!

  
restriction = {} --We will need to add restrictions 
  
addCommandHandler("roll", --We add a commandHandler here 
 function(thePlayer) --We start a new function 
  
 end  -- We end the function 
) -- We close the commandHandler 

After we will need to get the player

  
restriction = {} --We will need to add restrictions 
  
addCommandHandler("roll", --We add a commandHandler here 
 function(thePlayer) --We start a new function 
  local playerName = getPlayerName(thePlayer) -- We will get the player 
   if restriction[playerName] then -- We get , if the player has restricion to Roll else 
      outputChatBox("You have to wait 30 seconds", thePlayer, 255, 0, 0) -- We print in chat that he needs to wait 30 secs 
    else 
restriction[playerName] = true -- If he isnt restrictionated 
      setTimer(restrictionEnd, 30000, 1, playerName) -- 30 Secs to the restriction to end 
      randomroll = math.random(1, 3000) -- It writes a number between 1 and 3000 ( you can edit it ) 
      roller = math.random(1, 4) -- It writes a number between 1 and 4 ( not recomended to edit ) 
      if roller == 1 then -- If its 1 
        givePlayerMoney(thePlayer, randomroll) -- It gives the player money 
        outputChatBox(playerName .. ' roll and wins ' .. randomroll .. ' !', getRootElement(), 255, 255, 0) -- It writes in chat the win 
      elseif roller == 2 then -- If its 2 
        takePlayerMoney(thePlayer, randomroll) -- It takes the player money 
        outputChatBox(playerName .. ' roll and losses ' .. randomroll .. ' !', getRootElement(), 255, 255, 0) -- It writes in the chat the lose 
      elseif roller == 3 then -- If its 3 
        setPlayerMuted(thePlayer, true) --It mutes it 
        setTimer(setPlayerMuted, 30000, 1, thePlayer, false) -- We determine the time 
        outputChatBox(playerName .. ' roll and is now muted !', getRootElement(), 255, 255, 0) -- It writes in the chat the mute 
      elseif roller == 4 then -- If its 4 
        setSkyGradient(math.random(1, 255) ,math.random(1, 255) ,math.random(1, 255) ,math.random(1, 255) ,math.random(1, 255) ,math.random(1, 255)) -- Then it changes the sky colour 
        outputChatBox(playerName .. ' roll and is now changed the sky colour !', getRootElement(), 255, 255, 0) -- It writes the change in the chat 
      end -- End 
    end -- End 
 end  -- We end the function 
) -- We close the commandHandler 
  
function restrictionEnd(playerName)  
  restriction[playerName] = nil 
end  

Edited by Guest
Posted

1. I didn't wrote somewhere that that is my script.

2. I found it accidentaly on my friend's computer ( via TeamViewer ) , so i don't know to who to give the credits :)

@QuantumZ : That is to restrict the player to roll , 30000 = 30 sec , so he has to wait 30 secs to roll another time :)

@Solidsnake14: Yeah i forgot something , thx :)

Posted
1. I didn't wrote somewhere that that is my script.

2. I found it accidentaly on my friend's computer ( via TeamViewer ) , so i don't know to who to give the credits :)

yet you've decided to post it here as a tutorial?

good grief.

Posted
1. I didn't wrote somewhere that that is my script.

2. I found it accidentaly on my friend's computer ( via TeamViewer ) , so i don't know to who to give the credits :)

@QuantumZ : That is to restrict the player to roll , 30000 = 30 sec , so he has to wait 30 secs to roll another time :)

@Solidsnake14: Yeah i forgot something , thx :)

You didn't get my point above, i was highlighting the word in bold, I understood what function does.

Posted

I writed the --'s :)

But hopeless , i see that some guys , don't understand that i didn't claimed as my own , i don't know his name on this forum , that's why i don't put credits there , anyway if anyone wants to talk to him , just pm me :)

Posted

Stop fighting! We know this is not your script. Right?

Please next time teach with your own scripts, I'm learning and I can't learn on this way.

Posted
Stop fighting! We know this is not your script. Right?

Please next time teach with your own scripts, I'm learning and I can't learn on this way.

+1 , Finally someone ...

  • 1 year later...
  • Recently Browsing   0 members

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