Whats rong with this?
#1

ok, so, i got my system to save my account level, but now... i need a kick command, i got this one, but ingame, im level 4, and i think it needs level 1.

and it says i dont got the permission to use it. Any ideas?
Код:
	if(strcmp(cmd,"/kick",true) == 0)
	{
	  GetPlayerName(playerid, sendername, sizeof(sendername));
	  PlayerInfo[playerid][Level] = dini_Int(file, "level");
	  tmp = strtok(cmdtext, idx);
	  GetPlayerName(playerid, sendername, sizeof(sendername));
		if(!strlen(tmp))
		{
			SendClientMessage(playerid,COLOR_BLUE, "Correct Usage: /kick [id] [reason]");
			return 1;
		}
    giveplayerid = strval(tmp);
		giveplayerid = strval(tmp);
		if(IsLogged[playerid] == 1)
		{
			if(PlayerInfo[playerid][Level] == 1)
			{
				if(IsPlayerConnected(giveplayerid))
				{
				if( WarnedTimes[giveplayerid] == 0 && PlayerInfo[playerid][Level] == 2)
				{
				SendClientMessage(playerid, COLOR_RED, "ERROR: The player hasnt been Warned !");
				} else {
					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))
					{
						result = "No reason";
					}
					GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
					format(string, sizeof(string), "***AdmCMD: %s was KICKED by admin %s for: %s", giveplayer, sendername, result);
					SendClientMessageToAll(COLOR_BLUE, string);
					Kick(giveplayerid);
					new PlayerName[30];
					GetPlayerName(playerid, PlayerName, 30);
					printf("[Command] %s has used /kick to kick %s for: %s", PlayerName, giveplayer, result);
				}
				}
				else
				{
				  format(string, sizeof(string), "%d is not an active player.", giveplayerid);
					SendClientMessage(playerid, COLOR_RED, string);
				}
			}
			else
			{
				SendClientMessage(playerid, COLOR_RED, "You do not have permission to use that command!");
			}
		}
		else
		{
		  SendClientMessage(playerid, COLOR_RED, "You Must be logged in to use this command!");
		}
		return 1;
	}
Reply
#2

The operators needs to be changed.

if(PlayerInfo[playerid][Level] == 1)
{

needs to be changed to:

if(PlayerInfo[playerid][Level] >= 1)
{
Reply
#3

oh thanks.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)