JayT Posted August 15, 2009 Author Share Posted August 15, 2009 hey im making a lottery/chest script but my on click sub dont seem to be working when i click the chest :huh:```' Executes when a player clicks on an OnClick tile.Sub OnClick(Index, Script) Dim Amount Dim High Dim Low Low = 2 High = 50 Amount = Rand(Low, High) Select Case Script Case 0 Call PlayerMsg(Index, "No Use", WHITE) Case 1 Call PlayerMsg(Index, "No Use", WHITE) Case 2 If GetVar("Accounts\" & GetPlayerLogin(Index) & "\" & GetPlayerName(Index) & ".ini", "LOTTERY", "STATUS") = 1 Then Call GiveItem(Index, Amount, 1) Call PlayerMsg(Index, "Congratulations you have used a Lottery Point!", WHITE) Call PutVar("Accounts\" & GetPlayerLogin(Index) & "\" & GetPlayerName(Index) & ".ini", "LOTTERY", "STATUS", 0) Else Call PlayerMsg(Index, "You dont have a Lottery Point, you can obtain one from Mr Lucky!" BRIGHTRED) End If Case Else Call PlayerMsg(Index, "No tile script found. Please contact an admin to solve this problem.", WHITE) Exit Sub End SelectEnd Sub```i got my OC set to case 2 but nothing happens! lol Link to comment Share on other sites More sharing options...
Bobosk Posted August 15, 2009 Share Posted August 15, 2009 ```Call PlayerMsg(Index, "You dont have a Lottery Point, you can obtain one from Mr Lucky!", BRIGHTRED)``` Link to comment Share on other sites More sharing options...
JayT Posted August 15, 2009 Author Share Posted August 15, 2009 yer i just found that but it still aint working Link to comment Share on other sites More sharing options...
JayT Posted August 15, 2009 Author Share Posted August 15, 2009 ok maybe this will help…... this is all the script that i have up to yet:```------------------ Lottery Script ------------------ 'THIS GOES IN ONCLICK FOR CHEST' Dim Amount Dim High Dim Low Low = 2 High = 50 Amount = Rand(Low, High) Case x If GetVar("Accounts\" & GetPlayerLogin(Index) & "\" & GetPlayerName(Index) & ".ini", "LOTTERY", "STATUS") = 1 Then Call GiveItem(Index, Amount, 1) Call PlayerMsg(Index, "Congratulations you have used a Lottery Point!", WHITE) Call PutVar("Accounts\" & GetPlayerLogin(Index) & "\" & GetPlayerName(Index) & ".ini", "LOTTERY", "STATUS", 0) Else Call PlayerMsg(Index, "You dont have a Lottery Point, you can obtain one from Mr Lucky!", BRIGHTRED) End If 'THIS GOES IN SCRIPTEDNPC' Case x If GetVar("Accounts\" & GetPlayerLogin(Index) & "\" & GetPlayerName(Index) & ".ini", "LOTTERY", "STATUS") = 0 Then Call Prompt(index, "Would you like to buy a Lottery Point?", 2) Else Call PlayerMsg(Index, "You already have a Lottery Point! Click a Chest to get a prize!", WHITE) End If 'THIS GOES IN PROMPT UNDER THE FIRST "Select Case Value"' Case x If CanTake(Index, 82, 15) Then Call TakeItem(Index, 82, 15) Call PutVar("Accounts\" & GetPlayerLogin(Index) & "\" & GetPlayerName(Index) & ".ini", "LOTTERY", "STATUS", 1) 'THIS GOES IN PROMPT UNDER THE SECOND "Select Case Value"' Case x Call PlayerMsg(Index, "Ok then please come back later...", WHITE)``` Link to comment Share on other sites More sharing options...
Bobosk Posted August 15, 2009 Share Posted August 15, 2009 it probably is, aside from the fact you're checking if a string = an int, and the incorrect GiveItem syntax, not to mention, giveitem gives non-stackable items, so you need to use GiveCurrency Link to comment Share on other sites More sharing options...
JayT Posted August 15, 2009 Author Share Posted August 15, 2009 @Bobosk:> it probably is, aside from the fact you're checking if a string = an int, and the incorrect GiveItem syntax, not to mention, giveitem gives non-stackable items, so you need to use GiveCurrencyitems 2-50 or non stackable. and the string thing works for my other scripts and the ones admiral did for me :huh: Link to comment Share on other sites More sharing options...
Bobosk Posted August 15, 2009 Share Posted August 15, 2009 then label your crap correctly, because the way you have it, looks like you're meaning to give them a random amount of gold.. as for the rest of your debugging, stick playermsgs everywhere Link to comment Share on other sites More sharing options...
JayT Posted August 15, 2009 Author Share Posted August 15, 2009 @Bobosk:> then label your crap correctly, because the way you have it, looks like you're meaning to give them a random amount of gold.. as for the rest of your debugging, stick playermsgs everywhere```'THIS GOES IN ONCLICK FOR CHEST' Dim Item Dim High Dim Low Low = 2 High = 50 Item = Rand(Low, High) Case x If GetVar("Accounts\" & GetPlayerLogin(Index) & "\" & GetPlayerName(Index) & ".ini", "LOTTERY", "STATUS", "1") Then Call GiveItem(Index, Item, 1) Call PlayerMsg(Index, "Congratulations you have used a Lottery Point!", WHITE) Call PutVar("Accounts\" & GetPlayerLogin(Index) & "\" & GetPlayerName(Index) & ".ini", "LOTTERY", "STATUS", 0) Else Call PlayerMsg(Index, "You dont have a Lottery Point, you can obtain one from Mr Lucky!", BRIGHTRED) End If```Happy….. :icon_surprised: Link to comment Share on other sites More sharing options...
shadowwulf Posted August 15, 2009 Share Posted August 15, 2009 ```Call GiveItem(Index, Item, 1)```I think you need to use itemnum() and reference your variable here.Future note:```Call PutVar("Accounts\" & GetPlayerLogin(Index) & "\" & GetPlayerName(Index) & ".ini", "LOTTERY", "STATUS", 0)```This is fine if the max lottery points is 1… if you want to carry more... then you need to reduce by 1, not set to 0.Hint:putvar=getvar-1 Link to comment Share on other sites More sharing options...
JayT Posted August 15, 2009 Author Share Posted August 15, 2009 @~SW~:> ```> Call GiveItem(Index, Item, 1)> ```I think you need to use itemnum() and reference your variable here.> > Future note:> ```> Call PutVar("Accounts\" & GetPlayerLogin(Index) & "\" & GetPlayerName(Index) & ".ini", "LOTTERY", "STATUS", 0)> > ```This is fine if the max lottery points is 1… if you want to carry more... then you need to reduce by 1, not set to 0.> Hint:putvar=getvar-1yer the max lotto points is 1… but the first part i dont get... do you mean GiveItem(Index, ItemNum(Item), 1) Link to comment Share on other sites More sharing options...
shadowwulf Posted August 15, 2009 Share Posted August 15, 2009 i beleive so.. havent used the source/script in like 6 months… but i beleive you cant just put item number there...check what the call is for an item. Link to comment Share on other sites More sharing options...
JayT Posted August 15, 2009 Author Share Posted August 15, 2009 what about GiveItem(Index, ItemNum(Item), 1) and then take all the dims out e.t.c Link to comment Share on other sites More sharing options...
Bobosk Posted August 15, 2009 Share Posted August 15, 2009 No no no *smacks with a newspaper* it is GiveItem(Index, #,#) Link to comment Share on other sites More sharing options...
JayT Posted August 15, 2009 Author Share Posted August 15, 2009 i want the item number to be Rand(2, 50) tho not 1 specific number Link to comment Share on other sites More sharing options...
Bobosk Posted August 15, 2009 Share Posted August 15, 2009 rand(2, 50) IS a specific number, you don't need to do anything to it Link to comment Share on other sites More sharing options...
DrNova Posted August 15, 2009 Share Posted August 15, 2009 Dim itemnumitemnum=rand(2, 50)Call giveitem(index, INT(itemnum), #)something along those lines Link to comment Share on other sites More sharing options...
JayT Posted August 16, 2009 Author Share Posted August 16, 2009 ok thanks Nova :) thats all i needed just a little guidance :P Link to comment Share on other sites More sharing options...
shadowwulf Posted August 16, 2009 Share Posted August 16, 2009 @Bobosk:> No no no *smacks with a newspaper* it is GiveItem(Index, #,#)that was great lol.Yes that was what i was trying to get to… the command for get item was not correct. now it shooud be Link to comment Share on other sites More sharing options...
Owen F Posted August 16, 2009 Share Posted August 16, 2009 hmmOnClick never work/s/ed for me. :lanyway, i think you've got your answer already or am i missing something here? :huh: Link to comment Share on other sites More sharing options...
Bobosk Posted August 16, 2009 Share Posted August 16, 2009 @~SW~:> that was great lol.> > Yes that was what i was trying to get to… the command for get item was not correct. now it shooud beNo no no *smacks with a newspaper* it is GiveItem(Index, #,#)his command is fine.. Link to comment Share on other sites More sharing options...
shadowwulf Posted August 17, 2009 Share Posted August 17, 2009 get/give whatever… I never said "call getitem()" cause i know that doesnt work... dont try and make an arguent lol Link to comment Share on other sites More sharing options...
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