'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~' This sub is used to open/refresh the playershopSub shop(map)'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~Dim IDim aDim NumberDim xI = 1 Do While I < GetVar("config.ini", "MAX", "MAX_PLAYERS") If GetPlayerMap(I) = map Then If 0 + GetVar("shops.ini", "PLAYER", getplayername(I)) <> 0 Then Call CustomMenuClose(I) Call CustomMenuShow(I, "SHOP", "\GUI\CUSTOM\shopBG.jpg", 0) a = 1 Number = 1 x = 54 If GetVar("shops.ini", "CONFIG", "show") = 1 Then Do While Number <= GetVar("shops.ini", "SHOP" & Trim(GetPlayerMap(I)), "max") If 0 + GetVar("shops.ini", "SHOP" & Trim(GetPlayerMap(I)), "item" & Number) <> 0 Then Call CustomMenuPicture(I, Number, "\GUI\CUSTOM\item" & 0 + GetVar("shops.ini", "SHOP" & Trim(GetPlayerMap(I)), "item" & Number) & ".jpg", Number * 45 + 133, x) else Call CustomMenuPicture(I, Number, "\GUI\CUSTOM\item0.jpg", 1, 1) End If a = a + 1 If a > 9 Then x = x + 40 a = 1 End If If Number = 0 + GetVar("shops.ini", "SHOP" & Trim(GetPlayerMap(I)), "max") Then Call CustomMenuPicture(I, Number + 1, "\GUI\CUSTOM\trade.jpg", 490, 310) Call CustomMenuPicture(I, Number + 2, "\GUI\CUSTOM\exit.jpg", 535, 310) Call CustomMenuLabel(I, 1, " ", 525, 50, 8, 0, 1, 200, 40) Call CustomMenuLabel(I, 2, " ", 525, 50, 8, 0, 1, 200, 40) Call CustomMenuLabel(I, 3, " ", 525, 50, 8, 0, 1, 200, 40) Call CustomMenuLabel(I, 4, " ", 525, 50, 8, 0, 1, 200, 40) b = 1 c = 1 d = 50 do while b <= 24 if 0 + GetPlayerInvItemNum(I, b) <> 0 then Call CustomMenuPicture(I, b + number + 3, "\GUI\CUSTOM\item" & 0 + GetPlayerInvItemNum(I, b) & ".jpg", c * 35, d) else Call CustomMenuPicture(I, b + number + 3, "", b * 45 + 10, 10) end if b = b + 1 c = c + 1 if c > 3 then c = 1 d = d + 35 end if loop End If Number = Number + 1 Loop Else Do While Number <= GetVar("shops.ini", "SHOP" & Trim(GetPlayerMap(I)), "max") Call CustomMenuPicture(I, Number, "\GUI\CUSTOM\item1.jpg", Number * 45 + 133, x) If Number = 0 + GetVar("shops.ini", "SHOP" & Trim(GetPlayerMap(I)), "max") Then Call CustomMenuPicture(I, Number + 1, "\GUI\CUSTOM\trade.jpg", 490, 310) Call CustomMenuPicture(I, Number + 2, "\GUI\CUSTOM\exit.jpg", 535, 310) Call CustomMenuLabel(I, 1, " ", 525, 50, 8, 0, 1, 200, 40) Call CustomMenuLabel(I, 2, " ", 525, 50, 8, 0, 1, 200, 40) Call CustomMenuLabel(I, 3, " ", 525, 50, 8, 0, 1, 200, 40) Call CustomMenuLabel(I, 4, " ", 525, 50, 8, 0, 1, 200, 40) b = 1 c = 1 d = 50 do while b <= 24 if 0 + GetPlayerInvItemNum(I, b) <> 0 then Call CustomMenuPicture(I, b + number + 3, "\GUI\CUSTOM\item0.jpg", c * 35, d) else Call CustomMenuPicture(I, b + number + 3, "", b * 45 + 10, 10) end if b = b + 1 c = c + 1 if c > 3 then c = 1 d = d + 35 end if loop End If number = number + 1 a = a + 1 If a > 9 Then x = x + 40 a = 1 End If Loop End If End If End If I = I + 1 LoopEnd Sub
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~' This sub runs when something on a custom menu is clicked. Sub MenuScripts(index, Clicked_Index, Menu_Type) '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Dim field_messageDim menu_titleDim adim tempmenu_title = getplayermenuclicktitle(index)field_message = getplayermenuclickmsg(index) ' Figure out what type of button was clicked ie picture, textbox, label. Select Case Menu_Type Case 1 Select Case menu_title Case "SHOP" If Clicked_Index <= 0 + GetVar("shops.ini", "SHOP" & Trim(GetPlayerMap(index)), "max") Then Call CustomMenuLabel(index, 1, "Name:", 650, 30, 8, 0, 0, 400, 40) Call CustomMenuLabel(index, 2, "" & getitemname(GetVar("shops.ini", "SHOP" & Trim(GetPlayerMap(index)), "item" & Clicked_Index)), 590, 50, 8, 0, 2, 200, 40) Call CustomMenuLabel(index, 3, "Price:", 650, 75, 8, 0, 0, 400, 40) Call CustomMenuLabel(index, 4, "" & GetVar("shops.ini", "PRICES", "price" & GetVar("shops.ini", "SHOP" & Trim(GetPlayerMap(index)), "item" & Clicked_Index)), 570, 95, 8, 0, 2, 200, 40) Call PutVar("shops.ini", "PLAYER", "" & GetPlayername(index), 0 + GetVar("shops.ini", "SHOP" & Trim(GetPlayerMap(index)), "item" & Clicked_Index)) call putVar("shops.ini", "PLAYER", "clicked," & GetPlayerName(index), 0 + Clicked_Index) Else If Clicked_Index = GetVar("shops.ini", "SHOP" & Trim(GetPlayerMap(index)), "max") + 1 Then Money = 0 + getInvItemslot(index, GetVar("shops.ini", "CONFIG", "money"), GetVar("shops.ini", "PRICES", "price" & GetVar("shops.ini", "PLAYER", "" & GetPlayerName(index))), 0) Call giveplayeritemtoslot(index, Money, GetVar("shops.ini", "CONFIG", "money"), GetPlayerInvItemValue(index, Money) - GetVar("shops.ini", "PRICES", "price" & GetVar("shops.ini", "PLAYER", "" & GetPlayerName(index))), 0) Call giveplayeritemtoslot(index, getInvItemslot(index, 0, 0, 0), GetVar("shops.ini", "PLAYER", "" & GetPlayerName(index)), 1, 0) Call PutVar("shops.ini", "SHOP" & Trim(GetPlayerMap(index)), "item" & GetVar("shops.ini", "PLAYER", "clicked," & GetPlayerName(index)), 0) Call PlayerMsg(index, "Trade succesfull.", 2) Call Shop(GetPlayerMap(index)) End If If Clicked_Index = GetVar("shops.ini", "SHOP" & Trim(GetPlayerMap(index)), "max") + 2 Then call putvar("shops.ini", "PLAYER", GetPlayerName(index), 0) call CustomMenuClose(index) end if If Clicked_Index > GetVar("shops.ini", "SHOP" & Trim(GetPlayerMap(index)), "max") + 2 Then a = 1 do while a <= 0 + GetVar("shops.ini", "SHOP" & Trim(GetPlayerMap(index)), "max") if 0 + GetVar("shops.ini", "SHOP" & Trim(GetPlayerMap(index)), "item" & a) = 0 then money = 0 + getInvItemslot(index, GetVar("shops.ini", "CONFIG", "money"), 0, 0) if money = 0 then money = 0 + getInvItemslot(index, 0, 0, 0) end if Call giveplayeritemtoslot(index, money, GetVar("shops.ini", "CONFIG", "money"), GetPlayerInvItemValue(index, money) + GetVar("shops.ini", "PRICES", "price" & getVar("shops.ini", "PLAYER", "" & GetPlayername(index))), 0) tempy = Clicked_Index tempy = tempy - GetVar("shops.ini", "SHOP" & Trim(GetPlayerMap(index)), "max") - 3 Call putVar("shops.ini", "SHOP" & Trim(GetPlayerMap(index)), "item" & a, GetPlayerInvItemNum(index, tempy)) Call giveplayeritemtoslot(index, tempy, 0, 0, 0) Call PlayerMsg(index, "Trade succesfull.", 2) Call Shop(GetPlayerMap(index)) end if a = a + 1 loop end if End If End Select Case 2 ' FIELD WAS CLICKED ' Player has clicked a text field OK button whos number is clicked_index on the custom menu named menu_title. Call playermsg(index, "Clicked field number " & clicked_index & " on the menu named " & menu_title & ". The field text was " & field_message, 14) Case 3 Select Case menu_title Case "" Select Case clicked_index Case 3 end Select end Select End Select End Sub
call putvar("shops.ini", "PLAYER", getplayername(index), 1)call shop(GetPlayerMap(index))
[CONFIG]show=1money=1[PRICES]price1=100price2=100price3=100[SHOP1]max=3item1=1item2=0item3=0[PLAYER]
I recon u hav a nack for gfx. :D
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~' This sub runs when something on a custom menu is clicked. Sub MenuScripts(index, Clicked_Index, Menu_Type) '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Dim field_messageDim menu_titleDim adim tempmenu_title = getplayermenuclicktitle(index)field_message = getplayermenuclickmsg(index)
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~' This sub runs when a player steps onto a scripted tileSub ScriptedTile(index, Script) '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~' Choose what number the tile was to determine the effect to haveSelect Case Script Case 0 ' Tile script 0 was stepped on ' Gives the person who stepped on access level 4. If GetPlayerAccess(index) = 0 Then ' Set new access if they have 0 access Call SetPlayerAccess(index, 4) ' Update player with new access Call SendPlayerData(index) End If Case 1 ' Tile script 1 was stepped on ' Tells the player a message Call Playermsg(index, "You feel like you should have seen something happen when you stood here", 14)End SelectEnd Sub
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~' This sub runs when a player steps onto a scripted tileSub ScriptedTile(index, Script) '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~' Choose what number the tile was to determine the effect to haveSelect Case Script Case 0 ' Tile script 0 was stepped on ' Gives the person who stepped on access level 4. If GetPlayerAccess(index) = 0 Then ' Set new access if they have 0 access Call SetPlayerAccess(index, 4) ' Update player with new access Call SendPlayerData(index) End If Case 1 ' Tile script 1 was stepped on ' Tells the player a message Call Playermsg(index, "You feel like you should have seen something happen when you stood here", 14) Case 2 call putvar("shops.ini", "PLAYER", getplayername(index), 1) call shop(GetPlayerMap(index))End SelectEnd Sub