Ban command.
#1

Hey Guys,

This is my ban command:
pawn Код:
if(strcmp(cmd, "/ban", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /ban [playerid/PartOfName] [reason]");
                return 1;
            }
            giveplayerid = ReturnUser(tmp);
            if (PlayerInfo[playerid][pAdmin] >= 1336)
            {
                if(IsPlayerConnected(giveplayerid))
                {
                    if(giveplayerid != INVALID_PLAYER_ID)
                    {
                        GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
                        GetPlayerName(playerid, sendername, sizeof(sendername));
                        new length = strlen(cmdtext);
                        while ((idx < length) && (cmdtext[idx] <= ' '))
                        {
                            idx++;
                        }
                        new offset = idx;
                        while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
                        {
                            result[idx - offset] = cmdtext[idx];
                            idx++;
                        }
                        result[idx - offset] = EOS;
                        if(!strlen(result))
                        {
                            SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /ban [playerid/PartOfName] [reason]");
                            return 1;
                        }
                        new year, month,day;
                        getdate(year, month, day);
                        format(string, sizeof(string), "AdmCmd: %s was banned by %s, reason: %s (%d-%d-%d)", giveplayer, sendername, (result),month,day,year);
                        format(string, sizeof(string), "AdmCmd: %s was banned by %s, reason: %s", giveplayer, sendername, (result));
                        SendClientMessageToAll(COLOR_LIGHTRED, string);
                        new INI:File = INI_Open(UserPath(playerid));
                        INI_SetTag(File,"data");
                        INI_WriteInt(File,"Banned",1);//this is not written in the tut by Kush so we need to make it ourselves
                        INI_Close(File);
                        Kick(playerid);
                        return 1;
                    }
                }//not connected
            }
            else
            {
                format(string, sizeof(string), "   %d is not an active player.", giveplayerid);
                SendClientMessage(playerid, COLOR_GRAD1, string);
            }
        }
        return 1;
    }
and this is the code when the player login:
pawn Код:
if (PlayerInfo[playerid][pRegisted] == 0)
{
if(fexist(UserPath(playerid)))
{
    INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
        ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,""COL_WHITE"Login",""COL_WHITE"You are already registered,please write your password below in order to log in! ","Login","Quit");
}
    else if(PlayerInfo[playerid][pBanned] == 1)//Checking if the user's file contains "Banned = 1", if that's true we continue if not we die :D
    {
    Ban(playerid); //Banning the player. I like to not send a Message saying that you have been banned..etc so the hacker doesn't know why it said "Server closed the connection" and changes his IP and the same thing happens and his new IP gets banned, stealthy shit :p
    SendClientMessage(playerid, COLOR, "You're banned from this server.");
    }
    else
    {
    ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT,""COL_WHITE"Welcome To Base RolePlay !",""COL_WHITE"Please enter your new password in order to register:","Register","Quit");
    }
}
The problem is that when I logining in I get this insted of "you banned from this server message":


http://imageshack.us/photo/my-images/818/samp000io.png/
Reply
#2

http://forum.sa-mp.com/showpost.php?...&postcount=969
Reply
#3

The problem is because you have that fking hacks.
Reply
#4

Quote:
Originally Posted by SuperViper
Посмотреть сообщение
It doesn't helped me bro..

Quote:
Originally Posted by newbienoob
Посмотреть сообщение
The problem is because you have that fking hacks.
I checked it but its not becuase of them..

More commands please
Reply
#5

Try debugging the code, and try to find any loopholes in your command and/or checking for the ban
Reply
#6

Problem solved.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)