Lucas Roberto Administrador
Mensagens : 711
| Assunto: [ALL]Script de Player ser Shop Sáb 24 Set 2011, 20:10 | |
| Aqui vai um script em que você poderá montar sua lojinha de itens, sem mais de logas, vamos adicione isto a sua main - Código:
-
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ' This sub is used to open/refresh the playershop Sub shop(map) '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Dim I Dim a Dim Number Dim x I = 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 Loop End Sub - Código:
-
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ' This sub runs when something on a custom menu is clicked. Sub MenuScripts(index, Clicked_Index, Menu_Type) '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Dim field_message Dim menu_title Dim a dim temp menu_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 Add ou substitua: - Código:
-
call putvar("shops.ini", "PLAYER", getplayername(index), 1) call shop(GetPlayerMap(index)) Adicione a shop.ini - Código:
-
[CONFIG] show=1 money=1 [PRICES] price1=100 price2=100 price3=100 [SHOP1] max=3 item1=1 item2=0 item3=0 [PLAYER] show - significa mostrar a imagem dos itens se 0 seria mostrar item0.jpg para todos os itens, se seria um show (itemnumber) item jpg. dinheiro - o itemnumber da moeda utilizada preço - é o número de moedas que você começa / precisa comprar o item [SHOP1] - o 1 é o número do mapa (isso seria uma loja no mapa 1) max - o número máximo de itens que estão à venda número de 1 até Max (usado para colocar os itens na loja) - item Script não foi feito por mim, mas quero disponibiliza-lo a vocês!! | |
|