Results 1 to 10 of 23

Thread: Files for extended Server + Random-Scripts like sliding mapvote on Deathrun

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #2
    Global Mossaderator Mitch's Avatar
    Join Date
    Nov 2012
    Posts
    654
    Thanks
    204
    Thanked 450 Times in 305 Posts
    Very nice, I have been looking into some of the work. I would myself change this:

    PHP Code:
    CREATE TABLE IF NOT EXISTS `players` (
      `
    idint(10NOT NULL AUTO_INCREMENT,
      `
    uservarchar(32) DEFAULT NULL,
      `
    passvarchar(32) DEFAULT NULL,
      `
    moneyint(10) DEFAULT NULL,
      `
    xpint(10) DEFAULT NULL,
      `
    killsint(10) DEFAULT NULL,
      `
    headshotsint(10) DEFAULT NULL,
      `
    melee_killsint(10) DEFAULT NULL,
      `
    longest_killstreakint(10) DEFAULT NULL,
      
    PRIMARY KEY (`id`)
    ENGINE=MyISAM DEFAULT CHARSET=latin1
    to

    PHP Code:
    CREATE TABLE IF NOT EXISTS `players` (
      `
    idint(10NOT NULL AUTO_INCREMENT,
      `
    uservarchar(32) DEFAULT NULL,
      `
    passvarchar(32) DEFAULT NULL,
      `
    moneyint(10) DEFAULT 0,
      `
    xpint(10) DEFAULT 0,
      `
    killsint(10) DEFAULT 0,
      `
    headshotsint(10) DEFAULT 0,
      `
    melee_killsint(10) DEFAULT 0,
      `
    longest_killstreakint(10) DEFAULT 0,
      
    PRIMARY KEY (`id`)
    ENGINE=MyISAM DEFAULT CHARSET=latin1
    Now you don't need to set the value for money, xp etc.. Also you don't need to use the function IFNULL to check if the value is null. Like is done here:

    PHP Code:
    CREATE FUNCTION statsDeltaMoney (id_ INTmoney_ INT)
    RETURNS INT
    DETERMINISTIC
    BEGIN
        
    DECLARE ret INT;
        
    SET ret NULL;
        
    UPDATE players SET money=IFNULL(money,0)+money_ WHERE id id_;
        
    SELECT money FROM players WHERE id id_ INTO ret;
        RETURN 
    ret;
    END 

  2. The Following User Says Thank You to Mitch For This Useful Post:

    kung foo man (13th January 2013)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •