vSro Guild user Limit [Query]

06/15/2014 10:31 $Apollo#1
A lot of people are looking for and this is something that needs
Just say thank you.

PHP Code:
How to use?
Right click SRO_VT_SHARD > New Query Paste code Execute
Code:
USE [SRO_VT_SHARD]
GO
/****** Object:  StoredProcedure [dbo].[_Guild_FnAddMember]    Script Date: 15.06.2014 11:08:20 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER OFF
GO




ALTER PROCEDURE [dbo].[_Guild_FnAddMember]
 @guildID        int,
 @MemberID     int,
 @MemberClass    tinyint,
 @joinDate     smalldatetime,
 @permission     int    
    
as
Declare @LiMiT int = '24' -- << Userr Limit Credits by $Apollo
    if (exists (select CharID from _GuildMember where CharID = @MemberID))
    begin
        return -1001
    end


    declare @MemberName    varchar(64)
    declare @curLevel    tinyint
    select @MemberName = CharName16, @curLevel = CurLevel from _Char with (nolock) where CharID = @MemberID
    if (@@error <> 0 or @@rowcount = 0)
    begin
        return -1
    end
    if (exists (select CharID from _GuildMember with (nolock) where GuildID = @guildID and CharID = @MemberID))
    begin 
        return -2
    end
    
        declare @ReFObjID int
    select @ReFObjID = RefObjID from _Char with (nolock) where CharID = @MemberID
    
    if (@@error <> 0 or @@rowcount = 0)
    begin
        return -5
    end






    declare @siegeAuthority tinyint
    set @siegeAuthority = 0


    if @MemberClass = 0  -- ±æ¸¶ÀÌ¸é °ø¼º±ÇÇÑÀ» commander·Î ¼¼ÆÃ! ±× ¿Ü´Â ÀÏ¹Ý member·Î ¼¼ÆÃÇÑ´Ù.
    begin
        set @siegeAuthority = 1
    end
    Declare @GC int = (Select COUNT(*) from _GuildMember where GuildID = @guildID )
   if @GC  <= @LiMiT begin 
    insert _GuildMember values @guildID, @MemberID, @MemberName, @MemberClass, @curLevel, 0, @joinDate @permission, 0, 0, 0, null, @ReFObjID, @siegeAuthority)
    end
    if (@@error <> 0 or @@rowcount = 0)
    begin
        return -3
    end
    
       if @GC  <= @LiMiT begin  
    update _Char Set GuildID = @guildID where CharID = @MemberID
    end
    if (@@error <> 0 or @@rowcount = 0)
    begin
        return -4
    end
    return 1

2nd Union Limit

Code:
USE [SRO_VT_SHARD]

GO
/****** Object:  StoredProcedure [dbo].[_Guild_Create]    Script Date: 14.06.2014 16:53:19 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO




--
ALTER PROCEDURE [dbo].[_Guild_Create]
    @guildName    varchar(64),
    @CreaterID    int
as
    if (exists (select id from _Guild where Name = @guildName))
    begin
        return -1000
    end
    if (exists (select CharID from _GuildMember where CharID = @CreaterID))
    begin
        return -1001
    end
begin transaction
    
    declare @guildID    int
    declare @FoundationDate  smalldatetime
    
    set @FoundationDate = GetDate()
    insert _Guild(Name, Lvl, GatheredSP, FoundationDate,Alliance,Booty) values @guildName+'_ULimit_1', 1, 0, @FoundationDate,0,0)
    insert _Guild(Name, Lvl, GatheredSP, FoundationDate,Alliance,Booty) values @guildName+'_ULimit_2', 1, 0, @FoundationDate,0,0)
    insert _Guild(Name, Lvl, GatheredSP, FoundationDate,Alliance,Booty) values @guildName+'_ULimit_3', 1, 0, @FoundationDate,0,0)
    insert _Guild(Name, Lvl, GatheredSP, FoundationDate,Alliance,Booty) values @guildName+'_ULimit_4', 1, 0, @FoundationDate,0,0)
    insert _Guild(Name, Lvl, GatheredSP, FoundationDate,Alliance,Booty) values @guildName+'_ULimit_5', 1, 0, @FoundationDate,0,0)


    insert _Guild(Name, Lvl, GatheredSP, FoundationDate,Alliance,Booty) values @guildName, 5, 0, @FoundationDate,0,0)
    set @guildID = @@identity
    
    if (@@error <> 0 or @@rowcount = 0 or @guildID = 0)
    begin
        rollback transaction
        return -5
    end


    --길드장은 퍼미션이 0xffffffff !!
    declare @rvalue int
    exec @rvalue = _Guild_FnAddMember @guildID, @CreaterID, 0, @FoundationDate,0xffffffff
    if (@@error <> 0 or @rvalue <= 0)
    begin
        rollback transaction
        return @rvalue
    end
    
    -- 길드 창고를 생성하자
    exec @rvalue = _Guild_CreateChest_NoTX @guildID
    if (@@error <> 0 or @rvalue <= 0)
    begin
        rollback transaction
        return @rvalue
    end


commit transaction
    return @guildID
    
/* Credits by Apollo : Skype apollo1337_1*/
06/16/2014 16:40 Callum#2
#approved
06/16/2014 17:47 nnnn200123#3
Good Jop
06/16/2014 20:05 PlayVSro#4
Quote:
Originally Posted by $Apollo View Post
A lot of people are looking for and this is something that needs
Just say thank you.

PHP Code:
How to use?
Right click SRO_VT_SHARD > New Query Paste code Execute
Code:
USE [SRO_VT_SHARD]
GO
/****** Object:  StoredProcedure [dbo].[_Guild_FnAddMember]    Script Date: 15.06.2014 11:08:20 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER OFF
GO




ALTER PROCEDURE [dbo].[_Guild_FnAddMember]
 @guildID        int,
 @MemberID     int,
 @MemberClass    tinyint,
 @joinDate     smalldatetime,
 @permission     int    
    
as
Declare @LiMiT int = '24' -- << Userr Limit Credits by $Apollo
    if (exists (select CharID from _GuildMember where CharID = @MemberID))
    begin
        return -1001
    end


    declare @MemberName    varchar(64)
    declare @curLevel    tinyint
    select @MemberName = CharName16, @curLevel = CurLevel from _Char with (nolock) where CharID = @MemberID
    if (@@error <> 0 or @@rowcount = 0)
    begin
        return -1
    end
    if (exists (select CharID from _GuildMember with (nolock) where GuildID = @guildID and CharID = @MemberID))
    begin 
        return -2
    end
    
        declare @ReFObjID int
    select @ReFObjID = RefObjID from _Char with (nolock) where CharID = @MemberID
    
    if (@@error <> 0 or @@rowcount = 0)
    begin
        return -5
    end






    declare @siegeAuthority tinyint
    set @siegeAuthority = 0


    if @MemberClass = 0  -- ±æ¸¶ÀÌ¸é °ø¼º±ÇÇÑÀ» commander·Î ¼¼ÆÃ! ±× ¿Ü´Â ÀÏ¹Ý member·Î ¼¼ÆÃÇÑ´Ù.
    begin
        set @siegeAuthority = 1
    end
    Declare @GC int = (Select COUNT(*) from _GuildMember where GuildID = @guildID )
   if @GC  <= @LiMiT begin 
    insert _GuildMember values @guildID, @MemberID, @MemberName, @MemberClass, @curLevel, 0, @joinDate @permission, 0, 0, 0, null, @ReFObjID, @siegeAuthority)
    end
    if (@@error <> 0 or @@rowcount = 0)
    begin
        return -3
    end
    
       if @GC  <= @LiMiT begin  
    update _Char Set GuildID = @guildID where CharID = @MemberID
    end
    if (@@error <> 0 or @@rowcount = 0)
    begin
        return -4
    end
    return 1

2nd Union Limit

Code:
USE [SRO_VT_SHARD]

GO
/****** Object:  StoredProcedure [dbo].[_Guild_Create]    Script Date: 14.06.2014 16:53:19 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO




--
ALTER PROCEDURE [dbo].[_Guild_Create]
    @guildName    varchar(64),
    @CreaterID    int
as
    if (exists (select id from _Guild where Name = @guildName))
    begin
        return -1000
    end
    if (exists (select CharID from _GuildMember where CharID = @CreaterID))
    begin
        return -1001
    end
begin transaction
    
    declare @guildID    int
    declare @FoundationDate  smalldatetime
    
    set @FoundationDate = GetDate()
    insert _Guild(Name, Lvl, GatheredSP, FoundationDate,Alliance,Booty) values @guildName+'_ULimit_1', 1, 0, @FoundationDate,0,0)
    insert _Guild(Name, Lvl, GatheredSP, FoundationDate,Alliance,Booty) values @guildName+'_ULimit_2', 1, 0, @FoundationDate,0,0)
    insert _Guild(Name, Lvl, GatheredSP, FoundationDate,Alliance,Booty) values @guildName+'_ULimit_3', 1, 0, @FoundationDate,0,0)
    insert _Guild(Name, Lvl, GatheredSP, FoundationDate,Alliance,Booty) values @guildName+'_ULimit_4', 1, 0, @FoundationDate,0,0)
    insert _Guild(Name, Lvl, GatheredSP, FoundationDate,Alliance,Booty) values @guildName+'_ULimit_5', 1, 0, @FoundationDate,0,0)


    insert _Guild(Name, Lvl, GatheredSP, FoundationDate,Alliance,Booty) values @guildName, 5, 0, @FoundationDate,0,0)
    set @guildID = @@identity
    
    if (@@error <> 0 or @@rowcount = 0 or @guildID = 0)
    begin
        rollback transaction
        return -5
    end


    --길드장은 퍼미션이 0xffffffff !!
    declare @rvalue int
    exec @rvalue = _Guild_FnAddMember @guildID, @CreaterID, 0, @FoundationDate,0xffffffff
    if (@@error <> 0 or @rvalue <= 0)
    begin
        rollback transaction
        return @rvalue
    end
    
    -- 길드 창고를 생성하자
    exec @rvalue = _Guild_CreateChest_NoTX @guildID
    if (@@error <> 0 or @rvalue <= 0)
    begin
        rollback transaction
        return @rvalue
    end


commit transaction
    return @guildID
    
/* Credits by Apollo : Skype apollo1337_1*/
Quote:
Originally Posted by nnnn200123 View Post
Good Jop

Thank you
07/16/2014 03:02 Little Messi#5
Quote:
Originally Posted by $Apollo View Post
A lot of people are looking for and this is something that needs
Just say thank you.

PHP Code:
How to use?
Right click SRO_VT_SHARD > New Query Paste code Execute
Code:
USE [SRO_VT_SHARD]
GO
/****** Object:  StoredProcedure [dbo].[_Guild_FnAddMember]    Script Date: 15.06.2014 11:08:20 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER OFF
GO




ALTER PROCEDURE [dbo].[_Guild_FnAddMember]
 @guildID        int,
 @MemberID     int,
 @MemberClass    tinyint,
 @joinDate     smalldatetime,
 @permission     int    
    
as
Declare @LiMiT int = '24' -- << Userr Limit Credits by $Apollo
    if (exists (select CharID from _GuildMember where CharID = @MemberID))
    begin
        return -1001
    end


    declare @MemberName    varchar(64)
    declare @curLevel    tinyint
    select @MemberName = CharName16, @curLevel = CurLevel from _Char with (nolock) where CharID = @MemberID
    if (@@error <> 0 or @@rowcount = 0)
    begin
        return -1
    end
    if (exists (select CharID from _GuildMember with (nolock) where GuildID = @guildID and CharID = @MemberID))
    begin 
        return -2
    end
    
        declare @ReFObjID int
    select @ReFObjID = RefObjID from _Char with (nolock) where CharID = @MemberID
    
    if (@@error <> 0 or @@rowcount = 0)
    begin
        return -5
    end






    declare @siegeAuthority tinyint
    set @siegeAuthority = 0


    if @MemberClass = 0  -- ±æ¸¶ÀÌ¸é °ø¼º±ÇÇÑÀ» commander·Î ¼¼ÆÃ! ±× ¿Ü´Â ÀÏ¹Ý member·Î ¼¼ÆÃÇÑ´Ù.
    begin
        set @siegeAuthority = 1
    end
    Declare @GC int = (Select COUNT(*) from _GuildMember where GuildID = @guildID )
   if @GC  <= @LiMiT begin 
    insert _GuildMember values @guildID, @MemberID, @MemberName, @MemberClass, @curLevel, 0, @joinDate @permission, 0, 0, 0, null, @ReFObjID, @siegeAuthority)
    end
    if (@@error <> 0 or @@rowcount = 0)
    begin
        return -3
    end
    
       if @GC  <= @LiMiT begin  
    update _Char Set GuildID = @guildID where CharID = @MemberID
    end
    if (@@error <> 0 or @@rowcount = 0)
    begin
        return -4
    end
    return 1

2nd Union Limit

Code:
USE [SRO_VT_SHARD]

GO
/****** Object:  StoredProcedure [dbo].[_Guild_Create]    Script Date: 14.06.2014 16:53:19 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO




--
ALTER PROCEDURE [dbo].[_Guild_Create]
    @guildName    varchar(64),
    @CreaterID    int
as
    if (exists (select id from _Guild where Name = @guildName))
    begin
        return -1000
    end
    if (exists (select CharID from _GuildMember where CharID = @CreaterID))
    begin
        return -1001
    end
begin transaction
    
    declare @guildID    int
    declare @FoundationDate  smalldatetime
    
    set @FoundationDate = GetDate()
    insert _Guild(Name, Lvl, GatheredSP, FoundationDate,Alliance,Booty) values @guildName+'_ULimit_1', 1, 0, @FoundationDate,0,0)
    insert _Guild(Name, Lvl, GatheredSP, FoundationDate,Alliance,Booty) values @guildName+'_ULimit_2', 1, 0, @FoundationDate,0,0)
    insert _Guild(Name, Lvl, GatheredSP, FoundationDate,Alliance,Booty) values @guildName+'_ULimit_3', 1, 0, @FoundationDate,0,0)
    insert _Guild(Name, Lvl, GatheredSP, FoundationDate,Alliance,Booty) values @guildName+'_ULimit_4', 1, 0, @FoundationDate,0,0)
    insert _Guild(Name, Lvl, GatheredSP, FoundationDate,Alliance,Booty) values @guildName+'_ULimit_5', 1, 0, @FoundationDate,0,0)


    insert _Guild(Name, Lvl, GatheredSP, FoundationDate,Alliance,Booty) values @guildName, 5, 0, @FoundationDate,0,0)
    set @guildID = @@identity
    
    if (@@error <> 0 or @@rowcount = 0 or @guildID = 0)
    begin
        rollback transaction
        return -5
    end


    --길드장은 퍼미션이 0xffffffff !!
    declare @rvalue int
    exec @rvalue = _Guild_FnAddMember @guildID, @CreaterID, 0, @FoundationDate,0xffffffff
    if (@@error <> 0 or @rvalue <= 0)
    begin
        rollback transaction
        return @rvalue
    end
    
    -- 길드 창고를 생성하자
    exec @rvalue = _Guild_CreateChest_NoTX @guildID
    if (@@error <> 0 or @rvalue <= 0)
    begin
        rollback transaction
        return @rvalue
    end


commit transaction
    return @guildID
    
/* Credits by Apollo : Skype apollo1337_1*/
Msg 102, Level 15, State 1, Procedure _Guild_FnAddMember, Line 55
Incorrect syntax near '@guildID'. ???
07/16/2014 22:30 Eslam Galull#6
not recommend to change guild or union limits .. it will cuz some bugs later ^^
07/17/2014 12:41 vnkzo01#7
Quote:
Originally Posted by Little Messi View Post
Msg 102, Level 15, State 1, Procedure _Guild_FnAddMember, Line 55
Incorrect syntax near '@guildID'. ???
How . Me too :(
07/19/2014 01:26 $Apollo#8
[Only registered and activated users can see links. Click Here To Register...]
07/19/2014 11:38 PlantiX#9
Quote:
Originally Posted by its.soul View Post
not recommend to change guild or union limits .. it will cuz some bugs later ^^
Which bugs ?
07/20/2014 23:00 Eslam Galull#10
1st (tested bug ) when guild register fw the minmum user limit bugged some times can register even with 1 member .. sometimes didnt accept register even the guild 25/30

- it depends on the limit changes .. Ppl dont think you can change guild members even to maxmium 20 ..

2nd bug ( tested ) at areana guild register some times didnt telport all registered users
and some times it telports all guild in ( tested on 20 limit )

.. i didnt test the union limit !

but i like trace the orginial coding way .. buggs appear with testing ..SO keep testing

@plantix

From ur Server Website

Quote:
Important announcement:

With our serverinspection at 24th/25th July we change our union-/guildsystem.

There will be a unionlimit (2 guilds per union) and a guildlimit (30 players per guild).

Please note (its very important!!!): Every union with more than 2 guilds and every guild with more than 30 players will be deleted (deadline: 24th July 00:00 Servertime). If we delete a guild, everything related to the guild will be deleted too (guildstorage, fortress).

From now on, you have enough time to talk to your guildmates for who will stay and will leave to avoid the deletion of your guild.
Sounds not good !! .. just do it & test let me know what will you will found
07/21/2014 16:02 wolff66#11
I am pretty sure that this union limit wont work, u are just simply creating new guilds nothing else nothing more, but u are missing alliancecreate and alliancedelete
11/14/2014 00:45 endiness#12
Good jop
11/15/2014 19:53 endiness#13
Thanks Dude Well Done
12/10/2014 08:11 ValtheaOnline#14
anyway know how to edit sro_client to make it works any number instead of 50 members in guild?
12/10/2014 08:42 Anonymous-6723#15
Good idea, but as @wolff66 said the union limit wont work by just creating the guilds, you will have to edit alliancecreate procedure to "insert" those guilds once an alliance is created and of course modify the alliancedelete procedure to make it impossible to delete guilds with name like @GuildName + 'Limit' or something like it.. :)