PDA

View Full Version : Onplayerupdate


Tamer
10/11/2012, 07:31 PM
Aight,I got playerupdate checking for miniguns,but I have done a cmd that makes the players HasMG =1 and gives a minigun,which will exclude from the ban spree. I know its about if clause and "and"s but couldn't get in to it. I asked a friend he told me a bunch of stuff but still dunno how to do it.

I just want it not to ban if the player is HasMG[playerid] = 1; and If player is an admin lvl 4.

public OnPlayerUpdate(playerid)
{
new weapon=GetPlayerWeapon(playerid);
if(weapon==38||weapon==1||weapon==2||weapon==3||we apon==5||weapon==6||weapon==7||weapon==8||weapon== 9||weapon==10||weapon==11||weapon==12||weapon==13| |weapon==14||weapon==15||weapon==35||weapon==39)
if(PlayerInfo[playerid][pAdmin] < 4)
HasMG[playerid] = 0;
{

JJones432
10/11/2012, 07:37 PM
The first time you set it, it stays the same as you are setting the variable to 1.

Having this many checks for something which has already been defined is kinda pointless. So if you have HasMG[playerid] = 1; on your command, you don't need to set it again ;)

Also, on your Ban check, just add the line
if(PlayerInfo[playerid][pAdmin] != 4) return 0;

Tamer
10/11/2012, 07:42 PM
It is working well with Padmin=4 aldready, I want it NOT to ban if the player HasMG= 1;

Finn
10/11/2012, 09:27 PM
if(PlayerInfo[playerid][pAdmin] < 4 && HasMG[playerid] != 1)