ShowRules Bug.
#1

So, I've made this /showrules command, basically just shows a dialog for the rules. with Accept or Deny. When I /showrules to someone, it crashes the server. Here's the lines.

pawn Код:
}
    if(strcmp(cmd, "/showrules", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, COLOR_GREY, "  <| USAGE: /showrules [PlayerID or PartOfName] |>");
                return 1;
            }
            giveplayerid = ReturnUser(tmp);
            new targetlevel = PlayerStats[giveplayerid][pAdmin];
            new playerlevel = PlayerStats[playerid][pAdmin];
            if(targetlevel > playerlevel)
            {
                SendClientMessage(playerid, COLOR_GREY, "  <| You cannot use that command on this Administrator! |>");
                return 1;
            }
            if (PlayerStats[playerid][pAdmin] >= 1)
            {
                if(IsPlayerConnected(giveplayerid) || giveplayerid != INVALID_PLAYER_ID)
                {
                    new showrulesstring[700];
                    GetPlayerName(playerid, sendername, sizeof(sendername));
                    GetPlayerName(giveplayerid, givername, sizeof(givername));
                    format(string, sizeof(string), "  <| %s has shown {FFFF00}%s {FF6347}the StuntNoobZ Rules |>", sendername, givername);
                    SendClientMessageToAll(COLOR_LIGHTRED, STRING);
                    strcat(showrulesstring, "   {FFFF00}All rules must be followed on StuntNoobZ!\n\n\n", sizeof(showrulesstring));
                    strcat(showrulesstring, "{FF6347}Any form of Cheating or Hacking is NOT tolerated on StuntNoobZ with a punishment of a permanent ban.\n\n", sizeof(showrulesstring));
                    strcat(showrulesstring, "{AFAFAF}Respect ALL Players, not just the StuntNoobZ Administrators\n\n", sizeof(showrulesstring));
                    strcat(showrulesstring, "{AFAFAF}Do not overkill players, as in don't spawn kill them over and over.\n\n", sizeof(showrulesstring));
                    strcat(showrulesstring, "{AFAFAF}Begging for Administrator Status will only reduce your chances of getting chosen to become one, so don't do it!\n\n", sizeof(showrulesstring));
                    strcat(showrulesstring, "{AFAFAF}No racist, offensive, or discriminating comments towards one another.\n\n", sizeof(showrulesstring));
                    strcat(showrulesstring, "{AFAFAF}If you have issues with another player, do not argue with them about it, consult an Administrator, or simply just ignore the player.\n\n", sizeof(showrulesstring));
                    strcat(showrulesstring, "{AFAFAF}Please enjoy yourself and allow others to have fun too!\n\n", sizeof(showrulesstring));
                    strcat(showrulesstring, "{AFAFAF}StuntNoobZ is an {FF6347}18+ {AFAFAF}server!\n\n", sizeof(showrulesstring));
                    strcat(showrulesstring, "{AFAFAF}Owner: [R]Skriptz\n\n", sizeof(showrulesstring));
                    strcat(showrulesstring, "{005353}The [R] Crew ( Roam1n ) has settled here in StuntNoobZ, so please treat them with respect just as you would an Administrator, as we do not take shit.\n\n", sizeof(showrulesstring));
                    ShowPlayerDialog(giveplayerid, RULESDIALOG, DIALOG_STYLE_MSGBOX, "  {FFFF00}StuntNoobZ - Rules!",showrulesstring,"Accept","Deny");
                    return 1;
                }
                else
                {
                    format(string, sizeof(string), "  <| ID%;d is not connected! |>", giveplayerid);
                    SendClientMessage(playerid, COLOR_GREY, string);
                    return 1;
                }
            }
            else
            {
                SendClientMessage(playerid, COLOR_GREY, "  <| You must be an Administrator to use this command! |>");
                return 1;
            }
        }
        return 1;
    }
And then the Dialog:
pawn Код:
}
    if(dialogid == RULESDIALOG)
    {
        if(response)
        {
            new pName[MAX_PLAYER_NAME], string[128];
            GetPlayerName(playerid, pName, MAX_PLAYER_NAME);
            format(string, sizeof(string),"  <| {FFFF00}%s {33AA33}has accepted the rules! |>", pName);
            SendClientMessageToAll(COLOR_LIGHTGREEN, string);
            TogglePlayerControllable(playerid, 1);
        }
        else
        {
            new pName[24];
            new string[128];
            GetPlayerName(playerid, pName, 24);
            format(string,128, "  <| %s has been kicked because they didn't accept the StuntNoobZ rules! |>", pName);
            SendClientMessageToAll(COLOR_LIGHTRED,string);
            Kick(playerid);
            SendClientMessage(playerid,COLOR_RED, "  <| If you don't accept our rules, you don't belong here |>");
        }
        return 1;
    }
Any help would be appreciated greatly.
Reply


Messages In This Thread
ShowRules Bug. - by TyThaBomb - 13.05.2012, 14:57

Forum Jump:


Users browsing this thread: 2 Guest(s)