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

[EO] Guild system problem


erkro1
 Share

Recommended Posts

Do you know whats wrong with this code :
```
Private Sub cmdDismiss_Click()
Dim Buffer As clsBuffer
Set Buffer = New clsBuffer
Dim DismissPlayer As String

Buffer.WriteLong CDismissFromGuild
DismissPlayer = listUsers.text
Buffer.WriteString DismissPlayer
SendData Buffer.ToArray()
Set Buffer = Nothing
DoEvents
If listUsers.text = PlayerName Then
Me.Hide
End If

Dim ShowOffline As String
Set Buffer = New clsBuffer
Buffer.WriteLong CRequestGuildList
ShowOffline = "False"
Buffer.WriteString ShowOffline
SendData Buffer.ToArray()
Set Buffer = Nothing
DoEvents

End Sub
```
Because it isn't working
Link to comment
Share on other sites

@Damian666:

> dont see anything wrong with it, although you make me wonder why the duck you have a DoEvents in there O.o
>
> Dami

And what about this: (server side)
```
Sub HandleDismissFromGuild(ByVal index As Long, ByRef Data() As Byte, ByVal StartAddr As Long, ByVal ExtraVar As Long)
Dim DismissName As String
Dim buffer As clsBuffer
Set buffer = New clsBuffer
buffer.WriteBytes Data()
DismissName = buffer.ReadString
Set buffer = Nothing
Call DismissFromGuild(index, DismissName)
End Sub
```
```
Public Sub DismissFromGuild(ByVal UserIndex As Integer, ByVal DismissName As String)
Dim i As Integer
Dim GuildIndex As Integer
Dim tmpName As String
Dim PlayerIndex As Integer
Dim LoopC As Integer
Dim LoopG As Integer

'Make sure they're in a guild
If Player(UserIndex).GuildID > 0 Then
GuildIndex = Player(UserIndex).GuildID

'Can't dismiss if we aren't the guild leader
If GetPlayerName(UserIndex) <> Guilds(GuildIndex).Owner Then
        Call PlayerMsg(UserIndex, "You do not have permission to dismiss someone from the guild!", BrightRed)
    Exit Sub
End If

'Get the index of the name we're dismissing
If DismissName = GetPlayerName(UserIndex) Then

    For i = 1 To Guilds(GuildIndex).NumMembers
        'Eh if we dismissed ourselves, destroy the guild
        For PlayerIndex = 1 To MAX_PLAYERS
            If IsPlaying(PlayerIndex) = True Then
                If Guilds(GuildIndex).Members(i) = GetPlayerName(PlayerIndex) Then
                Call PlayerMsg(PlayerIndex, "The Guild has been dissolved!", BrightRed)
                Player(PlayerIndex).GuildID = 0
                Call SendPlayerData(PlayerIndex)
                End If
            End If
        Next PlayerIndex
    'We keep Guild Data in the Guild.data files however we flag them as 'Deleted'
    Guilds(GuildIndex).Members(i) = ""
    Guilds(GuildIndex).Name = "Deleted " & Guilds(GuildIndex).Name
    Guilds(GuildIndex).NumMembers = 0
    Next i
    Guilds(GuildIndex).Founded = "Deleted on " & Date
    Exit Sub
End If

Dim OldIndex As Integer

For LoopG = 1 To Guilds(GuildIndex).NumMembers
    tmpName = Guilds(GuildIndex).Members(LoopG)
    If tmpName = DismissName Then

        For LoopC = 1 To MAX_PLAYERS
            If IsPlaying(LoopC) = True Then
                If GetPlayerName(LoopC) = DismissName Then
                Player(LoopC).GuildID = 0
                Call PlayerMsg(LoopC, "You have been dismissed from the guild!", BrightRed)
                Call SendPlayerData(LoopC)
                End If
            End If
        Next LoopC
    OldIndex = LoopG
    End If

Next LoopG
Guilds(GuildIndex).NumMembers = Guilds(GuildIndex).NumMembers - 1
Guilds(GuildIndex).Members(OldIndex) = " "
Call SaveGuilds

End If

End Sub
```
Link to comment
Share on other sites

lots of things actually xd

first, your sending a  long index to a integer index.

secondly, you retrieve guilds owner name without trim$, think that maters, because it would give ya like
"test          " as name, not "test".

rest of it seems ok though, on first glance, hard to debug when im not running it xd

Dami
Link to comment
Share on other sites

@Damian666:

> lots of things actually xd
>
> first, your sending a  long index to a integer index.
>
> secondly, you retrieve guilds owner name without trim$, think that maters, because it would give ya like
> "test          " as name, not "test".
>
> rest of it seems ok though, on first glance, hard to debug when im not running it xd
>
> Dami

What code should I edit? :embarrassed:
Link to comment
Share on other sites

```
Public Sub DismissFromGuild(ByVal UserIndex As Integer, ByVal DismissName As String)

to

Public Sub DismissFromGuild(ByVal UserIndex As long, ByVal DismissName As String)

```^
please note im nor sure this matters, but better safe then fucked xd

```

'Can't dismiss if we aren't the guild leader If GetPlayerName(UserIndex) <> Guilds(GuildIndex).Owner Then

to

'Can't dismiss if we aren't the guild leader If GetPlayerName(UserIndex) <> Trim$(Guilds(GuildIndex).Owner) Then

```
dami
Link to comment
Share on other sites

@Damian666:

> ```
> Public Sub DismissFromGuild(ByVal UserIndex As Integer, ByVal DismissName As String)
>
> to
>
> Public Sub DismissFromGuild(ByVal UserIndex As long, ByVal DismissName As String)
>
> ```^
> please note im nor sure this matters, but better safe then ducked xd
>
> ```
>
> 'Can't dismiss if we aren't the guild leader If GetPlayerName(UserIndex) <> Guilds(GuildIndex).Owner Then
>
> to
>
> 'Can't dismiss if we aren't the guild leader If GetPlayerName(UserIndex) <> Trim$(Guilds(GuildIndex).Owner) Then
>
> ```
> dami

Changed it but still nothing..

EDIT: After watching in the guild files, I see this :
Members : -2
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...