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

[EO] Guild system problem


erkro1
 Share

Recommended Posts

I'm making a guild system based of Samugames' one, but I've a problem.
I have copy/paste all code from Samumods to a modified copy of EO, but the problem is that the client doesn't send/the server doesn't recieve the SendCreateGuild packet.
After double checking all code I still not found the problem, please help.

Code:
**Server -> modEnumerations -> Public Enum Serverpackets/ClientPackets :**

>! ' Packets sent by server to client
Public Enum ServerPackets
    SAlertMsg = 1
    SLoginOk
    SNewCharClasses
    SClassesData
    SInGame
    SPlayerInv
    SPlayerInvUpdate
    SPlayerWornEq
    SPlayerHp
    SPlayerMp
    SPlayerStats
    SPlayerData
    SPlayerMove
    SNpcMove
    SPlayerDir
    SNpcDir
    SPlayerXY
    SPlayerXYMap
    SAttack
    SNpcAttack
    SCheckForMap
    SMapData
    SMapItemData
    SMapNpcData
    SMapDone
    SGlobalMsg
    SAdminMsg
    SPlayerMsg
    SMapMsg
    SSpawnItem
    SItemEditor
    SUpdateItem
    SREditor
    SSpawnNpc
    SNpcDead
    SNpcEditor
    SUpdateNpc
    SMapKey
    SEditMap
    SShopEditor
    SUpdateShop
    SSpellEditor
    SUpdateSpell
    SSpells
    SLeft
    SResourceCache
    SResourceEditor
    SUpdateResource
    SSendPing
    SDoorAnimation
    SActionMsg
    SPlayerEXP
    SBlood
    SAnimationEditor
    SUpdateAnimation
    SAnimation
    SMapNpcVitals
    SCooldown
    SClearSpellBuffer
    SSayMsg
    SOpenShop
    SResetShopAction
    SStunned
    SMapWornEq
    SBank
    STrade
    SCloseTrade
    STradeUpdate
    STradeStatus
    SMaxLevel
    STarget
    SHotbar
    SHighIndex
    SSound
    SClearWhoList
    SUpdateWhoList
    STradeRequest
    SPartyInvite
    SPartyUpdate
    SPartyVitals
    SSpeechWindow
    SQuestEditor
    SUpdateQuest
    SPlayerQuest
    SQuestMessage
    'Crzy's Friends List
    SFriendsList
    'Guild things
    SSendClearGuildList
    SSendUpdateGuildList
    SSendGuildInvite
    SGuildMsg
    ' Make sure SMSG_COUNT is below everything else
    SMSG_COUNT
End Enum
>! ' Packets sent by client to server
Public Enum ClientPackets
    CNewAccount = 1
    CDelAccount
    CLogin
    CAddChar
    CUseChar
    CSayMsg
    CEmoteMsg
    CBroadcastMsg
    CPlayerMsg
    CPlayerMove
    CPlayerDir
    CUseItem
    CAttack
    CUseStatPoint
    CPlayerInfoRequest
    CWarpMeTo
    CWarpToMe
    CWarpTo
    CSetSprite
    CGetStats
    CRequestNewMap
    CMapData
    CNeedMap
    CMapGetItem
    CMapDropItem
    CMapRespawn
    CMapReport
    CKickPlayer
    CBanList
    CBanDestroy
    CBanPlayer
    CRequestEditMap
    CRequestEditItem
    CSaveItem
    CRequestEditNpc
    CSaveNpc
    CRequestEditShop
    CSaveShop
    CRequestEditSpell
    CSaveSpell
    CSetAccess
    CWhosOnline
    CSetMotd
    CSearch
    CSpells
    CCast
    CQuit
    CSwapInvSlots
    CRequestEditResource
    CSaveResource
    CCheckPing
    CUnequip
    CRequestPlayerData
    CRequestItems
    CRequestNPCS
    CRequestResources
    CSpawnItem
    CRequestEditAnimation
    CSaveAnimation
    CRequestAnimations
    CRequestSpells
    CRequestShops
    CRequestLevelUp
    CForgetSpell
    CCloseShop
    CBuyItem
    CSellItem
    CChangeBankSlots
    CDepositItem
    CWithdrawItem
    CCloseBank
    CAdminWarp
    CTradeRequest
    CAcceptTrade
    CDeclineTrade
    CTradeItem
    CUntradeItem
    CHotbarChange
    CHotbarUse
    CSwapSpellSlots
    CAcceptTradeRequest
    CDeclineTradeRequest
    CPartyRequest
    CAcceptParty
    CDeclineParty
    CPartyLeave
    CRequestEditQuest
    CSaveQuest
    CRequestQuests
    CPlayerHandleQuest
    CQuestLogUpdate
    'Crzy's Friends System
    CFriendsList
    CAddFriend
    CRemoveFriend
    'Guild things
    CSendCreateGuild
    CRequestGuildList
    CDismissFromGuild
    CSendAcceptGuildInvite
    CSendInviteToGuild
    CRequestUserList
    CGuildMsg
    ' Make sure CMSG_COUNT is below everything else
    CMSG_COUNT
End Enum

**Server -> modEnumerations -> Public Enum Serverpackets/ClientPackets :**

>! ' Packets sent by server to client
Public Enum ServerPackets
    SAlertMsg = 1
    SLoginOk
    SNewCharClasses
    SClassesData
    SInGame
    SPlayerInv
    SPlayerInvUpdate
    SPlayerWornEq
    SPlayerHp
    SPlayerMp
    SPlayerStats
    SPlayerData
    SPlayerMove
    SNpcMove
    SPlayerDir
    SNpcDir
    SPlayerXY
    SPlayerXYMap
    SAttack
    SNpcAttack
    SCheckForMap
    SMapData
    SMapItemData
    SMapNpcData
    SMapDone
    SGlobalMsg
    SAdminMsg
    SPlayerMsg
    SMapMsg
    SSpawnItem
    SItemEditor
    SUpdateItem
    SREditor
    SSpawnNpc
    SNpcDead
    SNpcEditor
    SUpdateNpc
    SMapKey
    SEditMap
    SShopEditor
    SUpdateShop
    SSpellEditor
    SUpdateSpell
    SSpells
    SLeft
    SResourceCache
    SResourceEditor
    SUpdateResource
    SSendPing
    SDoorAnimation
    SActionMsg
    SPlayerEXP
    SBlood
    SAnimationEditor
    SUpdateAnimation
    SAnimation
    SMapNpcVitals
    SCooldown
    SClearSpellBuffer
    SSayMsg
    SOpenShop
    SResetShopAction
    SStunned
    SMapWornEq
    SBank
    STrade
    SCloseTrade
    STradeUpdate
    STradeStatus
    SMaxLevel
    STarget
    SHotbar
    SHighIndex
    SSound
    SClearWhoList
    SUpdateWhoList
    STradeRequest
    SPartyInvite
    SPartyUpdate
    SPartyVitals
    SSpeechWindow
    SQuestEditor
    SUpdateQuest
    SPlayerQuest
    SQuestMessage
    SCrafting
    'Crzy's Friends System
    SFriendsList
    'Guild system
    SSendClearGuildList
    SSendUpdateGuildList
    SSendGuildInvite
    SGuildMsg
    ' Make sure SMSG_COUNT is below everything else
    SMSG_COUNT
End Enum
>! ' Packets sent by client to server
Public Enum ClientPackets
    CNewAccount = 1
    CDelAccount
    CLogin
    CAddChar
    CUseChar
    CSayMsg
    CEmoteMsg
    CBroadcastMsg
    CPlayerMsg
    CPlayerMove
    CPlayerDir
    CUseItem
    CAttack
    CUseStatPoint
    CPlayerInfoRequest
    CWarpMeTo
    CWarpToMe
    CWarpTo
    CSetSprite
    CGetStats
    CRequestNewMap
    CMapData
    CNeedMap
    CMapGetItem
    CMapDropItem
    CMapRespawn
    CMapReport
    CKickPlayer
    CBanList
    CBanDestroy
    CBanPlayer
    CRequestEditMap
    CRequestEditItem
    CSaveItem
    CRequestEditNpc
    CSaveNpc
    CRequestEditShop
    CSaveShop
    CRequestEditSpell
    CSaveSpell
    CSetAccess
    CWhosOnline
    CSetMotd
    CSearch
    CSpells
    CCast
    CQuit
    CSwapInvSlots
    CRequestEditResource
    CSaveResource
    CCheckPing
    CUnequip
    CRequestPlayerData
    CRequestItems
    CRequestNPCS
    CRequestResources
    CSpawnItem
    CRequestEditAnimation
    CSaveAnimation
    CRequestAnimations
    CRequestSpells
    CRequestShops
    CRequestLevelUp
    CForgetSpell
    CCloseShop
    CBuyItem
    CSellItem
    CChangeBankSlots
    CDepositItem
    CWithdrawItem
    CCloseBank
    CAdminWarp
    CTradeRequest
    CAcceptTrade
    CDeclineTrade
    CTradeItem
    CUntradeItem
    CHotbarChange
    CHotbarUse
    CSwapSpellSlots
    CAcceptTradeRequest
    CDeclineTradeRequest
    CPartyRequest
    CAcceptParty
    CDeclineParty
    CPartyLeave
    CRequestEditQuest
    CSaveQuest
    CRequestQuests
    CPlayerHandleQuest
    CQuestLogUpdate
    CCrafting
    'Crzy's Friends System
    CFriendsList
    CAddFriend
    CRemoveFriend
    'Guild things
    CSendCreateGuild
    CRequestGuildList
    CDismissFromGuild
    CSendAcceptGuildInvite
    CSendInviteToGuild
    CRequestUserList
    CGuildMsg
    ' Make sure CMSG_COUNT is below everything else
    CMSG_COUNT
End Enum
>! Public HandleDataSub(CMSG_COUNT) As Long
>! ' Stats used by Players, Npcs and Classes
Public Enum Stats
    Strength = 1
    Endurance
    Intelligence
    Agility
    Willpower
    ' Make sure Stat_Count is below everything else
    Stat_Count
End Enum
>! ' Vitals used by Players, Npcs and Classes
Public Enum Vitals
    HP = 1
    MP
    ' Make sure Vital_Count is below everything else
    Vital_Count
End Enum

**Client -> frmCreateGuild -> 'Create Guild' button :**

>! Private Sub cmdCreate_Click()
Dim n As Long
    Dim Buffer As clsBuffer

    Dim tmpGuildName As String

    Set Buffer = New clsBuffer
    Buffer.WriteLong CSendCreateGuild

    tmpGuildName = Me.txtGuildName.text

    Buffer.WriteString tmpGuildName

    SendData Buffer.ToArray()

    Set Buffer = Nothing
    Me.Hide
End Sub

**Server -> modHandleData -> HandleCreateGuild :**

>! Sub HandleCreateGuild(ByVal index As Long, ByRef Data() As Byte, ByVal StartAddr As Long, ByVal ExtraVar As Long)
Dim tmpGuildName As String
>! Dim buffer As clsBuffer
Set buffer = New clsBuffer
buffer.WriteBytes Data()
tmpGuildName = buffer.ReadString
Set buffer = Nothing
Call CreateGuild(index, tmpGuildName)
>! End Sub

If you need more code or something else, reply or PM me. ;)
Thanks for reading.
Link to comment
Share on other sites

never seen Samugames's guild system but in order to help you i need to see the modservertcp for the screateguild code (which i don't see in the enumartion code so how could anything be sent or received? unless the invite will create the guild i don't know)

edit:oh and for the modenumarions would be simpler to call SSendClearGuildList SClearGuildList since S Stands for Server or Send not sure which one but writing send is useless (just saying you don't have to change them)…
Link to comment
Share on other sites

@Musbah:

> need to see the modservertcp for the screateguild code
>
> edit:oh and for the modenumarions would be simpler to call SSendClearGuildList SClearGuildList since S Stands for Server or Send not sure which one but writing send is useless (just saying you don't have to change them)…

I've included HandleCreateGuild, and I have no 'screateguild code' in modServerTCP.
Link to comment
Share on other sites

Ok you handled create guild how do you send back to the client that it has been created and all??

oh and i don't see

HandleDataSub(CSendCreateGuild) = GetAddress(AddressOf HandleCreateGuild) (if you didn't add it then well when you do everything should work unless something else is wrong)
Link to comment
Share on other sites

@Musbah:

> Ok you handled create guild how do you send back to the client that it has been created and all??
>
> oh and i don't see
>
> HandleDataSub(CSendCreateGuild) = GetAddress(AddressOf HandleCreateGuild) (if you didn't add it then well when you do everything should work unless something else is wrong)

Createguild sub :
```
Public Sub CreateGuild(ByVal UserIndex As Integer, ByVal GuildName As String)

'If the player sending the request is already in a guild
If Player(UserIndex).GuildID > 0 Then
Call PlayerMsg(UserIndex, "You are already in a guild!", BrightRed)
Exit Sub
End If

'Loop through all the guilds and see if any guild already has that name
Dim i As Integer
For i = 1 To NumGuilds
    If Guilds(i).Name = GuildName Then
    Call PlayerMsg(UserIndex, "That name is already in use!", BrightRed)
    Exit Sub
    End If
Next i

'Make the Guild
Dim GuildIndex As Integer
NumGuilds = NumGuilds + 1
GuildIndex = NumGuilds
Guilds(GuildIndex).Name = GuildName
Guilds(GuildIndex).Founded = Date
Guilds(GuildIndex).Owner = GetPlayerName(UserIndex)
Guilds(GuildIndex).Gold = 0
Guilds(GuildIndex).NumMembers = 1
Guilds(GuildIndex).Members(1) = GetPlayerName(UserIndex)
Player(UserIndex).GuildID = GuildIndex
Call PlayerMsg(UserIndex, "Guild [" & GuildName & "] has been created!", BrightRed)
'Save All Guilds
Call SaveGuilds
SendDataToAll PlayerData(UserIndex)
End Sub
```
And HandleDataSub(CSend bla bla bla) is on server, should I add it on client too?
Link to comment
Share on other sites

no just wanted to make sure it was in the server.

i would add

```
sub sendcreateguild(byval guildname as string)
Dim n As Long
    Dim Buffer As clsBuffer

    tmpGuildName = guildname

    Set Buffer = New clsBuffer
    Buffer.WriteLong CSendCreateGuild

    Buffer.WriteString tmpGuildName

    SendData Buffer.ToArray()

    Set Buffer = Nothing
End Sub
```or something like that in modclienttcp then call the sub from the form i have no idea if that's causing the problem but try

Otherwise i can't really see anything wrong with the code in front of me that could stop client from sending to server or might be and i just can't see it, but sorry can't help you more than that with the code i got in front of me.
Link to comment
Share on other sites

@Musbah:

> no just wanted to make sure it was in the server.
>
> i would add
>
> ```
> sub sendcreateguild(byval guildname as string)
> Dim n As Long
>     Dim Buffer As clsBuffer
>
>     tmpGuildName = guildname
>  
>     Set Buffer = New clsBuffer
>     Buffer.WriteLong CSendCreateGuild
>  
>     Buffer.WriteString tmpGuildName
>
>     SendData Buffer.ToArray()
>  
>     Set Buffer = Nothing
> End Sub
> ```or something like that in modclienttcp then call the sub from the form i have no idea if that's causing the problem but try
>
> Otherwise i can't really see anything wrong with the code in front of me that could stop client from sending to server or might be and i just can't see it, but sorry can't help you more than that with the code i got in front of me.

Ok, and there is no difference when I add that code in, its still saying : "You're not in a guild!"
Link to comment
Share on other sites

@Musbah:

> Ok I'm not sure of this but since you'r adding something to the player shouldn't the create guild have
> Saveplayer(userindex)  cause if that's not saved it is going to say you're not in a guild… might be wrong too who knows

That also don't work ;(
Link to comment
Share on other sites

thing is if you're getting you'r not in a guild doesn't necessarily mean client isn't sending anything something could be wrong with the create guild or anything so try adding a message somewhere to see if something is sent or not. for example in handle create guild could add an alert to see if the code gets there or not (just an example). and while there pause and put your mouse on the integer see if the values are sent…
Link to comment
Share on other sites

@Musbah:

> thing is if you're getting you'r not in a guild doesn't necessarily mean client isn't sending anything something could be wrong with the create guild or anything so try adding a message somewhere to see if something is sent or not. for example in handle create guild could add an alert to see if the code gets there or not (just an example). and while there pause and put your mouse on the integer see if the values are sent…

I did, the client is alright, but when I put a breakpoint at serveral point on server I get nothing..
Link to comment
Share on other sites

make sure there is no typo, i once had a "Ssomethinghere" instead of "Csomethinghere" in server, that wont error, but also wont call the right code, took me a frikking day to notice xd

Dami

dont see anything wrong, just put breakpoints everywhere, from the call to the sub, tru all of your sub, see where it fucks up
Link to comment
Share on other sites

@Damian666:

> make sure there is no typo, i once had a "Ssomethinghere" instead of "Csomethinghere" in server, that wont error, but also wont call the right code, took me a frikking day to notice xd
>
> Dami
>
> dont see anything wrong, just put breakpoints everywhere, from the call to the sub, tru all of your sub, see where it ducks up

Everything seems to be alright there, and I already placed some breakpoint without any succes.
Link to comment
Share on other sites

yes, some, but i mean, flood the ducking bastard with them, check every single line so you can check everything for right data etc.

thats your best bet mate, because while looking over it, nothing jumps up as wrong, so we can only know sure if we go in debug overkill xd

so start in handlesub, then the sub that goes from there, then the createguild etc etc etc

Dami
Link to comment
Share on other sites

@Damian666:

> yes, some, but i mean, flood the ducking bastard with them, check every single line so you can check everything for right data etc.
>
> thats your best bet mate, because while looking over it, nothing jumps up as wrong, so we can only know sure if we go in debug overkill xd
>
> so start in handlesub, then the sub that goes from there, then the createguild etc etc etc
>
> Dami

Everything is good at client, but server isn't recieving it. :(
Link to comment
Share on other sites

@Damian666:

> thats normal, but i mean on client send?

On client side I have this code on Create Guild button :
```
Private Sub cmdCreate_Click()
Dim n As Long
    Dim Buffer As clsBuffer

    Dim tmpGuildName As String

    Set Buffer = New clsBuffer
    Buffer.WriteLong CSendCreateGuild

    tmpGuildName = Me.txtGuildName.text

    Buffer.WriteString tmpGuildName

    SendData Buffer.ToArray()

    Set Buffer = Nothing
    Me.Hide
End Sub
```
Link to comment
Share on other sites

@Damian666:

> nonono xd
>
> i mean, when ya press the button clientside, so it sends, does it stop in server when ya put a breakpoint on:
>
> HandleDataSub(CSendCreateGuild) = GetAddress(AddressOf HandleCreateGuild)
>
> ??

Nope
Link to comment
Share on other sites

@Damian666:

> good, now we know what happens, it doesnt recieve.
>
> which is weird though xd
>
> try copying your server enumeration file to the clients, perhaps its different, its hard to see sometimes.

Thanks, Damian, I love you :P
It is working now, I'll give you credits. :cheesy:
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...