GM/unGM stored procedure

Results 1 to 8 of 8
  1. #1
    Apprentice MashiroShiina is offline
    MemberRank
    Apr 2014 Join Date
    11Posts

    GM/unGM stored procedure

    This is my first release and I hope you guys like it.

    First of all, for all of you having problems with gm's ip check.

    Code:
    USE [Account]
    GO
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    ALTER PROCEDURE [dbo].[cabal_sp_gm_ip_check](@UserIP CHAR(16), @Registered BIT OUTPUT)
    AS
    BEGIN
    SET @Registered = 1;
    END;
    Credits to Alphakilo23.

    This is the procedure I made for creating a gm account:

    Code:
    USE [Server01]
    GO
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    CREATE PROCEDURE [dbo].[gm_account_by_mashiroshiina]
    ( 
        @charname varchar(50),
        @tag varchar(20)
        
    )
    AS
    BEGIN
    BEGIN TRAN
    
    
    begin
    
    
    declare @usernum int
    
    
    --getting usernum
    select @usernum = UserNum
    from Account.dbo.cabal_auth_table,Server01.dbo.cabal_character_table
    where Name=@charname and UserNum=floor(CharacterIdx/8);
    
    
    --transmuter
    exec CabalCash.dbo.up_AddMyCashItemByItem @usernum,'0','1','644','0','31';
    --combo skill
    exec CabalCash.dbo.up_AddMyCashItemByItem @usernum,'0','1','2105','0','31';
    --Bike skill
    exec CabalCash.dbo.up_AddMyCashItemByItem @usernum,'0','1','2106','0','31';
    --GM stick
    exec CabalCash.dbo.up_AddMyCashItemByItem @usernum,'0','1','4657','0','31';
    
    
    --GM buff
    update Server01.dbo.cabal_skilllist_table
    set Data=Data+0xCE01012500
    from Server01.dbo.cabal_skilllist_table a, Server01.dbo.cabal_character_table b, Account.dbo.cabal_auth_table
    where Usernum=floor(a.CharacterIdx/8) and a.CharacterIdx=b.CharacterIdx and Name=@charname
    
    
    --updating char fields
    update  Server01.dbo.cabal_character_table
    set Nation =3,
    MapsBField =4095,
    WarpBField =4095,
    Style =(style+152),
    Lev =190,
    Reputation =2000000000,
    Alz =10000000,
    Str =9999,
    Dex =9999,
    Int =9999,
    SwdPNT =99999999,
    MagPNT =99999999 ,
    Rank=2570
    from Account.dbo.cabal_auth_table,Server01.dbo.cabal_character_table
    where Name=@charname and UserNum=floor(CharacterIdx/8);
    
    
    --update ecoin
    update CabalCash.dbo.CashAccount
    set Cash=1000
    from CabalCash.dbo.CashAccount,Server01.dbo.cabal_character_table
    where Name=@charname and UserNum=floor(CharacterIdx/8);
    
    
    --change name/add tag
    update  Server01.dbo.cabal_character_table
    set Name = (@tag+Name)
    from Account.dbo.cabal_auth_table,Server01.dbo.cabal_character_table
    where Name=@charname and UserNum=floor(CharacterIdx/8);
    
    
    
    
    end
    COMMIT TRAN    
    END
    This is the one for removing gm permissions.

    Code:
    USE [Server01]
    GO
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    CREATE PROCEDURE [dbo].[ungm_account_by_mashiroshiina]
    ( 
        @charname varchar(50),
        @tag varchar(20)
            
    )
    AS
    BEGIN
    BEGIN TRAN
    
    
    begin
    
    
    --removing char fields
    update  Server01.dbo.cabal_character_table
    set Nation =1,
    Lev =1
    from Account.dbo.cabal_auth_table,Server01.dbo.cabal_character_table
    where Name=@charname and UserNum=floor(CharacterIdx/8);
    
    
    --removing account web access
    update Account.dbo.cabal_auth_table
    set Password=pwdencrypt('exgmpassword')
    from Account.dbo.cabal_auth_table,Server01.dbo.cabal_character_table
    where Name=@charname and UserNum=floor(CharacterIdx/8);
    
    
    --remove ecoin
    update CabalCash.dbo.CashAccount
    set Cash=0
    from CabalCash.dbo.CashAccount,Server01.dbo.cabal_character_table
    where Name=@charname and UserNum=floor(CharacterIdx/8);
    
    
    update  Server01.dbo.cabal_character_table
    set Name = REPLACE(Name,@tag,'')
    from Account.dbo.cabal_auth_table,Server01.dbo.cabal_character_table
    where Name=@charname and UserNum=floor(CharacterIdx/8);
    
    
    
    
    end
    COMMIT TRAN    
    END
    In order to run it, all you need to execute is:

    exec Server01.dbo.gm_account_by_mashiroshiina 'CHARNAME','TAG'

    exec Server01.dbo.ungm_account_by_mashiroshiina 'CHARNAME','TAG'

    As you may noticed, I'm giving everything a GM needs to do their job. If I'm missing something, just append it ;)
    Last edited by MashiroShiina; 09-04-14 at 08:30 PM.


  2. #2
    Storm Rider devit65 is offline
    MemberRank
    Jan 2010 Join Date
    SRGAMESLocation
    267Posts

    Re: GM/unGM stored procedure

    CRATE PROCEDURE [dbo].[gm_account_by_mashiroshiina]


    succes work

  3. #3
    Apprentice MashiroShiina is offline
    MemberRank
    Apr 2014 Join Date
    11Posts

    Re: GM/unGM stored procedure

    You're right, forgot to modify that part. Thank you :)
    Updated, now it should work fine C:

  4. #4
    Apprentice Kome Keto is offline
    MemberRank
    Oct 2007 Join Date
    22Posts

    Re: GM/unGM stored procedure

    Very good, this is not my task on the server but is good to have :D...
    To fit our need i'm only going to replace the tags from names with titles, this is how we are doing now :D, i dont know if you know but [] are reserved characters on MSSQL, and can be a problem when using searching with like: SELECT * FROM ABC.cabal_character_table WHERE name LIKE '[GM]%'.

    Keep good work, ty :D
    Last edited by Kome Keto; 10-04-14 at 05:20 AM. Reason: Some typos :D

  5. #5
    Apprentice MashiroShiina is offline
    MemberRank
    Apr 2014 Join Date
    11Posts

    Re: GM/unGM stored procedure

    You're right about the problem on like '[GM]%'
    But it works perfectly with this query:

    Code:
    select * from cabal_character_table
    where name like '%GM]%'
    Using acc roles is also good for finding staff members :)

    Btw, I'm also using titles but I removed it from the sp to avoid issues since we have it customized.

    Thank you for the tip :)
    Last edited by MashiroShiina; 10-04-14 at 07:50 AM.

  6. #6
    Apprentice asgat is offline
    MemberRank
    Nov 2013 Join Date
    IndonesiaLocation
    6Posts

    Re: GM/unGM stored procedure

    how to use this sir? is it just write in mssql? or?

    - - - Updated - - -

    how to use this sir? is it just write in mssql? or?

  7. #7
    Valued Member xDarkMoon is offline
    MemberRank
    Nov 2012 Join Date
    The moonLocation
    142Posts

    Re: GM/unGM stored procedure

    Quote Originally Posted by asgat View Post
    how to use this sir? is it just write in mssql? or?

    - - - Updated - - -

    how to use this sir? is it just write in mssql? or?
    Read Mashiro's post?

  8. #8
    Alpha Member sasuke is offline
    MemberRank
    Oct 2007 Join Date
    In your houseLocation
    1,664Posts

    Re: GM/unGM stored procedure

    and good works but no longer work skills



Advertisement