Unban Command
#1

Any1 cand make me 1 unban command for this bann command
Код:
	if(strcmp(cmd, "/ban", true) == 0)
	{
	    if(IsPlayerConnected(playerid))
	    {
	    	tmp = strtok(cmdtext, idx);
			if(!strlen(tmp))
			{
				SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /bans [playerid/PartOfName] [reason]");
				return 1;
			}
			giveplayerid = ReturnUser(tmp);
			if (PlayerInfo[playerid][pAdmin] >= 1338)
			{
			    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, "USAGE: /bans [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);
						BanLog(string);
						format(string, sizeof(string), "AdmCmd: %s was banned by %s, reason: %s", giveplayer, sendername, (result));
						SendClientMessageToAll(COLOR_LIGHTRED, string);
						PlayerInfo[giveplayerid][pAdmin] = PlayerInfo[giveplayerid][pLevel];
						PlayerInfo[giveplayerid][pBlocat] = 1;
                        new playersip[256];
						GetPlayerIp(giveplayerid,playersip, sizeof(playersip));
					    SendClientMessage(giveplayerid,COLOR_DBLUE,"|___________[BAN INFO]___________|");
			            format(string, sizeof(string), "Numele tau este: %s.",giveplayer);
                        SendClientMessage(giveplayerid, COLOR_WHITE, string);
                        format(string, sizeof(string), "IP-ul tau este: %s.",playersip);
                        SendClientMessage(giveplayerid, COLOR_WHITE, string);
                        format(string, sizeof(string), "Ai fost banat de: %s.",sendername);
                        SendClientMessage(giveplayerid, COLOR_WHITE, string);
                        format(string, sizeof(string), "Ai fost banat pentru urmatorul motiv: %s.",(result));
                        SendClientMessage(giveplayerid, COLOR_WHITE, string);
                        format(string, sizeof(string), "Ai fost banat pe data de: %d/%d/%d (Ziua-Luna-Anul)",day,month,year);
                        SendClientMessage(giveplayerid, COLOR_WHITE, string);
                        SendClientMessage(giveplayerid,COLOR_DBLUE,"|___________[BAN INFO]___________|");
                        SendClientMessage(giveplayerid,COLOR_LIGHTRED,"[BAN INFO]: Poti face o cerere de unban pe forumul nostru.Forumul este www.blackrockk.eu Succes !");
                        SendClientMessage(giveplayerid,COLOR_WHITE,"[HINT]: Te sfatuim sa faci o poza la aceste informatii,si sa o postezi cand faci cerere unban.Apasa F8 pentru a face poza !");
						Ban(giveplayerid);
						return 1;
					}
				}//not connected
			}
			else
			{
				format(string, sizeof(string), "   %d is not an active player.", giveplayerid);
				SendClientMessage(playerid, COLOR_GRAD1, string);
			}
		}
		return 1;
	}
Reply
#2

UP zz
Reply
#3

just delete the Ban(giveplayerid);
Reply
#4

plz post comand again working
Reply
#5

use rcon unbanip
Reply
#6

no man i need 1 unban comand for set in user .dini at Blocat =1 to change in blocat =0
Reply
#7

up xd
Reply
#8

upppp
Reply
#9

Stop bumping the topic and wait for someone to respond to you...
Reply
#10

first off, if you want an unban command by name, you have to make your own file/sql etc ban system.

if you want to use the default system by sa-mp, then simply make it with SendRconCommand("unban ip theip"); etc

heres a nice example i found that can be used with [name] if you save their ip and their names etc

pawn Код:
if(!strcmp(cmd, "/unban", true))
{
        new tmp[256], idx;
        new string[128];
 
        tmp = strtok(cmdtext, idx);
 
        if(!strlen(tmp))
                return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /unban [name]");
 
        new Accstring[128];
        format(Accstring, sizeof(Accstring), "accounts/%s.ini", tmp);
        if(!fexist(Accstring))
        {
                SendClientMessage(playerid, COLOR_RED, "***[Error] The account name you entered does not exist in the database.");
                SendClientMessage(playerid, COLOR_RED, "Please check the name and try again, type it EXACTLY as it appears.");
                return 1;
        }
 
        new pass[128],plIp[128],level,warns,kills,deaths,money,bank,pPoints,pAccount,skin,plHours,plMins,jailtime;
        new banned = 0;
        new File: pFile = fopen(Accstring, io_read);
        if (pFile)
        {
                format(pass, 128, dini_Get(Accstring, "Password"));
                format(plIp, 128, dini_Get(Accstring, "IP"));
                level = dini_Int(Accstring, "AdminLevel");
                warns = dini_Int(Accstring, "Warnings");
                kills = dini_Int(Accstring, "Kills");
                deaths = dini_Int(Accstring, "Deaths");
                money = dini_Int(Accstring, "Money");
                bank = dini_Int(Accstring, "Bank");
                pPoints = dini_Int(Accstring, "PremPoints");
                pAccount = dini_Int(Accstring, "PremAccount");
                skin = dini_Int(Accstring, "Skin");
                plHours = dini_Int(Accstring, "PlayingHours");
                plMins = dini_Int(Accstring, "PlayingMinutes");
                jailtime = dini_Int(Accstring, "JailTime");
                fclose(pFile);
        }
 
        new var[32];
        new File: hFile = fopen(Accstring, io_append);
 
        if(hFile)
        {
                format(var, 32, "Password=%s\n", pass);fwrite(pFile, var);
                format(var, 32, "IP=%s\n", plIp);fwrite(hFile, var);
                format(var, 32, "AdminLevel=%d\n",level);fwrite(hFile, var);
                format(var, 32, "Warnings=%d\n",warns);fwrite(hFile, var);
                format(var, 32, "Kills=%d\n",kills);fwrite(hFile, var);
                format(var, 32, "Deaths=%d\n",deaths);fwrite(hFile, var);
                format(var, 32, "Money=%d\n",money);fwrite(hFile, var);
                format(var, 32, "Bank=%d\n",bank);fwrite(hFile, var);
                format(var, 32, "PremPoints=%d\n",pPoints);fwrite(hFile, var);
                format(var, 32, "PremAccount=%d\n",pAccount);fwrite(hFile, var);
                format(var, 32, "Skin=%d\n",skin);fwrite(hFile, var);
                format(var, 32, "Banned=%d\n",banned);fwrite(hFile, var);
                format(var, 32, "PlayingHours=%d\n",plHours);fwrite(hFile, var);
                format(var, 32, "PlayingMinutes=%d\n",plMins);fwrite(hFile, var);
                format(var, 32, "JailTime=%d\n",jailtime);fwrite(hFile, var);
                fclose(hFile);
        }
 
        format(string,sizeof(string),"unbanip %s",pIp);
        SendRconCommand(string);
        SendRconCommand("reloadbans");
 
        format(string, 128, "You have successfully unbanned %s", tmp);
        SendClientMessage(playerid, COLOR_GREEN, string);
        return 1;
}
i'll make my own for you if i have time
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)