• Unfortunately, we have experienced significant hard drive damage that requires urgent maintenance and rebuilding. The forum will be a state of read only until we install our new drives and rebuild all the configurations needed. Please follow our Facebook page for updates, we will be back up shortly! (The forum could go offline at any given time due to the nature of the failed drives whilst awaiting the upgrades.) When you see an Incapsula error, you know we are in the process of migration.

addForbid[fix]

Status
Not open for further replies.
Banned
Banned
Joined
Dec 17, 2011
Messages
470
Reaction score
245
Many servers have problems with forbid tables when a gm bans a player it wont display the gm id this procedure will fix that.

Code:
DROP PROCEDURE `addForbid`//
CREATE DEFINER=`root`@`localhost` PROCEDURE `addForbid`(in userid1 INTEGER, in type1 INTEGER, in forbid_time1 INTEGER, in reason1 BINARY(255), in gmroleid1 INTEGER)
BEGIN
 DECLARE rowcount INTEGER;
  START TRANSACTION;
    UPDATE forbid SET ctime = now(), forbid_time = forbid_time1, reason = reason1, gmroleid = gmroleid1 WHERE userid = userid1 AND type = type1;
    SET rowcount = ROW_COUNT();
    IF rowcount = 0 THEN
      INSERT INTO forbid VALUES(userid1, type1, now(), forbid_time1, reason1, gmroleid1);
    END IF;
  COMMIT;
END
 
Last edited:
Robb
Loyal Member
Joined
Jan 22, 2009
Messages
1,224
Reaction score
466
Thats funny i was looking into this just this morning, except i looked inside the authd code not the procedure. Never expected such a basic mistake inside the sql.

Awesome fix.
 
Black Magic Development
Loyal Member
Joined
Apr 29, 2010
Messages
2,170
Reaction score
600
Nice little fix.

One thing that always bothered me was the use of CAPS in SQL statements. I know technically they still exist because of IBM's old SQL stuff, but now it's all case insensitive and just looks weird..
 
Robb
Loyal Member
Joined
Jan 22, 2009
Messages
1,224
Reaction score
466
Nice little fix.

One thing that always bothered me was the use of CAPS in SQL statements. I know technically they still exist because of IBM's old SQL stuff, but now it's all case insensitive and just looks weird..

Atleast its not like java. I've spent 2 hours before trying to find a bug simply to discover I missed a capital letter of the start of one random line.
 
Genesis?Is it a new drug?
Joined
Apr 8, 2010
Messages
512
Reaction score
96
Atleast its not like java. I've spent 2 hours before trying to find a bug simply to discover I missed a capital letter of the start of one random line.

Yep... you have to double your attention when you're programming in java, because any stupid detail you forget, you get punished xD
 
Black Magic Development
Loyal Member
Joined
Apr 29, 2010
Messages
2,170
Reaction score
600
Well that is why I've come to love C# after years of being with Java... Visual Studio is just such an amazing IDE that it gives you that nice red underline and screams HEY THIS DOESN'T LOOK RIGHT if it won't compile ;o
 
Genesis?Is it a new drug?
Joined
Apr 8, 2010
Messages
512
Reaction score
96
Well that is why I've come to love C# after years of being with Java... Visual Studio is just such an amazing IDE that it gives you that nice red underline and screams HEY THIS DOESN'T LOOK RIGHT if it won't compile ;o

Hahaha, thanks for that info, it made me interested in C now...

Also, I tried to donwload it months ago, but that crap takes too much time, anyway, I'll be persistent now.

Edit:

String crap = "Microsoft server";
 
Newbie Spellweaver
Joined
Feb 15, 2011
Messages
92
Reaction score
19
Many servers have problems with forbid tables when a gm bans a player it wont display the gm id this procedure will fix that.

Code:
DROP PROCEDURE `addForbid`//
CREATE DEFINER=`root`@`localhost` PROCEDURE `addForbid`(in userid1 INTEGER, in type1 INTEGER, in forbid_time1 INTEGER, in reason1 BINARY(255), in gmroleid1 INTEGER)
BEGIN
 DECLARE rowcount INTEGER;
  START TRANSACTION;
    UPDATE forbid SET ctime = now(), forbid_time = forbid_time1, reason = reason1, gmroleid = gmroleid1 WHERE userid = userid1 AND type = type1;
    SET rowcount = ROW_COUNT();
    IF rowcount = 0 THEN
      INSERT INTO forbid VALUES(userid1, type1, now(), forbid_time1, reason1, gmroleid1);
    END IF;
  COMMIT;
END

this is realy nice fix , but honestly i`m not a programmer, where to fix this? :sneaky2:
 
Status
Not open for further replies.
Back
Top