/kick - doesnt works says im not an admin
#1

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;
	}
Reply
#2

u use godfather?
Reply
#3


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;
}
}
Reply
#4

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

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

What should i define it with ?
Reply
#6

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

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

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
Reply
#9

Still getting the text You are not an admin.
Reply
#10

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


Forum Jump:


Users browsing this thread: 1 Guest(s)