Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

[EO] Job Can Open Form


semlemsushi
 Share

Recommended Posts

Ok im trying to add a button to the options panel for every character and is there a way so that a specified job can only click or view the button? Id prefer view but click is better.

Example: If the characters job is gundealer, and they click the gundealer button, then they are warped to a map? Heres this code I took from the admin panel, where they enter the map ID and then they click the button and theyre warped to the ID they entered if its valid:
```
If GetPlayerAccess(MyIndex) < ADMIN_MAPPER Then
        AddText "You need to be a high enough staff member to do this!", AlertColor
        Exit Sub
    End If
```Where it says "ADMIN_MAPPER", I was thinking if theres a way to make something that says "JOB_GUNDLR" and just replace the code but how do I add that custom thing?

BTW IM USING ORIGINS!
Link to comment
Share on other sites

You may be better off using a Gundealer Class:

```
If GetPlayerClass(Index) = # Then 'replace # with the number of the class
btnGundealer.visible = true
End If
```
Or you could add an extra variable at the bottom of _PlayerRec_ found in _modTypes_ (do this server and client side)

You could then set the players job like this:

```
Player(Index).Job = JOB_GUNDEALER
```
Which would also require you to go to modConstants (in the server and client) and add some Job constants, for example:
```
'Job Constants
Public Const JOB_GUNDEALER As Byte = 1
Public Const JOB_FARMER As Byte = 2
Public Const JOB_PROTECTOR As Byte = 3
```
You could then determine the players job like this:
```
If Player(Index).Job = JOB_GUNDEALER Then
    btnGunDealer.Visible = True
End If
```
Regards,

Lightning
Link to comment
Share on other sites

Okay so I'm in modTypes and I found the 2nd PlayerRec, heres what the code lookes like:

```
Private Type PlayerRec
    ' General
    Name As String
    Class As Byte
    Sprite As Integer
    Level As Byte
    EXP As Long
    Access As Byte
    PK As Byte
    ' Vitals
    Vital(1 To Vitals.Vital_Count - 1) As Long
    ' Stats
    Stat(1 To Stats.stat_count - 1) As Byte
    POINTS As Byte
    ' Worn equipment
    Equipment(1 To Equipment.Equipment_Count - 1) As Byte
    ' Position
    Map As Integer
    X As Byte
    Y As Byte
    Dir As Byte
    ' Client use only
    MaxHP As Long
    MaxMP As Long
    MaxSP As Long
    XOffset As Integer
    YOffset As Integer
    Moving As Byte
    Attacking As Byte
    AttackTimer As Long
    MapGetTimer As Long
    Step As Byte
End Type
```
You said add an extra variable at the bottom? Im not really sure what that means because Im a noob lol.
Link to comment
Share on other sites

Change your old code:

```
Private Type PlayerRec
    ' General
    Name As String
    Class As Byte
    Sprite As Integer
    Level As Byte
    EXP As Long
    Access As Byte
    PK As Byte
    ' Vitals
    Vital(1 To Vitals.Vital_Count - 1) As Long
    ' Stats
    Stat(1 To Stats.stat_count - 1) As Byte
    POINTS As Byte
    ' Worn equipment
    Equipment(1 To Equipment.Equipment_Count - 1) As Byte
    ' Position
    Map As Integer
    X As Byte
    Y As Byte
    Dir As Byte
    ' Client use only
    MaxHP As Long
    MaxMP As Long
    MaxSP As Long
    XOffset As Integer
    YOffset As Integer
    Moving As Byte
    Attacking As Byte
    AttackTimer As Long
    MapGetTimer As Long
    Step As Byte
End Type
```
To this:

```
Private Type PlayerRec
    ' General
    Name As String
    Class As Byte
    Sprite As Integer
    Level As Byte
    EXP As Long
    Access As Byte
    PK As Byte
    ' Vitals
    Vital(1 To Vitals.Vital_Count - 1) As Long
    ' Stats
    Stat(1 To Stats.stat_count - 1) As Byte
    POINTS As Byte
    ' Worn equipment
    Equipment(1 To Equipment.Equipment_Count - 1) As Byte
    ' Position
    Map As Integer
    X As Byte
    Y As Byte
    Dir As Byte
    ' Client use only
    MaxHP As Long
    MaxMP As Long
    MaxSP As Long
    XOffset As Integer
    YOffset As Integer
    Moving As Byte
    Attacking As Byte
    AttackTimer As Long
    MapGetTimer As Long
    Step As Byte
    Job As Byte
End Type
```
You see the "Job As Byte" at the bottom? That is the new variable. The only thing is you might have to delete all your old players for this to take effect. Try it without deleting first - if that doesn't work then delete them and try again. Remember to add this server and client side.
Link to comment
Share on other sites

Okay I changed the code and added the variable at the bottom, now I opened it in modTypes in the serverside, and Im not sure where to put it. Here are the playerrecs I found:
```
Private Type PlayerRec
    ' Account
    Login As String * NAME_LENGTH
    Password As String * NAME_LENGTH

    ' General
    Name As String * NAME_LENGTH
    Sex As Byte
    Class As Byte
    Sprite As Integer
    Level As Byte
    exp As Long
    Access As Byte
    PK As Byte
    ' Vitals
    Vital(1 To Vitals.Vital_Count - 1) As Long
    ' Stats
    Stat(1 To Stats.Stat_Count - 1) As Byte
    POINTS As Byte
    ' Worn equipment
    Equipment(1 To Equipment.Equipment_Count - 1) As Byte
    ' Inventory
    Inv(1 To MAX_INV) As PlayerInvRec
    Spell(1 To MAX_PLAYER_SPELLS) As Byte
    ' Position
    Map As Integer
    x As Byte
    y As Byte
    Dir As Byte
End Type
```and…
```
Public Type TempPlayerRec
    ' Non saved local vars
    Buffer As clsBuffer
    InGame As Boolean
    AttackTimer As Long
    DataTimer As Long
    DataBytes As Long
    DataPackets As Long
    PartyPlayer As Long
    InParty As Byte
    TargetType As Byte
    Target As Byte
    PartyStarter As Byte
    GettingMap As Byte
    SpellBuffer As Long
    SpellBufferTimer As Long
    SpellCD(1 To MAX_PLAYER_SPELLS) As Long
    InShop As Long
    StunTimer As Long
    StunDuration As Long
    InBank As Boolean
    ' trade
    TradeRequest As Long
    InTrade As Long
    TradeOffer(1 To MAX_INV) As PlayerInvRec
    AcceptTrade As Boolean
End Type
```
Where do I put it now? After I put it in serverside, am I ready to get a code for the button yet? Or do I have to do any other things?
Link to comment
Share on other sites

Ugh guys I am so close! I do everything correctly but I'm pretty sure I have to change the "(Index)" to "1 or 70" because that's what It said when I hovered my mouse over it. Here is the code in which I have to change the "(Index)":

> If Player(Index).Job = JOB_GUNDEALER Then
>     btnGunDealer.Visible = True
> End If

So what should I change it to? I tried compiling and the error I got was "Variable not defined."

So all I have to do is get this fixed and Ill be set for a while. Thanks for all your help guys!
Link to comment
Share on other sites

it should because i put

> 'Job Constants
> Public Const JOB_GUNDEALER As Byte = 1

in modConstants (server and client)

and i also put

> Job As Byte

at the bottom of Private Type PlayerRec (in the client files) and also at the bottom of Private Type PlayerRec (the server files one), so why isn't it working?
Link to comment
Share on other sites

@semlemsushi:

> nope, the button was also set to visible.false but I just added the code to frmMainGame, and I changed the button status to Visible.true so idk  :huh:
>
> you wanna come over on teamviewer and check it out because I gtg soon

If you added the bit of code 314piwm added above then it won't show unless you are a Gundealer, in which case comment it out and see whether the label is visible then. If not, I would download a vanilla copy of the source.
Link to comment
Share on other sites

@semlemsushi:

> No problem, should I put
>
> ```
> If Player(Index).Job = JOB_GUNDEALER Then
>     btnGunDealer.Visible = True
> End If
> ```
> As the button_click, button_load, where should the code go?

In the forms load event. frmMainGame for EO, frmStable for ES.
You can also put it wherever the player can change their job, after they have changed their job.
Link to comment
Share on other sites

@semlemsushi:

> ```
> Private Sub Form_Load()
>     picAdmin.Left = 10
>     picCurrency.Left = txtMyChat.Left
>     picCurrency.Top = txtMyChat.Top
>     Me.width = 10545
> End Sub
> ```
> that code is already in teh load sequence, where should I put it in there, anywhere?

Just underneath Me.width = 10545
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...