Jump to content
  • 0

/ban


ToX1c

Question

Salut cum fac si eu comanda /ban de ex eu dau cuiva ban acuma si vreau sa fac ca sa poata da peste 1 minut ban la altcineva..

if(strcmp(cmd, "/ban", true) == 0)
	{
	    if(IsPlayerConnected(playerid))
	    {
	    	tmp = strtok(cmdtext, idx);
			if(!strlen(tmp))
			{
				SendClientMessage(playerid, COLOR_WHITE, "UTILIZARE: /ban [playerid/PartOfName] [reason]");
				return 1;
			}
			giveplayerid = ReturnUser(tmp);
			if (PlayerInfo[playerid][pAdmin] >= 3)
			{
			    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_WHITE, "UTILIZARE: /ban [playerid/PartOfName] [reason]");
							return 1;
						}
						new year, month,day;
						getdate(year, month, day);
						format(string, sizeof(string), "AdmCmd: %s a primit ban de la %s, motiv: %s (%d-%d-%d)", giveplayer, sendername, (result),month,day,year);
						BanLog(string);
						format(string, sizeof(string), "AdmCmd: %s a primit ban de la  %s, motiv: %s", giveplayer, sendername, (result));
						SendClientMessageToAll(COLOR_LIGHTRED, string);
						PlayerInfo[giveplayerid][pAdmin] = PlayerInfo[giveplayerid][pLevel];
						PlayerInfo[giveplayerid][pLevel] = -999;
						Ban(giveplayerid);
						return 1;
					}
				}//not connected
			}
			else
			{
				format(string, sizeof(string), "Aces player nu este conectat.", giveplayerid);
				SendClientMessage(playerid, COLOR_GRAD1, string);
			}
		}
		return 1;
	}

Link to comment
Share on other sites

14 answers to this question

Recommended Posts

Incearca asa..facem o improvizatie

Comanda asta o am la /ad..

new adds = 1;
new addtimer = 60000
Tu ar trebuii sa pui ceva de genu
	if ((!adds) && (PlayerInfo[playerid][pAdmin] > 1))
			{
				format(string, sizeof(string), "   Textul tau..Ai dat deja ban..bla bla!",  (addtimer/1000));
				SendClientMessage(playerid, COLOR_GRAD2, string);
				return 1;

Sper sa fie bine

gXvsYS
Link to comment
Share on other sites

Mane am facut asa da nu merge ...tot pot sa dau ban..nu ma pune sa astept

if(strcmp(cmd, "/ban", true) == 0)
	{
	    if(IsPlayerConnected(playerid))
	    {
	    	tmp = strtok(cmdtext, idx);
			if(!strlen(tmp))
			{
				SendClientMessage(playerid, COLOR_WHITE, "UTILIZARE: /ban [playerid/PartOfName] [reason]");
				return 1;
			}
			giveplayerid = ReturnUser(tmp);
			if (PlayerInfo[playerid][pAdmin] >= 3)
			{
			    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_WHITE, "UTILIZARE: /bex [playerid/PartOfName] [reason]");
							return 1;
						}
						if ((!banss) && (PlayerInfo[playerid][pAdmin] < 1))
     	                {
				            format(string, sizeof(string), "Ai folosit deja comanda /ban incearca peste %d de secunde.",  (addtimer/1000));
			              	SendClientMessage(playerid, COLOR_GRAD2, string);
			            	return 1;

			            }
						new year, month,day;
						getdate(year, month, day);
						format(string, sizeof(string), "AdmCmd: %s a primit ban de la %s, motiv: %s (%d-%d-%d)", giveplayer, sendername, (result),month,day,year);
						BanLog(string);
						format(string, sizeof(string), "AdmCmd: %s a primit ban de la  %s, motiv: %s", giveplayer, sendername, (result));
						SendClientMessageToAll(COLOR_LIGHTRED, string);
						PlayerInfo[giveplayerid][pAdmin] = PlayerInfo[giveplayerid][pLevel];
						PlayerInfo[giveplayerid][pLevel] = -999;
						Ban(giveplayerid);
						return 1;
					}
				}//not connected
			}
			else
			{
				format(string, sizeof(string), "Aces player nu este conectat.", giveplayerid);
				SendClientMessage(playerid, COLOR_GRAD1, string);
			}
		}
		return 1;
	}
new banss = 1000;

Link to comment
Share on other sites

da iti arat eu o alta metoda dar si a lui tzaks e buna

sub

new UsedFind[MAX_PLAYERS];
adaugi
new UsedBan[MAX_PLAYERS];
la onplayerconnect sub
UsedFind[playerid] = 0;
adaugi
UsedBan[playerid] = 0;
dupaia cauta fuctia
if(UsedFind[i] >= 1)
{
    UsedFind[i] += 1;
    if(UsedFind[i] >= 120)
    {
        UsedFind[i] = 0;
    }
}
adauga
if(UsedBan[i] >= 1)
{
    UsedBan[i] += 1;
    if(UsedBan[i] >= 120)
    {
        UsedBan[i] = 0;
    }
}
la comanda ta de ban adaugai fuctia
if(UsedBan[playerid] != 0 && PlayerInfo[playerid][pAdmin] > 7) // aici daca ai adm mai mare de rank 7 poti da ban fara sa astepti
{
	SendClientMessage(playerid, COLOR_WHITE, " You've already Ban , wait 2 minutes !");
	return 1;
}

sper sa te ajute

Link to comment
Share on other sites

Mane am facut cum ai zis da nu merge..

if(strcmp(cmd, "/ban", true) == 0)
	{
	    if(IsPlayerConnected(playerid))
	    {
	    	tmp = strtok(cmdtext, idx);
			if(!strlen(tmp))
			{
				SendClientMessage(playerid, COLOR_WHITE, "UTILIZARE: /ban [playerid/PartOfName] [reason]");
				return 1;
			}
			giveplayerid = ReturnUser(tmp);
			if (PlayerInfo[playerid][pAdmin] >= 1)
			{
			    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++;
						}
						if(UsedBan[playerid] != 0 && PlayerInfo[playerid][pAdmin] > 1338)
						{
                            SendClientMessage(playerid, COLOR_WHITE, " You've already Ban , wait 2 minutes !");
                            return 1;
					    }
						result[idx - offset] = EOS;
						if(!strlen(result))
						{
							SendClientMessage(playerid, COLOR_WHITE, "UTILIZARE: /bex [playerid/PartOfName] [reason]");
							return 1;
						}
						new year, month,day;
						getdate(year, month, day);
						format(string, sizeof(string), "AdmCmd: %s a primit ban de la %s, motiv: %s (%d-%d-%d)", giveplayer, sendername, (result),month,day,year);
						BanLog(string);
						format(string, sizeof(string), "AdmCmd: %s a primit ban de la  %s, motiv: %s", giveplayer, sendername, (result));
						SendClientMessageToAll(COLOR_LIGHTRED, string);
						PlayerInfo[giveplayerid][pAdmin] = PlayerInfo[giveplayerid][pLevel];
						PlayerInfo[giveplayerid][pLevel] = -999;
						Ban(giveplayerid);
						UsedBan[playerid] = 1;
						return 1;
					}
				}//not connected
			}
			else
			{
				format(string, sizeof(string), "Aces player nu este conectat.", giveplayerid);
				SendClientMessage(playerid, COLOR_GRAD1, string);
			}
		}
		return 1;
	}

Mi-am dat admin 3 si am dat ban cuiva si dupa mie si am putut sa ma banez!!

Link to comment
Share on other sites

Salut am facut si eu la comanda ban cand dai /ban la cineva si dupa aia la altul sa astepti 1 min si am facut sa apara secundele.. cat trebuie sa astepti sa dai /ban

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] >= 2)
			{
   				if(IsPlayerConnected(giveplayerid))
		    	{
      				if(giveplayerid != INVALID_PLAYER_ID)
       				{
       			    	if(UsedBan[playerid] != 0)
						{
                            new bantime = PlayerInfo[playerid][pBanTime];
		                    format(string, sizeof(string), "Ai folosit deja comanda /ban incearca peste %d de secunde.", bantime);
                            SendClientMessage(playerid, COLOR_1BLUE, string);
							return 1;
						}
						if(giveplayerid == playerid)
						{
					    	SendClientMessage(playerid, COLOR_WHITE,"You can ban yourself, stupid");
					    	return 1;
						}
						if(PlayerInfo[playerid][pAdmin] < PlayerInfo[giveplayerid][pAdmin])
						{
					    	SendClientMessage(playerid, COLOR_LIGHTRED,"You can't ban an admin with a higher level than you ! KICK !");
					    	Kick(playerid);
						}
						new sendername8[24];
		   				GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
						GetPlayerName(playerid, sendername8, sizeof(sendername8));
						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: /ban [playerid/PartOfName] [reason]");
							return 1;
						}
						new year, month,day;
						getdate(year, month, day);
						format(string, sizeof(string), "AdmCmd: %s a primit ban de la %s, motiv: %s (%d-%d-%d)", giveplayer, sendername, (result),month,day,year);
						BanLog(string);
						format(string, sizeof(string), "AdmCmd: %s a primit ban de la  %s, motiv: %s", giveplayer, sendername, (result));
						SendClientMessageToAll(COLOR_LIGHTRED, string);
						PlayerInfo[giveplayerid][pAdmin] = PlayerInfo[giveplayerid][pLevel];
						PlayerInfo[giveplayerid][pLevel] = -999;
						Ban(giveplayerid);
						UsedBan[playerid] = 1;
						return 1;
					}
				}
			}//not connected
		}
		return 1;
	}
if(UsedBan[playerid] != 0)
						{
                            new bantime = PlayerInfo[playerid][pBanTime];
		                    format(string, sizeof(string), "Ai folosit deja comanda /ban incearca peste %d de secunde.", bantime);
                            SendClientMessage(playerid, COLOR_1BLUE, string);
							return 1;
						}

si nu merge imi apare 0 secunde...

am facut tot ce trebuie

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.