No ban reason is showing but i have timers
#1

Код:
CMD:ban(playerid, params[])
{
    if(PlayerInfo[playerid][pAdmin] >= 2)
    {
        new string[128], giveplayerid, reason[64];
        if(sscanf(params, "us[64]", giveplayerid, reason)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /ban [playerid/partofname] [reason]");

        if(IsPlayerConnected(giveplayerid))
        {
            if(PlayerInfo[giveplayerid][pAdmin] > PlayerInfo[playerid][pAdmin])
            {
                if(AdminDuty[playerid] == 1)
                {
                    new username[MAX_PLAYER_NAME];
                    GetPVarString(playerid, "TempNameName", username, sizeof(username));
                    SetPVarInt(playerid, "TempName", 0);
                    SetPlayerName(playerid, username);
                }
                format(string, sizeof(string), "AdmCmd: %s has been auto-banned, reason: Trying to /ban a higher admin.", PlayerInfo[playerid][pAdminName]);
                ABroadCast(COLOR_YELLOW,string,1);
                new ip[32], cw[64], tstring[128], year, month, day, hour, minute, second;
                PlayerInfo[playerid][pBanned] = 1;
                AddBan(ip);
                GetPlayerIp(playerid,ip,sizeof(ip));
                getdate(year, month, day);
                gettime(hour, minute, second);
                format(tstring, sizeof(tstring), "Date/Time: %i.%i.%i, %i:%i:%i", day, month, year, hour, minute, second);
				format(cw, sizeof(cw), "Current Warnings: %i (3 for Ban)", PlayerInfo[playerid][pWarns]);
                SendClientMessage(playerid, COLOR_LIGHTRED, "--------------------- Ban Report ---------------------");
                SendClientMessage(playerid, COLOR_WHITE, cw);
                SendClientMessage(playerid, COLOR_WHITE, "Staff: Server");
                SendClientMessage(playerid, COLOR_WHITE, "Reason: Tried to ban a higher admin");
                SendClientMessage(playerid, COLOR_WHITE, tstring);
                SendClientMessage(playerid, COLOR_REALRED, "Make sure you have the Screenshot of this ban by pressing (F8)");
                SendClientMessage(playerid, COLOR_LIGHTRED, "Feel free to post a ban appeal at www.as-rp.forumtl.com. Have a nice day!");
                SetTimerEx("KickPlayer", 500, false, "i", playerid);
                return 1;
            }
            else
            {
                new playerip[32];
                GetPlayerIp(giveplayerid, playerip, sizeof(playerip));

                if(AdminDuty[giveplayerid] == 1)
                {
                    new username[MAX_PLAYER_NAME];
                    GetPVarString(giveplayerid, "TempNameName", username, sizeof(username));
                    SetPVarInt(giveplayerid, "TempName", 0);
                    SetPlayerName(giveplayerid, username);

                    format(string, sizeof(string), "AdmCmd: %s(IP:%s) was banned by %s, reason: %s", PlayerInfo[giveplayerid][pAdminName], playerip, GetPlayerNameEx(playerid), reason);
                    Log("logs/ban.log", string);
                    format(string, sizeof(string), "AdmCmd: %s was banned by %s, reason: %s", PlayerInfo[giveplayerid][pAdminName], GetPlayerNameEx(playerid), reason);
                }
                else
                {
                    format(string, sizeof(string), "AdmCmd: %s(IP:%s) was banned by %s, reason: %s", GetPlayerNameEx(giveplayerid), playerip, GetPlayerNameEx(playerid), reason);
                    Log("logs/ban.log", string);
                    format(string, sizeof(string), "AdmCmd: %s was banned by %s, reason: %s", GetPlayerNameEx(giveplayerid), GetPlayerNameEx(playerid), reason);
                }


                SendClientMessageToAllEx(COLOR_LIGHTRED, string);
                new ip[32];
                PlayerInfo[giveplayerid][pBanned] = 1;
                AddBan(ip);
                GetPlayerIp(giveplayerid,ip,sizeof(ip));
                new cw[64], tstring[128], sstring[128], rstring[128], aname[MAX_PLAYER_NAME], year, month, day, hour, minute, second;
                GetPlayerName(playerid, aname, sizeof(aname));
                getdate(year, month, day);
                gettime(hour, minute, second);
                format(tstring, sizeof(tstring), "Date/Time: %i.%i.%i, %i:%i:%i", day, month, year, hour, minute, second);
                format(sstring, sizeof(sstring), "Staff: %s", aname);
                format(rstring, sizeof(rstring), "Reason: %s", reason);
				format(cw, sizeof(cw), "Current Warnings: %i (3 for Ban)", PlayerInfo[playerid][pWarns]);
                SendClientMessage(playerid, COLOR_LIGHTRED, "--------------------- Ban Report ---------------------");
                SendClientMessage(playerid, COLOR_WHITE, cw);
                SendClientMessage(playerid, COLOR_WHITE, sstring);
                SendClientMessage(playerid, COLOR_WHITE, rstring);
                SendClientMessage(playerid, COLOR_WHITE, tstring);
                SendClientMessage(playerid, COLOR_LIGHTRED, "Feel free to post a ban appeal at www.as-rp.forumtl.com. Have a nice day!");
                SendClientMessage(playerid, COLOR_REALRED, "Make sure you have the Screenshot of this ban by pressing (F8)");
                SendClientMessage(playerid, COLOR_REALRED, "Feel free to post a ban appeal at [www.as-rp.forumtl.com]");
                SetTimerEx("KickPlayer", 500, false, "i", giveplayerid);
                return 1;
            }

        } else SendClientMessage(playerid, COLOR_GRAD1, "Invalid player specified.");
    }
    return 1;
}
I dont know why it doest give the Reason of ban its just showing the "Server Closed The Connection"
Reply
#2

Try to replace your "playerid" in the SendClientMessages with "giveplayerid"
Reply
#3

Quote:
Originally Posted by Macronix
Посмотреть сообщение
Try to replace your "playerid" in the SendClientMessages with "giveplayerid"
Not working
Reply
#4

Where did you replace the "playerid"'s to "giveplayerid" ? You need to replace them in the else-statement ^^
Reply
#5

Change the playerid for giveplayerid.
pawn Код:
format(tstring, sizeof(tstring), "Date/Time: %i.%i.%i, %i:%i:%i", day, month, year, hour, minute, second);
                format(sstring, sizeof(sstring), "Staff: %s", aname);
                format(rstring, sizeof(rstring), "Reason: %s", reason);
                format(cw, sizeof(cw), "Current Warnings: %i (3 for Ban)", PlayerInfo[playerid][pWarns]);
                SendClientMessage(giveplayerid, COLOR_LIGHTRED, "--------------------- Ban Report ---------------------");
                SendClientMessage(giveplayerid, COLOR_WHITE, cw);
                SendClientMessage(giveplayerid, COLOR_WHITE, sstring);
                SendClientMessage(giveplayerid, COLOR_WHITE, rstring);
                SendClientMessage(giveplayerid, COLOR_WHITE, tstring);
                SendClientMessage(giveplayerid, COLOR_LIGHTRED, "Feel free to post a ban appeal at http://www.as-rp.forumtl.com. Have a nice day!");
                SendClientMessage(giveplayerid, COLOR_REALRED, "Make sure you have the Screenshot of this ban by pressing (F8)");
                SendClientMessage(giveplayerid, COLOR_REALRED, "Feel free to post a ban appeal at [www.as-rp.forumtl.com]");
                SetTimerEx("KickPlayer", 500, false, "i", giveplayerid);
If that doesn't work try checking AddBan(ip);
Reply
#6

Quote:
Originally Posted by Macronix
Посмотреть сообщение
Where did you replace the "playerid"'s to "giveplayerid" ?
Like this

Код:
CMD:ban(playerid, params[])
{
    if(PlayerInfo[playerid][pAdmin] >= 2)
    {
        new string[128], giveplayerid, reason[64];
        if(sscanf(params, "us[64]", giveplayerid, reason)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /ban [playerid/partofname] [reason]");

        if(IsPlayerConnected(giveplayerid))
        {
            if(PlayerInfo[giveplayerid][pAdmin] > PlayerInfo[playerid][pAdmin])
            {
                if(AdminDuty[playerid] == 1)
                {
                    new username[MAX_PLAYER_NAME];
                    GetPVarString(playerid, "TempNameName", username, sizeof(username));
                    SetPVarInt(playerid, "TempName", 0);
                    SetPlayerName(playerid, username);
                }
                format(string, sizeof(string), "AdmCmd: %s has been auto-banned, reason: Trying to /ban a higher admin.", PlayerInfo[playerid][pAdminName]);
                ABroadCast(COLOR_YELLOW,string,1);
                new ip[32], cw[64], tstring[128], year, month, day, hour, minute, second;
                PlayerInfo[playerid][pBanned] = 1;
                AddBan(ip);
                GetPlayerIp(playerid,ip,sizeof(ip));
                getdate(year, month, day);
                gettime(hour, minute, second);
                format(tstring, sizeof(tstring), "Date/Time: %i.%i.%i, %i:%i:%i", day, month, year, hour, minute, second);
				format(cw, sizeof(cw), "Current Warnings: %i (3 for Ban)", PlayerInfo[playerid][pWarns]);
                SendClientMessage(giveplayerid, COLOR_LIGHTRED, "--------------------- Ban Report ---------------------");
                SendClientMessage(giveplayerid, COLOR_WHITE, cw);
                SendClientMessage(giveplayerid, COLOR_WHITE, "Staff: Server");
                SendClientMessage(giveplayerid, COLOR_WHITE, "Reason: Tried to ban a higher admin");
                SendClientMessage(giveplayerid, COLOR_WHITE, tstring);
                SendClientMessage(giveplayerid, COLOR_REALRED, "Make sure you have the Screenshot of this ban by pressing (F8)");
                SendClientMessage(giveplayerid, COLOR_LIGHTRED, "Feel free to post a ban appeal at www.as-rp.forumtl.com. Have a nice day!");
                SetTimerEx("KickPlayer", 500, false, "i", playerid);
                return 1;
            }
            else
            {
                new playerip[32];
                GetPlayerIp(giveplayerid, playerip, sizeof(playerip));

                if(AdminDuty[giveplayerid] == 1)
                {
                    new username[MAX_PLAYER_NAME];
                    GetPVarString(giveplayerid, "TempNameName", username, sizeof(username));
                    SetPVarInt(giveplayerid, "TempName", 0);
                    SetPlayerName(giveplayerid, username);

                    format(string, sizeof(string), "AdmCmd: %s(IP:%s) was banned by %s, reason: %s", PlayerInfo[giveplayerid][pAdminName], playerip, GetPlayerNameEx(playerid), reason);
                    Log("logs/ban.log", string);
                    format(string, sizeof(string), "AdmCmd: %s was banned by %s, reason: %s", PlayerInfo[giveplayerid][pAdminName], GetPlayerNameEx(playerid), reason);
                }
                else
                {
                    format(string, sizeof(string), "AdmCmd: %s(IP:%s) was banned by %s, reason: %s", GetPlayerNameEx(giveplayerid), playerip, GetPlayerNameEx(playerid), reason);
                    Log("logs/ban.log", string);
                    format(string, sizeof(string), "AdmCmd: %s was banned by %s, reason: %s", GetPlayerNameEx(giveplayerid), GetPlayerNameEx(playerid), reason);
                }


                SendClientMessageToAllEx(COLOR_LIGHTRED, string);
                new ip[32];
                PlayerInfo[giveplayerid][pBanned] = 1;
                AddBan(ip);
                GetPlayerIp(giveplayerid,ip,sizeof(ip));
                new cw[64], tstring[128], sstring[128], rstring[128], aname[MAX_PLAYER_NAME], year, month, day, hour, minute, second;
                GetPlayerName(playerid, aname, sizeof(aname));
                getdate(year, month, day);
                gettime(hour, minute, second);
                format(tstring, sizeof(tstring), "Date/Time: %i.%i.%i, %i:%i:%i", day, month, year, hour, minute, second);
                format(sstring, sizeof(sstring), "Staff: %s", aname);
                format(rstring, sizeof(rstring), "Reason: %s", reason);
				format(cw, sizeof(cw), "Current Warnings: %i (3 for Ban)", PlayerInfo[playerid][pWarns]);
                SendClientMessage(giveplayerid, COLOR_LIGHTRED, "--------------------- Ban Report ---------------------");
                SendClientMessage(giveplayerid, COLOR_WHITE, cw);
                SendClientMessage(giveplayerid, COLOR_WHITE, sstring);
                SendClientMessage(giveplayerid, COLOR_WHITE, rstring);
                SendClientMessage(giveplayerid, COLOR_WHITE, tstring);
                SendClientMessage(giveplayerid, COLOR_LIGHTRED, "Feel free to post a ban appeal at www.as-rp.forumtl.com. Have a nice day!");
                SendClientMessage(giveplayerid, COLOR_REALRED, "Make sure you have the Screenshot of this ban by pressing (F8)");
                SendClientMessage(giveplayerid, COLOR_REALRED, "Feel free to post a ban appeal at [www.as-rp.forumtl.com]");
                SetTimerEx("KickPlayer", 500, false, "i", giveplayerid);
                return 1;
            }

        } else SendClientMessage(playerid, COLOR_GRAD1, "Invalid player specified.");
    }
    return 1;
}
Reply
#7

In the first statement with the PlayerInfo there is no need to replace the playerid's because what i have read there you get an auto-ban if you try to ban an admin with a higher level.
You just need to replace the playerid's in the else-statement
Reply
#8

Quote:
Originally Posted by Macronix
Посмотреть сообщение
In the first statement with the PlayerInfo there is no need to replace the playerid's because what i have read there you get an auto-ban if you try to ban an admin with a higher level.
You just need to replace the playerid's in the else-statement
Send me the code.
i dont understand what are you saying
Reply
#9

Код:
CMD:ban(playerid, params[])
{
    if(PlayerInfo[playerid][pAdmin] >= 2)
    {
        new string[128], giveplayerid, reason[64];
        if(sscanf(params, "us[64]", giveplayerid, reason)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /ban [playerid/partofname] [reason]");

        if(IsPlayerConnected(giveplayerid))
        {
            if(PlayerInfo[giveplayerid][pAdmin] > PlayerInfo[playerid][pAdmin])
            {
                if(AdminDuty[playerid] == 1)
                {
                    new username[MAX_PLAYER_NAME];
                    GetPVarString(playerid, "TempNameName", username, sizeof(username));
                    SetPVarInt(playerid, "TempName", 0);
                    SetPlayerName(playerid, username);
                }
                format(string, sizeof(string), "AdmCmd: %s has been auto-banned, reason: Trying to /ban a higher admin.", PlayerInfo[playerid][pAdminName]);
                ABroadCast(COLOR_YELLOW,string,1);
                new ip[32], cw[64], tstring[128], year, month, day, hour, minute, second;
                PlayerInfo[playerid][pBanned] = 1;
                AddBan(ip);
                GetPlayerIp(playerid,ip,sizeof(ip));
                getdate(year, month, day);
                gettime(hour, minute, second);
                format(tstring, sizeof(tstring), "Date/Time: %i.%i.%i, %i:%i:%i", day, month, year, hour, minute, second);
				format(cw, sizeof(cw), "Current Warnings: %i (3 for Ban)", PlayerInfo[playerid][pWarns]);
                SendClientMessage(playerid, COLOR_LIGHTRED, "--------------------- Ban Report ---------------------");
                SendClientMessage(playerid, COLOR_WHITE, cw);
                SendClientMessage(playerid, COLOR_WHITE, "Staff: Server");
                SendClientMessage(playerid, COLOR_WHITE, "Reason: Tried to ban a higher admin");
                SendClientMessage(playerid, COLOR_WHITE, tstring);
                SendClientMessage(playerid, COLOR_REALRED, "Make sure you have the Screenshot of this ban by pressing (F8)");
                SendClientMessage(playerid, COLOR_LIGHTRED, "Feel free to post a ban appeal at www.as-rp.forumtl.com. Have a nice day!");
                SetTimerEx("KickPlayer", 500, false, "i", playerid);
                return 1;
            }
            else
            {
                new playerip[32];
                GetPlayerIp(giveplayerid, playerip, sizeof(playerip));

                if(AdminDuty[giveplayerid] == 1)
                {
                    new username[MAX_PLAYER_NAME];
                    GetPVarString(giveplayerid, "TempNameName", username, sizeof(username));
                    SetPVarInt(giveplayerid, "TempName", 0);
                    SetPlayerName(giveplayerid, username);

                    format(string, sizeof(string), "AdmCmd: %s(IP:%s) was banned by %s, reason: %s", PlayerInfo[giveplayerid][pAdminName], playerip, GetPlayerNameEx(playerid), reason);
                    Log("logs/ban.log", string);
                    format(string, sizeof(string), "AdmCmd: %s was banned by %s, reason: %s", PlayerInfo[giveplayerid][pAdminName], GetPlayerNameEx(playerid), reason);
                }
                else
                {
                    format(string, sizeof(string), "AdmCmd: %s(IP:%s) was banned by %s, reason: %s", GetPlayerNameEx(giveplayerid), playerip, GetPlayerNameEx(playerid), reason);
                    Log("logs/ban.log", string);
                    format(string, sizeof(string), "AdmCmd: %s was banned by %s, reason: %s", GetPlayerNameEx(giveplayerid), GetPlayerNameEx(playerid), reason);
                }


                SendClientMessageToAllEx(COLOR_LIGHTRED, string);
                new ip[32];
                PlayerInfo[giveplayerid][pBanned] = 1;
                AddBan(ip);
                GetPlayerIp(giveplayerid,ip,sizeof(ip));
                new cw[64], tstring[128], sstring[128], rstring[128], aname[MAX_PLAYER_NAME], year, month, day, hour, minute, second;
                GetPlayerName(giveplayerid, aname, sizeof(aname));
                getdate(year, month, day);
                gettime(hour, minute, second);
                format(tstring, sizeof(tstring), "Date/Time: %i.%i.%i, %i:%i:%i", day, month, year, hour, minute, second);
                format(sstring, sizeof(sstring), "Staff: %s", aname);
                format(rstring, sizeof(rstring), "Reason: %s", reason);
				format(cw, sizeof(cw), "Current Warnings: %i (3 for Ban)", PlayerInfo[giveplayerid][pWarns]);
                SendClientMessage(giveplayerid, COLOR_LIGHTRED, "--------------------- Ban Report ---------------------");
                SendClientMessage(giveplayerid, COLOR_WHITE, cw);
                SendClientMessage(giveplayerid, COLOR_WHITE, sstring);
                SendClientMessage(giveplayerid, COLOR_WHITE, rstring);
                SendClientMessage(giveplayerid, COLOR_WHITE, tstring);
                SendClientMessage(giveplayerid, COLOR_LIGHTRED, "Feel free to post a ban appeal at www.as-rp.forumtl.com. Have a nice day!");
                SendClientMessage(giveplayerid, COLOR_REALRED, "Make sure you have the Screenshot of this ban by pressing (F8)");
                SendClientMessage(giveplayerid, COLOR_REALRED, "Feel free to post a ban appeal at [www.as-rp.forumtl.com]");
                SetTimerEx("KickPlayer", 500, false, "i", giveplayerid);
                return 1;
            }

        } else SendClientMessage(playerid, COLOR_GRAD1, "Invalid player specified.");
    }
    return 1;
}
Here, try this.
Reply
#10

just change the time of timer :
change SetTimerEx("KickPlayer", 500, false, "i", giveplayerid); to
PHP код:
SetTimerEx("KickPlayer"1000false"i"giveplayerid); 
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)