if (PlayerInfo[playerid][pAdmin]>1)
#1

Quote:

CMD:kick(playerid, params[])
{
if (PlayerInfo[playerid][pAdmin]>1)
{
Kick(playerid);
}
else
{
SetPlayerSkin(playerid,29);
}
return 1;
}
//////////////////////////////////
CMDetadmin(playerid, params[])
{
new INI:File = INI_Open(UserPath(playerid));
INI_SetTag(File,"data");
INI_WriteInt(File,"Admin",1);
INI_Close(File);
return 1;
}
CMDetplayer(playerid, params[])
{
new INI:File = INI_Open(UserPath(playerid));
INI_SetTag(File,"data");
INI_WriteInt(File,"Admin",0);
INI_Close(File);

return 1;
}

I want to make /kick command and if player is an admin,it sets his skin to 29 and if player is not an admin then it kicks him. - Someone please help me
Reply
#2

if (PlayerInfo[playerid][pAdmin]>1)

Change > to <
Reply
#3

< = - Level 1, > = + Level 1, wich means > 1 = Can kick the player, < 1 cannot kick him.
Reply
#4

pawn Code:
CMD:kick(playerid, params[])
{
    if (PlayerInfo[playerid][pAdmin]>1) SetPlayerSkin(playerid,29);
    else Kick(playerid);
    return 1;
}
Reply
#5

Thanks guys,Appreciate
Reply
#6

It's NOT working

It kicks me even if i'm admin.
Reply
#7

Quote:

CMD:kick(playerid, params[])
{
if (PlayerInfo[playerid][pAdmin]>1)
{
SetPlayerSkin(playerid,29);
}
else
{
SetPlayerSkin(playerid,31);
}
return 1;
}

I tried with that but it freezes my player and I cant move at all...
Someone please help and write what >, < , += ,-=... means.
Reply
#8

Quote:

if (PlayerInfo[playerid][pAdmin]>=1)
{
SetPlayerSkin(playerid,29);
}

That worked but it only changed my skin to 29 but
Quote:

else
{
SetPlayerSkin(playerid,31);
}
return 1;
}

didn't work.
Reply
#9

I though a kick command is to kick people... What you're trying to do ? I didn't understtand...
Reply
#10

CMD:kick(playerid, params[])

new id;

{
if (PlayerInfo[playerid][pAdmin]>1)
{
Kick(id);
}
else
{
SetPlayerSkin(id,29);
}
return 1;
}
Reply
#11

Code:
CMD:kick(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] > 1)
	{
		Kick(playerid);
	}
	else
	{
		SetPlayerSkin(playerid, 29);
	}
	return 1;
}
Reply
#12

Quote:
Originally Posted by jNkk
View Post
I though a kick command is to kick people... What you're trying to do ? I didn't understtand...
I am learning to script and exploring new commands
Reply
#13

Quote:
Originally Posted by Tamer T
View Post
CMD:kick(playerid, params[])

new id;

{
if (PlayerInfo[playerid][pAdmin]>1)
{
Kick(id);
}
else
{
SetPlayerSkin(id,29);
}
return 1;
}
Still doesn't work

It gives me skin id 29 if I'm admin but when i make myself a normal player - It doesn't kick me
Reply
#14

.....
Reply
#15

The command works fine, you're doing something wrong. If your admin level is 1, it won't work because you check if the admin level is equal or greater to 2. If you want for levels 1 and greater, then you have to use '>='.
pawn Code:
CMD:kick(playerid, params[])
{
    if (PlayerInfo[playerid][pAdmin]>=1) SetPlayerSkin(playerid,29);
    else Kick(playerid);
    return 1;
}
If the operations confuse you, then read this from SA:MP Wiki - Control Structures#Operators
Reply
#16

WHAT IS THIS >.<
Reply
#17

Quote:
Originally Posted by Typhome
View Post
Code:
CMD:kick(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] > 1)
	{
		Kick(playerid);
	}
	else
	{
		SetPlayerSkin(playerid, 29);
	}
	return 1;
}
Do u know maths? '>' means greater than, it means if ur admin lvl > 1 than, u will be kicked
Reply
#18

pawn Code:
CMD:kick(playerid, params[])
{
      if(IsPlayerAdmin(playerid)) // I put here so the player needs to be RCON Admin to do it.
      {
          if(sscanf(params, "u", targetid)) return SendClientMessage(playerid, COLOR_RED, "Syntax: /kick [PlayerName/ID]");  
          Kick(targetid);
       }
       else return SendClientMessage(playerid, COLOR_RED, "Nope :3"); //Sending the person message that he isnt allowed to do that.
       return 1;
}
Reply
#19

CMD:kick(playerid,params[])
{
if(PlayerInfo[playerid][pAdmin] >= 1)
{
new RecieverID;
if(sscanf(params,"u",RecieverID)) return SendClientMessage(playerid,0xFFFFFF,"/kick [id]
if(PlayerInfo[RecieverID][pAdmin] >= 1) return SetPlayerSkin(playerid,29);
Kick(Recieverid);
}
else
{
SendClientMessage(playerid,0xFFFFFF,"You are not admin");
}
return 1;
}
Reply
#20

i didnt understand waht you are trying to do?
Reply


Forum Jump:


Users browsing this thread: 6 Guest(s)