Shoutbox Script Edit [BUG]

Status
Not open for further replies.

Weasel

👄 I'd intercept me
Nov 25, 2011
4,147
2,469
Alright, I editted some shoutbox script so there is another rank. But therefore I also added some other scripts like /addtrial. Somehow, now it stops working. Could someone find the bug? I searched an hour for it, couldn't find it.

Original:


Editted (where the bug is):


Thnx anyway.
 

RastaLulz

fight teh power
Staff member
May 3, 2010
3,935
3,936
You honestly think someone's going to sift through all of that code for you to find an error?

Only advice I can give to you is to check your JavaScript console if you aren't getting any PHP errors. If nothing shows up, then I guess you'll have to start over again. However, it should be quite obvious what the issue is when you're coding something, and then it stops working.
 

Weasel

👄 I'd intercept me
Nov 25, 2011
4,147
2,469
I was thinking about that to Rasta, here are the codes I editted (not from the original version, this are the editted ones):

PHP:
  if ($row['rank'] == "6") {
                                        $name = $adminchar . $row['name'];
                                        $sclass = "name_black";
                                }
                                elseif ($row['rank'] == "5") {
                                        $name = $modchar . $row['name'];
                                        $sclass = "name_green";
                                }
                                elseif ($row['rank'] == "4") {
                                        $name = $modchar . $row['name'];
                                        $sclass = "name_orange";
                                }
                                elseif ($row['rank'] == "1"){
                                        $name = $vipchar . $row['name'];
                                        $sclass = "name_blue";
                                }
                                else {
                                        $name = $row['name'];
                                        $sclass = "name_blue";
                                }
                                echo "$id" . $breakchr . "" . $breakchr . "$name" . $breakchr . "$sclass" . $breakchr . "$message" . $breakchr;
                        }
                        if (mysql_num_rows($query) != 0) {
                                query("UPDATE `chat_sessions` SET `lastid`='$id' WHERE `name`='{$sesdata['name']}'");
                        }
                }
        }

&

PHP:
        elseif ($sesdata['rank'] == 4 or $sesdata['rank'] == 5 or $sesdata['rank'] == 6) { //Admin commands
        if ($msplit[0] == "/adminhelp") {
        syspm($sesdata['name'],"[b]Shoutbox Staff Help Menu[/b]");
        syspm($sesdata['name'],"/kick user - Kicks a user");
        syspm($sesdata['name'],"/mute user - Stops a user from talking");
        syspm($sesdata['name'],"/unmute user - Allows the user to talk again");
        if ($sesdata['rank'] == 5 or $sesdata['rank'] == 6) {
        syspm($sesdata['name'],"/bottalk msg - Makes the system bot talk");
        syspm($sesdata['name'],"/ban user <time> - Bans a user for <time> minutes");
        if ($sesdata['rank'] == 6) {
        syspm($sesdata['name'],"/addtrial user - Sets <user> to be a trial");
        syspm($sesdata['name'],"/addadmin user - Sets <user> to be a admin");
        syspm($sesdata['name'],"/addmod user - Sets <user> to be a moderator");
        syspm($sesdata['name'],"/rempriv user - Removes <user>'s admin/mod privileges");
        syspm($sesdata['name'],"/delreg user - Deletes <user>'s user registration");
        }
        }
        }
        }

And I added this into it:

PHP:
 elseif ($msplit[0] == "/addtrial") {
                        if (!userexists($msplit[1])) {
                                syspm($sesdata['name'],"The user you are trying to add does not exist.");
                        }
                        else {
                                query("UPDATE `chat_users` SET `rank`='4' WHERE `user`='{$msplit[1]}'");
                                query("UPDATE `chat_sessions` SET `rank`='4' WHERE `name`='{$msplit[1]}'");
                                sendnicklist();
                                syspm($sesdata['name'],"{$msplit[1]} has been added as an trial.");
                        }
                }
 
Status
Not open for further replies.

Users who are viewing this thread

Top