Jump to content
  • 0

ban


Rimmon

Question

4 answers to this question

Recommended Posts

Ban:

if(strcmp(cmd, "/ban", true) == 0)
	{
	    if(IsPlayerConnected(playerid))
	    {
	    	tmp = strtok(cmdtext, idx);
			if(!strlen(tmp))
			{
				SendClientMessage(playerid, COLOR_GRAD2, " Foloseste: /ban [Player id] [reason]");
				return 1;
			}
			giveplayerid = ReturnUser(tmp);
			if (PlayerInfo[playerid][pAdmin] >= 3)
			{
			    if(PlayerInfo[playerid][pAdmin] < PlayerInfo[giveplayerid][pAdmin])
			    {
			        SendClientMessage(playerid,COLOR_GREY,"Nu poti bana un admin mai mare ca tine!");
					return 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++;
						}
						result[idx - offset] = EOS;
						if(!strlen(result))
						{
							SendClientMessage(playerid, COLOR_GRAD2, " Foloseste: /ban [Player id] [Motiv]");
							return 1;
						}
						new year, month,day;
						getdate(year, month, day);
						format(string, sizeof(string), "GameSpeed: %s a fost banat de catre %s, Motiv: %s (%d-%d-%d)", giveplayer, sendername, (result),month,day,year);
						BanLog(string);
						format(string, sizeof(string), "GameSpeed: %s a fost banat de catre %s, Motiv: %s", giveplayer, sendername, (result));
						SendClientMessageToAll(COLOR_LIGHTRED, string);
						format(string,sizeof(string),"Motiv: %s | A bant - %s", (result), sendername);
						BanEx(giveplayerid,string);
						return 1;
					}
				}//not connected
			}
			else
			{
				format(string, sizeof(string), "   %d Nu este un player activ.", giveplayerid);
				SendClientMessage(playerid, COLOR_GRAD1, string);
			}
		}
		return 1;
	}
Comanda kick:
//----------------------------------[Kick]------------------------------------------------
    if(strcmp(cmd, "/kick", true) == 0)
	{
	    if(IsPlayerConnected(playerid))
	    {
	    	tmp = strtok(cmdtext, idx);
			if(!strlen(tmp))
			{
				SendClientMessage(playerid, COLOR_GRAD2, " {FFA500}[INFO]:{ffffff} /kick [Player id] [Motiv]");
				return 1;
			}
			giveplayerid = ReturnUser(tmp);
			if (PlayerInfo[playerid][pAdmin] >= 1 )
			{
				if(IsPlayerConnected(giveplayerid))
				{
				    if(PlayerInfo[playerid][pAdmin] < PlayerInfo[giveplayerid][pAdmin])
				    {
				        SendClientMessage(playerid,COLOR_GREY,"Nu poti da kick/ban unui admin mai mare ca tine!");
						return 1;
				    }
				    if(giveplayerid != INVALID_PLAYER_ID)
				    {
					    GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
						GetPlayerName(playerid, sendername, sizeof(sendername));
                        new kickstring[64];
						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, " {FFA500}[INFO]:{ffffff} /kick [Player id] [reason]");
							return 1;
						}
						new year, month,day;
						getdate(year, month, day);
						format(string, sizeof(string), " %s - a primit kick de la %s | Motiv:  %s | Data: %d-%d-%d", giveplayer, sendername, (result),year, month, day);
						SendClientMessageToAll(COLOR_RED, string);
						KickLog(string);
						SendClientMessage(giveplayerid, COLOR_GREEN, "------------------------------------------");
						format(kickstring, sizeof(kickstring), "Ti-a dat kick: %s", sendername);
						SendClientMessage(giveplayerid, COLOR_RED, kickstring);
						format(kickstring, sizeof(kickstring), "Motiv: %s",(result));
						SendClientMessage(giveplayerid, COLOR_RED, kickstring);
						format(kickstring, sizeof(kickstring), "Data: %d-%d-%d",day,month,year);
						SendClientMessage(giveplayerid, COLOR_RED, kickstring);
						SendClientMessage(giveplayerid, COLOR_RED, "Va rugam, Nu incalcati regulile serverului!");
						SendClientMessage(giveplayerid, COLOR_GREEN, "------------------------------------------");

						Kick(giveplayerid);
						return 1;
					}
				}
			}
			else
			{
				format(string, sizeof(string), "   %d Nu este un player activ.", giveplayerid);
				SendClientMessage(playerid, COLOR_GRAD1, string);
			}
		}
	}

LISTA - GAMEMODE-URI SA-MP - Le gasiti pe toate aici: http://twiriock.com/3MGP

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.