SA-MP Forums Archive
[HELP] Confused - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: [HELP] Confused (/showthread.php?tid=98157)



[HELP] Confused - silvan - 19.09.2009

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...


Re: [HELP] Confused - _Vortex - 19.09.2009

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.


Re: [HELP] Confused - silvan - 19.09.2009

didn't worked


Re: [HELP] Confused - Memoryz - 19.09.2009

Код:
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


Re: [HELP] Confused - silvan - 19.09.2009

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


Re: [HELP] Confused - Memoryz - 19.09.2009

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.


Re: [HELP] Confused - silvan - 19.09.2009

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


Re: [HELP] Confused - _Vortex - 19.09.2009

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


Re: [HELP] Confused - Memoryz - 19.09.2009

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


USE THAT ONE, IT WORKS, I MODIFIED IT!


Re: [HELP] Confused - Doppeyy - 19.09.2009

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