EXP Lock + No EXP Loose + AdminCP added Function

Results 1 to 13 of 13
  1. #1
    Sultan of Yolo Demantor is offline
    MemberRank
    May 2008 Join Date
    GermanyLocation
    1,266Posts

    wink EXP Lock + No EXP Loose + AdminCP added Function

    Locking XP of a Player + No EXP Loose:

    First, you might need to know that the EXP is added by the Database(as i know so far), The MatchServer is just calling Database Procedures to update the Database data like the EXP/XP of a player.

    There are more than 1 Procedure which can update the XP of a player, but i think just 2 of them are the ones called while gaining XP in game.

    The First Procedure is: spSimpleUpdateChar
    The Second Procedure is: spUpdateCharInfoData

    To lock Player(s) XP, simply check if the player exists in a list(a Table).

    First Step so:

    Creating a new Table called: explock, by Executting this:

    Code:
    USE [GunzDB]
    GO
    /****** Objekt:  Table [dbo].[explock]    Skriptdatum: 08/11/2010 13:47:45 ******/
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    SET ANSI_PADDING ON
    GO
    CREATE TABLE [dbo].[explock](
    	[CID] [int] NOT NULL,
    	[Name] [varchar](50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
    	[Staff] [varchar](50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
    	[StaffAid] [int] NULL,
    	[Date] [datetime] NULL
    ) ON [PRIMARY]
    
    GO
    SET ANSI_PADDING OFF

    Second Step:

    Go to your GunzDB --> Saved Procedures --> spUpdateCharInfoData.
    Click to modify it and replace it with this then execute (it will block negative XP to be add[subtracting XP] and will check the CID of the player if he is in the Table we created shortly:

    Code:
    set ANSI_NULLS ON
    set QUOTED_IDENTIFIER ON
    GO
    
    
    
    
    /* 캐릭터 정보(XP, BP, KillCount, DeathCount) 업데이트 */
    ALTER PROC [dbo].[spUpdateCharInfoData]
      @XPInc        int,
      @BPInc        int,
      @KillInc      int,
      @DeathInc     int,
      @CID          int
    AS
    SET NOCOUNT ON
      
    DECLARE @CIDCount int
    SELECT @CIDCount=COUNT(*) FROM explock(nolock) WHERE CID=@CID
    
    If (@XPInc > 0 AND @CIDCount <> 1)
    Begin
    UPDATE Character 
    SET XP=XP+(@XPInc), BP=BP+(@BPInc), KillCount=KillCount+(@KillInc), DeathCount=DeathCount+(@DeathInc)
    WHERE CID=@CID
    End
    else
    Begin
    UPDATE Character 
    SET BP=BP+(@BPInc), KillCount=KillCount+(@KillInc), DeathCount=DeathCount+(@DeathInc)
    WHERE CID=@CID
    End

    Third Step:

    Go to your GunzDB --> Saved Procedures --> spSimpleUpdateChar.
    Click to modify it and replace this code(execute it then of course) This makes the same as in step 2 but this is just another Procedure:

    Code:
    set ANSI_NULLS ON
    set QUOTED_IDENTIFIER ON
    GO
    
    
    
    /* 캐릭터 정보 업데이트 - 한사람 죽일때마다 업데이트한다. */
    ALTER PROC [dbo].[spSimpleUpdateChar]
    	@CID		int,
    	@Name		varchar(24),
    	@Level		smallint,
    	@XP		int,
    	@BP		int
    AS
    SET NOCOUNT ON
    DECLARE @CIDCount int
    --DECLARE @UGradeID    int
    --DECLARE @AID    int
    
    SELECT @CIDCount=COUNT(*) FROM explock(nolock) WHERE CID=@CID
    --SELECT @AID=AID FROM Character where CID=@CID
    --SELECT @UGradeID=UGradeID FROM Account WHERE AID=@AID
    
    If (@XP > 0 AND @CIDCount <> 1)
    Begin
    /*If (@UGradeID < 252)
    begin*/
    UPDATE Character WITH (rowlock)
    SET Level=@Level, XP=@XP, BP=@BP
    WHERE CID=@CID AND Name=@Name
    End
    else
    Begin
    UPDATE Character WITH (rowlock)
    SET BP=@BP
    WHERE CID=@CID AND Name=@Name
    End
    
    /*else if (@UGradeID >=252 and @UGradeID <> 253)
    begin
    UPDATE Character WITH (rowlock)
    SET XP=@XP, BP=@BP
    WHERE CID=@CID AND Name=@Name
    End
    */
    Step 4 (optinal) file: characters.php:

    Now a simple edit in your Admin Panel, this is a very old code, you might edit it to make it better, but this works 100%:

    You might add this after or before any if and elseif, but be sure you close the brackets correctly:

    PHP Code:
    }elseif ( isset($_POST['lockexp'])){
             
            Require 
    "config1.php"//cuz i like mssql
            
            
    $type clean_sql($_POST['type']);
            
    $lockname clean_sql($_POST['lockname']);
            
             if( 
    $type == "" || $lockname == "" )
            {
                
    setmessage("EXP Lock Character""Fill in the field!");
                
    redirect("index.php?do=characters");
                die();
            }
            
            if (
    $type == 0){
            
    $lol 'Name';
            }else{
            
    $lol 'CID';
            }
            
    $swapper mssql_query ("SELECT * FROM explock WHERE $lol = '$lockname'");
            
            If (
    Mssql_num_rows ($swapper) == 1){
            
    setmessage("EXP Lock Character""The Entered Character $lol$lockname is already EXP Locked :)");
                
    redirect("index.php?do=characters");
                die();
            }
            
            if (
    $type == 0){
            
    $checkname Mssql_query ("SELECT CID FROM Character WHERE Name = '$lockname'");
            
            if (
    mssql_num_rows($checkname) != 1){
               
                
    setmessage("EXP Lock Character""The Entered Character Name: $lockname doesn't Exsit!");
                
    redirect("index.php?do=characters");
                die();
                
            }elseif (
    mssql_num_rows($checkname) == 1){
            
    $checknameinfo mssql_fetch_object ($checkname);
            
    $CID $checknameinfo->CID;
            
    Mssql_query ("INSERT INTO explock (CID, Name, Staff, StaffAid, Date) VALUES ('$CID', '$lockname', '$_SESSION[UserID]', '$_SESSION[AID]', GETDATE())");
            
    setmessage("EXP Lock Character""The Entered Character Name: $lockname has been EXP Locked Successfully!");
                
    redirect("index.php?do=characters");
                die();
            
            }
            }elseif (
    $type == 1){
            
    $checkcid mssql_query("SELECT CID, Name FROM Character WHERE CID = '$lockname'");
            
            If (
    mssql_num_rows($checkcid ) == 1){
            
    $info mssql_fetch_object ($checkcid);
            
    $Charname $info->Name;
            
    Mssql_query ("INSERT INTO explock (CID, Name, Staff, StaffAid, Date) VALUES ('$lockname', '$Charname', '$_SESSION[UserID]', '$_SESSION[AID]', GETDATE())");
            
    setmessage("EXP Lock Character""The Entered Character CID: $lockname Name: $Charname has been EXP Locked Successfully!");
                
    redirect("index.php?do=characters");
                die();
            }else{
            
    setmessage("EXP Lock Character""The Entered Character CID: $lockname doesn't Exsit!");
                
    redirect("index.php?do=characters");
                die();
            
            }
            } 
    config1.php:

    PHP Code:
    <?php

    $mssql_user 
    "me";

    $mssql_pass "1234"

    $mssql_database 'yahooDB'

    $mssql_host 'yahoo.com/sqlexpress';

    $conn mssql_connect($mssql_host$mssql_user$mssql_pass); 
    mssql_select_db($mssql_database);
    ?>
    and for the HTML code, paste it after or before any table there:

    PHP Code:
    <br />
    <
    table style="border-collapse: collapse;" id="lockchar"
     
    border="1">
      <
    tbody>
        <
    tr>
          <
    td colspan="2"><b>Lock EXP Character</b></td>
        </
    tr>
        <
    tr>
          <
    td colspan="2">&nbsp;</td>
        </
    tr>
        <
    form method="post" action="index.php?do=characters">
          <
    tr>
            <
    td>
            <
    select name="type">
            <
    option value="0">Name</option>
            <
    option value="1">CID</option>
            </
    select>
    :&
    nbsp;&nbsp;<input name="lockname" type="text">&nbsp;&nbsp;<input
     name
    ="lockexp" value="Lock EXP" type="submit">
            </
    td>
          </
    tr>
          <
    tr>
            <
    td colspan="2">&nbsp;</td>
          </
    tr>
        </
    form>
      </
    tbody>
    </
    table>
    <
    br /> 


  2. #2
    Infraction Banned MicroManiacs is offline
    MemberRank
    Apr 2009 Join Date
    326Posts

    Re: EXP Lock + No EXP Loose + AdminCP added Function

    Great tutorial, this will be very usefull thank you.

  3. #3
    Account Upgraded | Title Enabled! landoncasis is offline
    MemberRank
    Mar 2009 Join Date
    PhilippinesLocation
    271Posts

    Re: EXP Lock + No EXP Loose + AdminCP added Function

    very nice! Im was looking for this. Thanks!

  4. #4
      Phoenix is offline
    ModeratorRank
    Mar 2009 Join Date
    6,890Posts

    Re: EXP Lock + No EXP Loose + AdminCP added Function

    Thanks a LOT!

  5. #5
    Veni, Vidi, Vici Arcelor is offline
    MemberRank
    Jan 2010 Join Date
    Delhi, IndiaLocation
    1,763Posts

    Re: EXP Lock + No EXP Loose + AdminCP added Function

    Where ya been keeping them o german?

  6. #6
    Sultan of Yolo Demantor is offline
    MemberRank
    May 2008 Join Date
    GermanyLocation
    1,266Posts

    Re: EXP Lock + No EXP Loose + AdminCP added Function

    ty for replying xD
    Quote Originally Posted by Arcelor View Post
    Where ya been keeping them o german?
    what do you mean?... yes, german :P

  7. #7
    Doggie And Rice. Military is offline
    MemberRank
    Jun 2009 Join Date
    Here and AboutLocation
    3,302Posts

    Re: EXP Lock + No EXP Loose + AdminCP added Function

    thanks for it.

  8. #8
    Apprentice OldCrash is offline
    MemberRank
    Aug 2008 Join Date
    19Posts

    Re: EXP Lock + No EXP Loose + AdminCP added Function

    thanks =]

  9. #9
    num num num <3 rootbeer daniel131605 is offline
    MemberRank
    Jul 2008 Join Date
    New YorkLocation
    573Posts

    Re: EXP Lock + No EXP Loose + AdminCP added Function

    nice :)

  10. #10
    Gunz League owner Hakurah is offline
    MemberRank
    Dec 2006 Join Date
    Rio de JaneiroLocation
    602Posts

    Re: EXP Lock + No EXP Loose + AdminCP added Function

    Excellent work! You've been thanked. :)

  11. #11
      Phoenix is offline
    ModeratorRank
    Mar 2009 Join Date
    6,890Posts

    Re: EXP Lock + No EXP Loose + AdminCP added Function

    I followed all the steps but if I enter a character name and click "Exp lock", it says "The Entered Character Name: phoenix doesn't Exsit!"

  12. #12
    Sultan of Yolo Demantor is offline
    MemberRank
    May 2008 Join Date
    GermanyLocation
    1,266Posts

    talk Re: EXP Lock + No EXP Loose + AdminCP added Function

    Quote Originally Posted by phoenix_147 View Post
    I followed all the steps but if I enter a character name and click "Exp lock", it says "The Entered Character Name: phoenix doesn't Exsit!"
    then you made something wrong, im sure that the script works 100% and i used it long ago with ctgunz and worked fine and still working fine xD...

    Post what you did, and im sure you made something wrong :)

  13. #13
    DRGunZ 2 Creator wesman2232 is offline
    MemberRank
    Jan 2007 Join Date
    Erie, PALocation
    4,872Posts

    Re: EXP Lock + No EXP Loose + AdminCP added Function

    Sorry for the bump :P

    Here is a suggestion if it already isn't in there :
    Make it so where they can only lose exp and not gain.



Advertisement