Problem /ban
#1

We recently added the command / ban, ban information but when a player gets ban shows him just closed the conection and the message server, and not show me ban info.. What should I do?
Command:
Код:
		if(strcmp(cmd, "/ban", true) == 0)
	{
	    if(IsPlayerConnected(playerid))
	    {
	    	tmp = strtok(cmdtext, idx);
			if(!strlen(tmp))
			{
				SendClientMessage(playerid, COLOR_GRAD2, "Folosire: /ban [playerid/PartOfName] [reason]");
				return 1;
			}
			giveplayerid = ReturnUser(tmp);
			if (PlayerInfo[playerid][pAdmin] >= 5)
			{
			    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;
						new result[64];
						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, "Folosire: /ban [playerid/PartOfName] [reason]");
							return 1;
						}
					    if(strmatch(giveplayer, DEVELOPMENT)) return SendClientMessage(playerid, COLOR_WHITE, "{DC0C0C}Ban: {FFFFFF}Dude, don't do that.");
						new year, month,day;
						getdate(year, month, day);
						format(string, sizeof(string), "Info: %s a fost banat de catre admin %s.Motiv: %s (%d-%d-%d)", giveplayer, sendername, (result),month,day,year);
						BanLog(string);
						format(string, sizeof(string), "Info: %s a fost banat de catre admin %s.Motiv: %s", giveplayer, sendername, (result));
						SendClientMessageToAll(COLOR_LIGHTRED, string);
                        new playersip[256];
                        strmid(PlayerInfo[giveplayerid][pIP], playersip, 0, 100, 255);
					    Update(giveplayerid, pIPx);
				        new query[512];
					    format(query, sizeof(query) ,"INSERT INTO `banslog` (`BanID`,`user_banned`,`user_banned_ip`,`user_banner`,`ban_reason`,`ban_timestamp`,`ban_time`) VALUES ('','%s','%s','%s','%s',CURRENT_TIMESTAMP,'%d')",
					    giveplayer,
					    PlayerInfo[giveplayerid][pIP],
					    sendername,
					    result,
					    0);
					    mysql_query(query);
					    Ban(giveplayerid);
					    BannTimer[playerid] = 1;
						GetPlayerIp(giveplayerid,playersip, sizeof(playersip));
					    SendClientMessage(giveplayerid,COLOR_GREEN,"|___________[BAN INFO]___________|");
			            format(string, sizeof(string), "Numele tau este: %s.",giveplayer);
                        SendClientMessage(giveplayerid, COLOR_RED, string);
                        format(string, sizeof(string), "IP-ul tau este: %s.",playersip);
                        SendClientMessage(giveplayerid, COLOR_RED, string);
                        format(string, sizeof(string), "Ai fost banat de: %s.",sendername);
                        SendClientMessage(giveplayerid, COLOR_RED, string);
                        format(string, sizeof(string), "Motiv: %s.",(result));
                        SendClientMessage(giveplayerid, COLOR_RED, string);
                        format(string, sizeof(string), "Data: %d/%d/%d",day,month,year);
                        SendClientMessage(giveplayerid, COLOR_RED, string);
                        SendClientMessage(giveplayerid,COLOR_GREEN,"|___________[BAN INFO]___________|");
                        bantime[playerid] = 1;
          	   			SetTimerEx("bant", 10000, 0, "%d", playerid);
						Ban(giveplayerid);
						return 1;
					}
				}//not connected
			}
			else
			{
				format(string, sizeof(string), "   %d nu este activ.", giveplayerid);
				SendClientMessage(playerid, COLOR_GRAD1, string);
			}
		}
		return 1;
	}
Reply
#2

This is a known issue that the 0.3x has. You have to make a timer of 1 second.
Reply
#3

Add a timer so the command bans the person about a second or so AFTER the command has been entered
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)