|
Ilnair
|
 |
« on: June 16, 2006, 05:46:38 AM » |
|
And another nice script from me.
Difficulty: Newb: 2/5 Advanced Scripter: 0/5 Me/Unnown/Baron (:D): like -200/5 In short, very easy to use script.
It works like this, inside a casino, a player can buy Game Coins, and a Game Dice. If a player uses the dice, he will lose 1 game coin (or a few, it depends on what you want). After that, 2 dices will roll, and if the number rolled is higher than the number the computer rolled previously, you'll win 60% of all Game Coins players lost by rolling the dice. If he loses, his coin will be gone, and someone else can try it.
Anyway, here it goes.
Step 1: Create a game dice. Make it a scripted item, and make it run script X (ie: 1 or 2).
Step 2: Find Sub ScriptedItem, and add the following below End Select: Case X Call CasinoDiceGame(index) Exit Sub And replace X by the number you used. If you can not find Sub ScriptedItem, please enter this at the bottom of you main:
Sub ScriptedItem(index, Script) Select Case Script Case X Call CasinoDiceGame(index) Exit Sub End Select End Sub And once again, replace X by the number you used.
Step 3: enter the following script at the bottom of your main, and replace cost=int(1) by the number of coins you want gambling to cost, and replace Int(83) by the item number of your game coins:
'**************************************************************** 'Dice Script, ©Dinand Mentink - ILNAIR!!!!! '****************************************************************
Sub CasinoDiceGame(index) Dim diceroll1 Dim diceroll2 Dim diceroll Dim prevroll Dim item Dim itemvalue Dim itemslot Dim jackpot Dim cost Dim prevroller
cost = Int(1) item = Int(83) itemslot = Int(GetPlayerInvItemSlot(index, item))
If itemslot = 0 Then Call PlayerMsg(index, "You do not have any Game Coins!", 12) Exit Sub End If
itemvalue = Int(GetPlayerInvItemValue(index, itemslot))
If itemvalue < cost Then Call PlayerMsg(index, "You do not have enough Game Coins to play!", 12) Exit Sub Else prevroller = GetVar("vars.ini", "Dice", "prevroller") If prevroller = GetPlayerName(index) Then Call PlayerMsg(index, "Give someone else a chance!", 12) Exit Sub End If Call PutVar("vars.ini", "Dice", "prevroller", GetPlayerName(index))
prevroll = Int(GetVar("vars.ini", "Dice", "prevroll")) jackpot = Int(GetVar("vars.ini", "Dice", "jackpot")) diceroll1 = Int((6 - 1 + 1) * Rnd) + 1 diceroll2 = Int((6 - 1 + 1) * Rnd) + 1 diceroll = Int(diceroll1 + diceroll2)
If diceroll > prevroll Then Call GlobalMsg(GetPlayerName(index) & " rolls the powerdice and" & " rolls a " & diceroll1 & " and a " & diceroll2 & "! This is " & diceroll & " in total and wins!", 10) Else Call GlobalMsg(GetPlayerName(index) & " rolls the powerdice and" & " rolls a " & diceroll1 & " and a " & diceroll2 & "! This is " & diceroll & " in total and loses!", 12) jackpot = Int(jackpot + cost) Call PutVar("vars.ini", "Dice", "jackpot", "" & jackpot) Call GlobalMsg("The jackpot is " & Int(jackpot * 0.6) + 1 & " Game Coins for a " & prevroll + 1 & "!", 14) If itemvalue = cost Then Call SetPlayerInvItemNum(index, itemslot, 0) Call SetPlayerInvItemValue(index, itemslot, 0) Call SendInventoryUpdate(index, itemslot) Else Call SetPlayerInvItemValue(index, itemslot, itemvalue - cost) Call SendInventoryUpdate(index, itemslot) End If
Exit Sub End If
itemslot = GetPlayerInvItemSlot(index, item)
If itemslot = 0 Then itemslot = GetPlayerInvItemSlot(index, item) Call SetPlayerInvItemNum(index, itemslot, item) Call SetPlayerInvItemValue(index, itemslot, Int(jackpot * 0.6) + 1) Call SendInventoryUpdate(index, itemslot) Else Call SetPlayerInvItemValue(index, itemslot, itemvalue + Int(jackpot * 0.6)) Call SendInventoryUpdate(index, itemslot) End If
prevroll = Int((11 - 5 + 1) * Rnd) + 5 Call PutVar("vars.ini", "Dice", "prevroll", "" & prevroll) jackpot = Int((3 - 1 + 1) * Rnd) + 1 Call PutVar("vars.ini", "Dice", "jackpot", "" & jackpot) Call GlobalMsg("The jackpot is " & Int(jackpot * 0.6) + 1 & " Game Coins for a " & prevroll + 1 & "!", 14)
End If
End SUb
'**************************************************************** 'End of Dice Script!, ©Dinand Mentink - ILNAIR!!!!! '**************************************************************** Step 4: create a .ini file called vars.ini, and put the following in it:
[Dice] jackpot=1 prevroll=6 prevroller=Ilnair
|