SA-MP Forums Archive
Quick Question - 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: Quick Question (/showthread.php?tid=151746)



Quick Question - TKZ227 - 31.05.2010

I'm drawing a blank.. if I am trying to make it so someone can do /goto if their if(PlayerInfo[playerid][pHelper] >= 1) OR if their if(PlayerInfo[playerid][pAdmin] >= 1) how would I do that? I just need to know how to make it so you can do it if your a helper level 1 OR an admin level 1. Thanks in advance.


Re: Quick Question - Lewwy - 31.05.2010

pawn Код:
if(PlayerInfo[playerid][pHelper] >= 1 || PlayerInfo[playerid][pAdmin] >= 1)
{
   // do something
}
This will do a check like, if the player typing the command is level 1 or bigger, do something.
If you wanted a specific level, change it to this:

pawn Код:
if(PlayerInfo[playerid][pHelper] == 1 || PlayerInfo[playerid][pAdmin] == 1)
{
   // do something
}
Notice the >= is now ==.


Re: Quick Question - DJDhan - 31.05.2010

Quote:
Originally Posted by Ljai
pawn Код:
if(PlayerInfo[playerid][pHelper] >= 1 || PlayerInfo[playerid][pAdmin] >= 1)
{
   // do something
}
put that under the command like so
Код:
if(!strcmp(cmdtext,"/goto,true,5))
{
 if(PlayerInfo[playerid][pHelper] >= 1 || PlayerInfo[playerid][pAdmin] >= 1)
 {
   // do something
 }
  return 1;
}



Re: Quick Question - TKZ227 - 31.05.2010

Код:
public HBroadCast(color,const string[],level)
{
	for(new i = 0; i < MAX_PLAYERS; i++)
	{
		if(IsPlayerConnected(i))
		{
			if (PlayerInfo[i][pHelper] >= 1 )
			{
  				if(OnHelperDuty[playerid]==0)
        {
				SendClientMessage(i, color, string);
				printf("%s", string);
			}
		}
	}
	}
	return 1;
}
And the error (On the HBroadCast line)

Код:
C:\Users\Tyler\Desktop\SARP\gamemode\gf.pwn(998) : error 025: function heading differs from prototype
C:\Users\Tyler\Desktop\SARP\gamemode\gf.pwn(998) : error 025: function heading differs from prototype



Re: Quick Question - TKZ227 - 31.05.2010

I fixed the above, but I have a new problem..

Код:
public HBroadCast(color,const string[],level)
{
	for(new i = 0; i < MAX_PLAYERS; i++)
	{
		if(IsPlayerConnected(i))
		{
			if (PlayerInfo[i][pHelper] >= 1 )
        {
        	if(OnHelperDuty[playerid]==1)
        	{
				SendClientMessage(i, color, string);
				printf("%s", string);
				}
			}
		}
	}
	return 1;
}
And it says "Unidentified "playerid" "


Re: Quick Question - azzerking - 31.05.2010

Try Adding playerid To This Line

public HBroadCast(color,const string[],level)

If This Helps