Jump to content
  • 0

/unban


.Flopix.

Question

2 answers to this question

Recommended Posts

Fi atent ca esti cam nou in script, stergeti comanda ta de unban si de ban, fac o variabila pLocked

si adaugi comanda de /ban

if(strcmp(cmd, "/ban", true) == 0)
	{
	    if(IsPlayerConnected(playerid))
	    {
			if (PlayerInfo[playerid][pAdmin] >= 1337)
			{
				tmp = strtok(cmdtext, idx);
				if(!strlen(tmp))
				{
					SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /lockacc [playerid/PartOfName]");
					return 1;
				}
				if(AdminSecurity[playerid] == 0)
	            {
                    SendClientMessage(playerid, COLOR_GREY, "For security reasons, first authorizing it at /account panel!");
                    return 1;
	            }
				giveplayerid = ReturnUser(tmp);
				if(IsPlayerConnected(giveplayerid))
				{
				    if(giveplayerid != INVALID_PLAYER_ID)
				    {
				        if(giveplayerid==playerid) return 1;
				        GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
				        GetPlayerName(playerid, sendername, sizeof(sendername));
				        if(PlayerInfo[giveplayerid][pLocked] == 0)
				        {
				            PlayerInfo[giveplayerid][pLocked] = 1;
	                        format(string, sizeof(string), "Admin %s has locked your account.!", sendername);
							SendClientMessage(giveplayerid, COLOR_YELLOW, string);
							Kick(giveplayerid);
				            SendClientMessage(playerid, COLOR_YELLOW, "Account locked succesfuly.");
							format(string, sizeof(string), "[SERVER]: %s has locked %s account!", sendername, giveplayer);
							ABroadCast(COLOR_LIGHTRED,string,1);
				        }
				    }
				}
			}
			else
			{
				SendClientMessage(playerid, COLOR_GRAD1, "You must be a level 1337 admin to do this command.");
			}
		}
		return 1;
	}
la onplayerconnect adaugi asta [pawn]if(PlayerInfo[playerid][pLocked] == 1) // Auto-kick {     SendClientMessage(playerid, COLOR_LIGHTRED, "Your account is locked. Make a unlock/unban request on forums: 'www.gfzone.ro/forum'.");     Kick(playerid); }[/pawn] iar de /unban
if (strcmp(cmd, "/unban", true)==0)
	{
	    if(PlayerInfo[playerid][pAdmin] >=1)
	    {
	        tmp = strtok(cmdtext, idx);
	        if(!strlen(tmp))
			{
		        SendClientMessage(playerid, COLOR_WHITE, "USAGE: /unban [PlayerName]");
	            return 1;
		 	}
			format(string, sizeof(string), "users/%s.ini", tmp);
			new File:hFile = fopen(string, io_read);
			//new File: hFile = fopen(string, io_append);
			if (hFile)
			{
			    new Data[ 256 ],val [ 256 ];
			    while ( fread( hFile , Data , sizeof( Data ) ) )
					if( strcmp( ini_GetKey( Data ) , "Locked" , true ) == 0 )
						val = ini_GetValue( Data );
				if(strval( val ) == 1)
				{
				    new var[64];
					format(var, sizeof(var), "Locked=1\n");
					//fdeleteline(string,var);
					fclose(hFile);
					hFile = fopen(string, io_append);
				    format(var, 64, "Locked=0\n");
					fwrite(hFile, var);
					fclose(hFile);
				}
				else
				{
				    fclose(hFile);
					return SendClientMessage(playerid, COLOR_WHITE, "  ERROR : Player account doesn`t locked!!");
				}
			}
			GetPlayerName(playerid, sendername, sizeof(sendername));
            SendClientMessage(playerid, COLOR_WHITE, "Player unlocked please ask for his IP and use /unbanip [IP]");
            format(string, 128, "AdmWarning: %s has unbanned %s", sendername, tmp);
		 	ABroadCast(COLOR_LIGHTRED,string,1);
		 	new year, month,day;
			getdate(year, month, day);
			format(string, 128, "AdmWarning: %s has unbanned %s (%d-%d-%d)", sendername, tmp,day,month,year);
			BanLog(string);
		}
		else
		{
		    SendClientMessage(playerid, COLOR_GRAD1, "   you are not authorized to use that command!");
		}
		return 1;
	}

Link to comment
Share on other sites

Roberto, ceea ce ai postat tu cautam si eu, dar primesc niste erori la comanda /ban,

error 017: undefined symbol "AdminSecurity"
C:\Users\Mihai\Desktop\SZ.pwn(19505) : warning 215: expression has no effect
C:\Users\Mihai\Desktop\SZ.pwn(19505) : error 001: expected token: ";", but found "]"
C:\Users\Mihai\Desktop\SZ.pwn(19505) : error 029: invalid expression, assumed zero
C:\Users\Mihai\Desktop\SZ.pwn(19505) : fatal error 107: too many error messages on one line
Linia 19505:
if(AdminSecurity[playerid] == 0)

Si inca ceva, cum as putea da ban pentru un anumit timp? Thanks!

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more details you can also review our Terms of Use and Privacy Policy.