/unban
#1

I'm trying to create an unban command to go with my /ban command, all my attempts have resulted in 26 errors. Can someone suggest the proper way to go about this, thanks.

Here is my /ban command.

Код:
  if(strcmp(cmd, "/ban", true) == 0)
	{
	    	tmp = strtok(cmdtext, idx);
			if(!strlen(tmp))
			{
				SendClientMessage(playerid, COLOR_USAGE, "[USAGE:] /ban [playerid/PartOfName] [reason]");
				return 1;
			}
			giveplayerid = ReturnUser(tmp);
			if (PlayerInfo[playerid][pAdmin] >= 2 || IsPlayerAdmin(playerid))
			{
				if(IsPlayerConnected(giveplayerid))
				{
				    if(giveplayerid != INVALID_PLAYER_ID)
				    {
						new length = strlen(cmdtext);
						while ((idx < length) && (cmdtext[idx] <= ' '))
						{
							idx++;
						}
						new offset = idx;
						new result[128];
						while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
						{
							result[idx - offset] = cmdtext[idx];
							idx++;
						}
						result[idx - offset] = EOS;
						if(!strlen(result))
						{
							SendClientMessage(playerid, COLOR_USAGE, "[USAGE:] /ban [playerid/PartOfName] [reason]");
							return 1;
						}
						BanPlayer(giveplayerid,GetPlayerNameEx(playerid),(result));
						return 1;
					}
				}
				SendClientMessage(playerid, COLOR_ORANGE, "[ERROR:] Invalid ID.");
			}
			else
			{
			    SendClientMessage(playerid, COLOR_ORANGE, "[ERROR:] Either you're not an administrator, or you don't have the privileges to use this command.");
			}
		return 1;
	}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)