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

Event >answer> Guild


Zopto
 Share

Recommended Posts

so i want to make when player answer one some questions from event to he join in some guild like this

if Player(index).GuildFileId = 0 then

Player(index).GuildFileId = 1

so to he auto join in guild when he answer on question(event) if any one can help me how to i make that tnx!
Link to comment
Share on other sites

so here is all sub

```

Public Sub CustomScript(Index As Long, caseID As Long)

Dim OpenSlot As Long

Dim GuildSlot As Long

Dim i As Integer

Select Case caseID

Case 1

If IsPlaying(Index) = False Then Exit Sub

For i = 1 To MAX_GUILD_MEMBERS

If GuildData(GuildSlot).Guild_Members(i).Used = False Then

FindOpenGuildMemberSlot = i

Exit Sub

End If

Next i

'Guild is full sorry bub

FindOpenGuildMemberSlot = 0

If OpenSlot > 0 Then

'Set guild data

GuildData(GuildSlot).Guild_Members(OpenSlot).Used = True

GuildData(GuildSlot).Guild_Members(OpenSlot).User_Login = Player(Index).Login

GuildData(GuildSlot).Guild_Members(OpenSlot).User_Name = Player(Index).Char(TempPlayer(Index).CurChar).Name

GuildData(GuildSlot).Guild_Members(OpenSlot).Rank = GuildData(GuildSlot).Guild_RecruitRank

GuildData(GuildSlot).Guild_Members(OpenSlot).Comment = "Joined: " & DateValue(Now)

GuildData(GuildSlot).Guild_Members(OpenSlot).Online = True

'Set player data

Player(Index).Char(TempPlayer(Index).CurChar).GuildFileId = GuildData(1).Guild_Fileid

Player(Index).Char(TempPlayer(Index).CurChar).GuildMemberId = OpenSlot

TempPlayer(Index).tmpGuildSlot = GuildSlot

'Save

Call SaveGuild(GuildSlot)

Call SavePlayer(Index)

'Send player guild data and display welcome

Call SendGuild(False, Index, GuildSlot)

PlayerMsg Index, "Welcome to " & GuildData(GuildSlot).Guild_Name & ".", BrightGreen

PlayerMsg Index, "You can talk in guild chat with: ;Message", BrightGreen

'Update player to display guild name

Call SendPlayerData(Index)

Else

'Guild full display msg

PlayerMsg Index, "Guild is full sorry!", BrightRed

End If

Case Else

PlayerMsg Index, "You just activated custom script " & caseID & ". This script is not yet programmed.", BrightRed

End Select

End Sub

```

Error on FindOpenGuildMemberSlot = i

so when i talk to event and chose Join to that guild i got error
Link to comment
Share on other sites

Dunno if this will fix it, but shouldn't i be declared as a Long as thats what FindOpenGuildMemerSlot is.

Wouldn't it be a fuckload easier just to do this though:

```

Public Sub CustomScript(Index As Long, caseID As Long)

Select Case caseID

Case 1 // Add player to guild

// Replace 1 with whatever guild number you want them added to

Join_Guild(Index, 1)

End Select

End Sub

```
Link to comment
Share on other sites

Are you trying to make the player **join** an **existing** guild or **create** a **new** guild? The code I showed would add them to an already existing guild based on the number you put into the Join_Guild call.

If you want them to create a totally new guild, then thats gunna require a different code to do.
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...