Eclipse
January 05, 2009, 06:40:56 PM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News:
 
   Home   Chat Help Rules Arcade Search Calendar Gallery Login Register  
 
 
 
Recent Topics +-
Lostica [Project Revamp] by The Tribal
Today at 06:40:04 PM

Disparity Recruiting by Peter
Today at 06:40:01 PM

Azkanan's Workshop (Graphics) by Devogen
Today at 06:39:57 PM

Anywhere to download the v3 beta? by The Tribal
Today at 06:38:28 PM

Spike's Adminishness! by The Tribal
Today at 06:31:04 PM

Does anybody know the math involved in dmg to def? by Syner
Today at 06:30:40 PM

My New Computer! by The BanHammer! [Thor!]
Today at 06:25:05 PM

[E++] Fun with sprites! by Simius Cruentus
Today at 06:23:18 PM

how will the person above die. by The Tribal
Today at 06:20:30 PM

Need forum logos by ʇıunpp ʎqɹıʞ࣭
Today at 06:19:31 PM

Members Online +-
12 Guests, 25 Users
Syner,
kdjrgej,
l0lz!,
The Tribal,
tiggilyboo,
Devogen,
Warconn,
Peter,
>~(Squiddle)~<,
Dimx,
Jax The Mighty,
Thelettersix,
Spike,
Seba,
Sk3wer,
THE Tim,
FS:CG Admin[Shadowwulf],
Gwendalin,
Echo ♥ Pie,
calamity,
The BanHammer! [Thor!],
Greendude120,
EnigmaticSoul,
Zananok,
Hikaru
Pages: [1] 2
  Print  
Author Topic: Player shops :P  (Read 5048 times)
0 Members and 1 Guest are viewing this topic.
unnown
Teh Uberleet
*****
Offline Offline

Posts: 3,659


-Admin-


View Profile Email
« on: September 12, 2006, 09:08:33 AM »



this gives people the ability to sell and buy items from your shop and it really dissapears from the shop or appears if you solled something to the shop


add this to the bottom of the main.txt

Code: [Select]
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
' 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

Code: [Select]
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
' 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/replace this

Code: [Select]
call putvar("shops.ini", "PLAYER", getplayername(index), 1)
call shop(GetPlayerMap(index))

this can be put in for example a scripted tile sub

http://www.verzend.be/v/9872144/CUSTOM.rar.html
download and unrar this in client\gui\custom\


and make shops.ini
Code: [Select]
[CONFIG]
show=1
money=1
[PRICES]
price1=100
price2=100
price3=100
[SHOP1]
max=3
item1=1
item2=0
item3=0
[PLAYER]
show - means show the image of the items if 0 it would show item0.jpg for all items if 1 it would show item(itemnumber).jpg
money - the itemnumber of the currency used
price - is the number of currency you get / need to buy the item
[SHOP1] - the 1 is for the map number (this would be an shop on map 1)
max - the max number of items that are for sale
item - number from 1 till max(used to put items in the shop)
Rotales
Active Member
***
Offline Offline

Posts: 119


View Profile Email
« Reply #1 on: September 12, 2006, 10:20:53 AM »

This is really nice Unnown, I have heard players ask for personal shops in other forums a lot. This would take some work to integrate in to a game properly, but it is a great foundation for a really nice feature. Thanks.
unnown
Teh Uberleet
*****
Offline Offline

Posts: 3,659


-Admin-


View Profile Email
« Reply #2 on: September 12, 2006, 10:28:24 AM »

well...won't be a lot of work once it's in the main.txt
Rotales
Active Member
***
Offline Offline

Posts: 119


View Profile Email
« Reply #3 on: September 12, 2006, 10:47:29 AM »

They will have to set item numbers for each item and they will probably want to make a GUI. I guess it depends on what you're definition of "a lot" is. I didn't mean it as a bad thing though, I was just commenthing that you made a really good base, and it's not a simple copy paste script, it takes some work to put it in a game. But in my opinion, that is a good thing.
unnown
Teh Uberleet
*****
Offline Offline

Posts: 3,659


-Admin-


View Profile Email
« Reply #4 on: September 12, 2006, 11:51:57 AM »

aah well this was the only way possible and it ads depth to games
Tomonzob
Newb
*
Offline Offline

Posts: 10


View Profile Email
« Reply #5 on: September 12, 2006, 01:03:51 PM »

ACE  ;D,  now i gotta work out all the items  :D
l0lz!
I <3 Photoshop
Veteran
Advanced Eclipser
*
Online Online

Posts: 1,149



View Profile WWW Email
« Reply #6 on: September 13, 2006, 03:22:56 PM »

 i installed the script but how do i use it?
master5006
Active Member
***
Offline Offline

Posts: 155



View Profile WWW Email
« Reply #7 on: September 13, 2006, 03:58:22 PM »

Ya how do I use it?
Bobosk
Veteran
Advanced Eclipser
*
Offline Offline

Posts: 1,110


View Profile Email
« Reply #8 on: September 13, 2006, 05:47:37 PM »

i'm guessing you "Call shop(map)" right unnown?
unnown
Teh Uberleet
*****
Offline Offline

Posts: 3,659


-Admin-


View Profile Email
« Reply #9 on: September 13, 2006, 11:24:10 PM »

needs to be in a scripted sub

call putvar("shops.ini", "PLAYER", getplayername(index), 1)
call shop(GetPlayerMap(index))
Timus
Custom GFX'erer
Global Moderator
Advanced Eclipser
*
Offline Offline

Posts: 1,287



View Profile Email
« Reply #10 on: September 22, 2006, 05:45:52 PM »

Thanks. Very helpful.
Sokra
German!
Member
**
Offline Offline

Posts: 27

cool O_o


View Profile Email
« Reply #11 on: October 05, 2006, 08:14:23 AM »

where must this in?

call putvar("shops.ini", "PLAYER", getplayername(index), 1)
call shop(GetPlayerMap(index))

and this ?

'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
' 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
unnown
Teh Uberleet
*****
Offline Offline

Posts: 3,659


-Admin-


View Profile Email
« Reply #12 on: October 06, 2006, 07:13:45 AM »

if you can't do it it's to dificult for you i explained it well enough
Niko
Official Eclipse Nazi Admin
Administrator
Teh Uberleet
*
Offline Offline

Posts: 3,312


Fear me for I have the power of the BAN HAMMER!


View Profile Email
« Reply #13 on: October 06, 2006, 01:17:18 PM »

We dont feel great about our "powers" We can delete what we feel is necicarie to delete. What unown said was that fi you dont know how to install and use this then ur not good enough to.
DFAx
Guest


Email
« Reply #14 on: October 06, 2006, 01:28:35 PM »

yeah, well he didnt have to be a jerk, I wasnt causing any problems or starting issues, i even thanked him for his help

but yeah, this is EXACTLY why i started my own forums
Niko
Official Eclipse Nazi Admin
Administrator
Teh Uberleet
*
Offline Offline

Posts: 3,312


Fear me for I have the power of the BAN HAMMER!


View Profile Email
« Reply #15 on: October 06, 2006, 01:29:44 PM »

Oh well idk.. i didnt see posts cuse they were delteted or w.e. But Unowns a good man, if he deleted a post then their was a reson behind it.
DFAx
Guest


Email