SA-MP Forums Archive
/kick - doesnt works says im not an admin - 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: /kick - doesnt works says im not an admin (/showthread.php?tid=124656)



/kick - doesnt works says im not an admin - Chivava - 31.01.2010

Hello can anyone please help me with the /kick cmd, apparently it doesnt works.. Im the highest level admin (7) and it wont work.

This is how it looks alike:


Код:
  if(strcmp(cmd, "/kick", true) == 0)
	{
	  if(IsPlayerConnected(playerid))
	  {
	  	tmp = strtok(cmdtext, idx);
			if(!strlen(tmp))
			{
				SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /kick [playerid/PartOfName] [reason]");
				return 1;
			}
			giveplayerid = ReturnUser(tmp);
			if (PlayerInfo[playerid][pAdmin] >= 1)
			{
				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, "USAGE: /kick [playerid/PartOfName] [reason]");
							return 1;
						}
						new year, month,day;
						getdate(year, month, day);
						format(string, sizeof(string), "AdmCmd: %s was kicked by %s, for %s (%d-%d-%d)", giveplayer, sendername, (result),month,day,year);
						KickLog(string);
						format(string, sizeof(string), "%s was kicked by %s, for %s", giveplayer, sendername, (result));
						SendClientMessageToAll(COLOR_LIGHTRED, string);
						Kick(giveplayerid);
						return 1;
					}
				}
			}
			else
			{
				format(string, sizeof(string), "  %d is not an active player.", giveplayerid);
				SendClientMessage(playerid, COLOR_GRAD1, string);
			}
		}
		return 1;
	}



Re: /kick - doesnt works says im not an admin - jasonnw666 - 31.01.2010

u use godfather?


Re: /kick - doesnt works says im not an admin - jasonnw666 - 31.01.2010


try this and let me know if that work
/* Command /kick */
else if (!strcmp(cmd, "/kick", true))
{
new pid, tmpp[256],string[256];
new day,month,year;
new hour,minute,second;
if (PlayerInfo[playerid][pAdmin] >= 1)
{
tmpp = strtok(cmdtext, idx);
if (!strlen(tmpp))
{
SendClientMessage(playerid, COLOR_GREEN, "USAGE: /kick [playerid] [reason]");
return 1;
}
pid = strval(tmpp);
if (!(IsPlayerConnected(pid)))
{
SendClientMessage(playerid, COLOR_RED, "THAT PLAYER IS NOT CONNECTED!");
return 1;
}
getdate(year,month,day);
gettime(hour,minute,second);
GetPlayerName(pid, pidName, sizeof(pidName));
format(tmpp, sizeof(tmpp), "You have kicked %s (ID:%d) for reason : %s | Date : %d.%d.%d | Time : %d.%d.%d",pidName,pid,cmdtext[idx],day,month,year,hour,minute,second);
SendClientMessage(playerid, 0xAA3333AA, tmpp);
GetPlayerName(playerid, AdminName, sizeof(AdminName));
GetPlayerName(pid, pidName, sizeof(pidName));
format(string, sizeof(string), "%s has been kicked by admin %s | Reason : %s | Date : %d.%d.%d | Time : %d.%d.%d",pidName,AdminName,cmdtext[idx],day,month,year,hour,minute,second);
SendClientMessageToAll(0xAA3333AA, string);
BK(string);
Kick(pid);
return 1;
}
}


Re: /kick - doesnt works says im not an admin - Chivava - 31.01.2010

Quote:
Originally Posted by jasonnw666
u use godfather?
GTA RP


Re: /kick - doesnt works says im not an admin - Chivava - 31.01.2010

This line gives me error :
GetPlayerName(pid, pidName, sizeof(pidName));
pidName not defined..

What should i define it with ?


Re: /kick - doesnt works says im not an admin - jasonnw666 - 31.01.2010

just add
public OnPlayerCommandText(playerid, cmdtext[])
{
new pidName[MAX_PLAYER_NAME];


Re: /kick - doesnt works says im not an admin - Chivava - 31.01.2010

I've added New pidName[MAX_PLAYER_NAME];
and New AdminName[MAX_PLAYER_NAME];
but now it talks about undefined BK


Re: /kick - doesnt works says im not an admin - jasonnw666 - 31.01.2010

add at the end of yr gm //Bans & Kicks
BK(string[])
{
new tmp[256];
format(tmp, sizeof(tmp), "%s \r\n",string);
new File:hFile;
hFile = fopen("KICKFILE/Bans&kicks.txt", io_append);
fwrite(hFile, tmp);
fclose(hFile);
}

BUT CREATE FOLDER "KICKFILE" in scriptfile


Re: /kick - doesnt works says im not an admin - Chivava - 31.01.2010

Still getting the text You are not an admin.


Re: /kick - doesnt works says im not an admin - NewYorkRP - 31.01.2010

You either have a FS or another /kick command in that script.

in the /kick command you showed us, nothing exists which of "You are not an admin"..

(Well atleast i didn't see it.)