[HELP]Server Crash at 200 ping,ID interfusion if more than 6 player
#6

Here you go:

Code:
if(strcmp(cmdtext, "/ban", true,4) == 0)
	{
	  if(IsPlayerConnected(playerid))
	  {
	    if (PlayerInfo[playerid][pAdmin] <= 2)
			{
			  	SendClientMessage(playerid, COLOR_GRAD1, "You dont have permissions!");
				SecondLifeInfoBox(playerid, "You cannot use this command~n~because you are not an admin.");
				return 1;
			}
	  		tmp = strtok(cmdtext, idx);
			if(!strlen(tmp))
			{
				SendClientMessage(playerid, COLOR_GRAD2, "Use: /ban [PlayerID/PartOfTheName] [reason]");
				return 1;
			}
			giveplayerid = strval(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_GRAD2, "Use: /ban [PlayerID/PartOfTheName] [reason]");
							return 1;
						}

						new year, month,day;
						getdate(year, month, day);
						format(string, sizeof(string), "[ADMIN]: %s was banned by %s, reason: %s (%d-%d-%d)", giveplayer, sendername, (result),month,day,year);
						BanLog(string);
						AdminLog(string);
						format(string, sizeof(string), "[ADMIN]: %s was banned by %s, reason: %s (%d-%d-%d)", giveplayer, sendername, (result),month,day,year);
						SendClientMessageToAll(COLOR_LIGHTRED, string);
						new ipaddress[16];
						GetPlayerIp(giveplayerid,ipaddress,sizeof(ipaddress));
						new BannedReason[126];
						format(BannedReason, sizeof(BannedReason), "Banned. Reason: %s", (result));
						Ban(giveplayerid);
						Kick(giveplayerid);
						return 1;
					}
				}//not connected
			}
			else
			{
				format(string, sizeof(string), "  %d is not an active player.", giveplayerid);
				SendClientMessage(playerid, COLOR_GRAD1, string);
			}
		}
		return 1;
	}

And here's your KICK command

Code:
if(strcmp(cmdtext, "/kick", true,5) == 0)
	{
	  if(IsPlayerConnected(playerid))
	  {
	    if (PlayerInfo[playerid][pAdmin] <= 1)
			{
			  	SendClientMessage(playerid, COLOR_GRAD1, "You dont have permission!");
				SecondLifeInfoBox(playerid, "You cant use this command~n~because you are not an admin.");
				return 1;
			}
	  	tmp = strtok(cmdtext, idx);
			if(!strlen(tmp))
			{
				SendClientMessage(playerid, COLOR_GRAD2, "Use: /kick [PlayerID/PartOfTheName] [Reason]");
				return 1;
			}
			giveplayerid = strval(tmp);
			if (PlayerInfo[playerid][pAdmin] >= 2)
			{
				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, "Use: /kick [PlayerID/PartOfTheName] [Reason]");
							return 1;
						}
						new year, month,day;
						getdate(year, month, day);
						format(string, sizeof(string), "[ADMIN]: %s has been kicked by %s, Reason: %s (%d-%d-%d)", giveplayer, sendername, (result),month,day,year);
						KickLog(string);
						format(string, sizeof(string), "[ADMIN]: %s has been kicked by %s, Reason: %s (%d-%d-%d)", giveplayer, sendername, (result),month,day,year);
						SendClientMessageToAll(COLOR_RED, string);
						Kick(giveplayerid);
						return 1;
					}
				}
			}
			else
			{
				format(string, sizeof(string), "  %d is not an active player.", giveplayerid);
				SendClientMessage(playerid, COLOR_GRAD1, string);
			}
		}
		return 1;
	}
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 4 Guest(s)