[HELP] Confused
#1

i made a simple kick and ban command which it kicks and ban.... is there a way to use " Kick(playerid) " and "Ban(playerid)" without the user being logged in rcon?

because i'm making some admin commands.... and when the " admins " tried the command /kick it say:

" /kick: You are not an admin! "
" /ban: You are not an admin! "

here's the commands:
Код:
	if(strcmp(cmd,"/kick", true) == 0)
	{
	  tmp = strtok(cmdtext, idx);
	  if(!strlen(tmp))
	  {
	    SendClientMessage(playerid,COLOR_WHITE,"USAGE: /kick [playerid]");
	    return 1;
		}
		giveplayerid = strval(tmp);
		if(PlayerInfo[giveplayerid][admin] == 1)
		{
		  SendClientMessage(playerid,COLOR_BRIGHTRED,"SAC: You cannot kick an admin!");
		  return 1;
		}
		if(PlayerInfo[playerid][admin] == 1)
	  {
			format(string, sizeof(string),"SAC: Admin %s kicked %s.",PlayerInfo[playerid][name],PlayerInfo[giveplayerid][name]);
			SendClientMessageToAll(COLOR_BRIGHTRED,string);
			Kick(giveplayerid);
			return 1;
		}
		return 1;
	}
	if(strcmp(cmd,"/ban", true) == 0)
	{
	  tmp = strtok(cmdtext, idx);
	  if(!strlen(tmp))
	  {
	    SendClientMessage(playerid,COLOR_WHITE,"USAGE: /ban [playerid]");
	    return 1;
		}
		giveplayerid = strval(tmp);
		if(PlayerInfo[giveplayerid][admin] == 1)
		{
		  SendClientMessage(playerid,COLOR_BRIGHTRED,"SAC: You cannot ban an admin!");
		  return 1;
		}
		if(PlayerInfo[playerid][admin] == 1)
		{
		  format(string, sizeof(string),"SAC: Admin %s banned %s.",PlayerInfo[playerid][name],PlayerInfo[giveplayerid][name]);
		  SendClientMessageToAll(COLOR_BRIGHTRED,string);
			Ban(giveplayerid);
			return 1;
		}
		return 1;
	}
i don't wish to give the rcon password to admins... ( i wish to keep it for myself that's why i make the commands )

Please note, that if the person that use this command log in rcon it works fine.
but since there is no " LogPlayerInRcon(playerid); " i cannot log ppl in rcon without telling them the password...
Reply
#2

pawn Код:
if(strcmp(cmd,"/kick", true) == 0)
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) return SendClientMessage(playerid,COLOR_WHITE,"USAGE: /kick [playerid]");
giveplayerid = strval(tmp);
if(PlayerInfo[giveplayerid][admin] > 1) return SendClientMessage(playerid,COLOR_BRIGHTRED,"SAC: You cannot kick an admin!");
if(PlayerInfo[playerid][admin] == 1)
{
format(string, sizeof(string),"SAC: Admin %s kicked %s.",PlayerInfo[playerid][name],PlayerInfo[giveplayerid][name]);
SendClientMessageToAll(COLOR_BRIGHTRED,string);
Kick(giveplayerid);
return 1;
}
else return SendClientMessage(playerid,COLOR,"You must be an admin to kick someone!'");
}
Try that (untested, indent yourself) If it works, just do the same thing but for the ban command.
Reply
#3

didn't worked
Reply
#4

Код:
if(strcmp(cmd,"/kick", true) == 0)
	{
	  tmp = strtok(cmdtext, idx);
	  if(!strlen(tmp))
	  {
	    SendClientMessage(playerid,COLOR_WHITE,"USAGE: /kick [playerid]");
	    return 1;
		}
		giveplayerid = strval(tmp);
		if(PlayerInfo[giveplayerid][admin] == < 1)
		{
		  SendClientMessage(playerid,COLOR_BRIGHTRED,"SAC: You cannot kick an admin!");
		  return 1;
		}
		if(PlayerInfo[playerid][admin] == > 1)
	  {
			format(string, sizeof(string),"SAC: Admin %s kicked %s.",PlayerInfo[playerid][name],PlayerInfo[giveplayerid][name]);
			SendClientMessageToAll(COLOR_BRIGHTRED,string);
			Kick(giveplayerid);
			return 1;
		}
		return 1;
	}
	if(strcmp(cmd,"/ban", true) == 0)
	{
	  tmp = strtok(cmdtext, idx);
	  if(!strlen(tmp))
	  {
	    SendClientMessage(playerid,COLOR_WHITE,"USAGE: /ban [playerid]");
	    return 1;
		}
		giveplayerid = strval(tmp);
		if(PlayerInfo[giveplayerid][admin] == < 1)
		{
		  SendClientMessage(playerid,COLOR_BRIGHTRED,"SAC: You cannot ban an admin!");
		  return 1;
		}
		if(PlayerInfo[playerid][admin] == > 1)
		{
		  format(string, sizeof(string),"SAC: Admin %s banned %s.",PlayerInfo[playerid][name],PlayerInfo[giveplayerid][name]);
		  SendClientMessageToAll(COLOR_BRIGHTRED,string);
			Ban(giveplayerid);
			return 1;
		}
		return 1;
	}
Try that
Reply
#5

its the same as mine....
the problem is that it aint letting me to access the command because the person aint logged in rcon....
Reply
#6

Quote:
Originally Posted by Memoryz
Код:
if(strcmp(cmd,"/kick", true) == 0)
	{
	  tmp = strtok(cmdtext, idx);
	  if(!strlen(tmp))
	  {
	    SendClientMessage(playerid,COLOR_WHITE,"USAGE: /kick [playerid]");
	    return 1;
		}
		giveplayerid = strval(tmp);
		if(PlayerInfo[giveplayerid][admin] == < 1)
		{
		  SendClientMessage(playerid,COLOR_BRIGHTRED,"SAC: You cannot kick an admin!");
		  return 1;
		}
		if(PlayerInfo[playerid][admin] == > 1)
	  {
			format(string, sizeof(string),"SAC: Admin %s kicked %s.",PlayerInfo[playerid][name],PlayerInfo[giveplayerid][name]);
			SendClientMessageToAll(COLOR_BRIGHTRED,string);
			Kick(giveplayerid);
			return 1;
		}
		return 1;
	}
	if(strcmp(cmd,"/ban", true) == 0)
	{
	  tmp = strtok(cmdtext, idx);
	  if(!strlen(tmp))
	  {
	    SendClientMessage(playerid,COLOR_WHITE,"USAGE: /ban [playerid]");
	    return 1;
		}
		giveplayerid = strval(tmp);
		if(PlayerInfo[giveplayerid][admin] == < 1)
		{
		  SendClientMessage(playerid,COLOR_BRIGHTRED,"SAC: You cannot ban an admin!");
		  return 1;
		}
		if(PlayerInfo[playerid][admin] == > 1)
		{
		  format(string, sizeof(string),"SAC: Admin %s banned %s.",PlayerInfo[playerid][name],PlayerInfo[giveplayerid][name]);
		  SendClientMessageToAll(COLOR_BRIGHTRED,string);
			Ban(giveplayerid);
			return 1;
		}
		return 1;
	}
Try that
That isn't the same as yours, try it ffs.
Reply
#7

its nearly same..... both uses " Kick(playerid); "
...
Reply
#8

Quote:
Originally Posted by silvan
its nearly same..... both uses " Kick(playerid); "
...
You don't need rcon to use Kick(giveplayerid)
Reply
#9

DUDE, obviously it uses KICK(playerid), how would you kick the player then??


USE THAT ONE, IT WORKS, I MODIFIED IT!
Reply
#10

Some people just dont want the help so bed i think.
The solution is posted above me and you dont take it.
Then learn to live with it not working.

/Artix
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)