SA-MP Forums Archive
GetAll - 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)
+--- Thread: GetAll (/showthread.php?tid=609064)



GetAll - Filbert - 08.06.2016

I make this command >
PHP код:
CMD:getallhg(playerid,params[]) {
    
#pragma unused params
    
if(PlayerInfo[playerid][HGRank] >= 7) {
        
CMDMessageToAdmins(playerid,"GETAllHG");
        new 
Float:x,Float:y,Float:zinterior GetPlayerInterior(playerid);
        
GetPlayerPos(playerid,x,y,z);
           for(new 
0MAX_PLAYERSi++) {
            if(
IsPlayerConnected(i) && (!= playerid) && != ServerInfo[MaxAdminLevel]) {
                
PlayerPlaySound(i,1057,0.0,0.0,0.0); SetPlayerPos(i,x+(playerid/4)+1,y+(playerid/4),z); SetPlayerInterior(i,interior);
            }
        }
        new 
string[128]; format(string,sizeof(string),"HG Leader \"%s\" has teleported all HG Members"pName(playerid) );
        return 
MessageToHG(bluestring);
    } else return 
SendClientMessage(playerid,red,"ERROR: You need to be HG Member Rank 7 to use this command");

That command must get all HG Clan Members Only.
But It's Get All Player.
I copying that command from this command >
PHP код:
CMD:getall(playerid,params[]) {
    
#pragma unused params
    
if(PlayerInfo[playerid][Level] >= 5) {
        
CMDMessageToAdmins(playerid,"GETAll");
        new 
Float:x,Float:y,Float:zinterior GetPlayerInterior(playerid);
        
GetPlayerPos(playerid,x,y,z);
           for(new 
0MAX_PLAYERSi++) {
            if(
IsPlayerConnected(i) && (!= playerid) && != ServerInfo[MaxAdminLevel]) {
                
PlayerPlaySound(i,1057,0.0,0.0,0.0); SetPlayerPos(i,x+(playerid/4)+1,y+(playerid/4),z); SetPlayerInterior(i,interior);
            }
        }
        new 
string[128]; format(string,sizeof(string),"Administrator \"%s\" has teleported all players"pName(playerid) );
        return 
SendClientMessageToAll(bluestring);
    } else return 
SendClientMessage(playerid,red,"ERROR: You need to be level 5 to use this command");

I don't know how to fix that error.
Please Help Me To Solve This Problem.
Thanks And God Bless You All


Re: GetAll - Nin9r - 08.06.2016

What variabiable are you using for HG member?

HG?

Try it:
Код HTML:
CMD:getallhg(playerid,params[]) { 
    #pragma unused params 
    if(PlayerInfo[playerid][HGRank] >= 7) { 
        CMDMessageToAdmins(playerid,"GETAllHG"); 
        new Float:x,Float:y,Float:z, interior = GetPlayerInterior(playerid); 
        GetPlayerPos(playerid,x,y,z); 
           for(new i = 0; i < MAX_PLAYERS; i++) { 
            if(IsPlayerConnected(i) && (i != playerid) && i != ServerInfo[MaxAdminLevel] && i == PlayerInfo[playerid][HG]) { 
                PlayerPlaySound(i,1057,0.0,0.0,0.0); SetPlayerPos(i,x+(playerid/4)+1,y+(playerid/4),z); SetPlayerInterior(i,interior); 
            } 
        } 
        new string[128]; format(string,sizeof(string),"HG Leader \"%s\" has teleported all HG Members", pName(playerid) ); 
        return MessageToHG(blue, string); 
    } else return SendClientMessage(playerid,red,"ERROR: You need to be HG Member Rank 7 to use this command"); 
}



Re: GetAll - Stinged - 08.06.2016

Quote:
Originally Posted by Nin9r
Посмотреть сообщение
What variabiable are you using for HG member?
Код:
i == PlayerInfo[playerid][HG]
It should be something like PlayerInfo[i][HG] > 0, and not the way you wrote it.

That should fix it (Change PlayerInfo to whatever your enum is called)
I'm just going to add that you should start using GetPlayerPoolSize instead of MAX_PLAYERS in loops.


Re: GetAll - Filbert - 08.06.2016

I use PlayerInfo[playerid][HGRank]


Re: GetAll - Filbert - 08.06.2016

What should I do now?
Change the
PHP код:
for(new 0MAX_PLAYERSi++) { 
To what code?


Re: GetAll - Stinged - 08.06.2016

Код:
CMD:getallhg(playerid)
{ 
    if(PlayerInfo[playerid][HGRank] >= 7)
	{ 
        CMDMessageToAdmins(playerid,"GETAllHG"); 
        new Float:x, Float:y, Float:z, interior = GetPlayerInterior(playerid); 
        GetPlayerPos(playerid, x, y, z); 
           for(new i = 0, j = GetPlayerPoolSize(); i <= j; i++)
		   { 
            if(IsPlayerConnected(i) && (i != playerid) && i != ServerInfo[MaxAdminLevel]) 
			{
				if (PlayerInfo[i][HGRank] > 0)
				{
					PlayerPlaySound(i, 1057, 0.0, 0.0, 0.0);
					SetPlayerPos(i, x+(playerid/4)+1, y+(playerid/4), z);
					SetPlayerInterior(i, interior); 
				}
            } 
        } 
        new string[128]; format(string,sizeof(string),"HG Leader \"%s\" has teleported all HG Members", pName(playerid) ); 
        return MessageToHG(blue, string); 
    }
	else SendClientMessage(playerid,red,"ERROR: You need to be HG Member Rank 7 to use this command");
	return 1;
}



Re: GetAll - Sew_Sumi - 08.06.2016

Yea, don't use pragma that you don't need.


Re: GetAll - Filbert - 08.06.2016

I found this error >
Код:
H:\GAME\SA-MP Server\HGTDM\Gamemodes\HGTDM~RP.pwn(32028) : error 017: undefined symbol "GetPlayerPoolSize"

Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.



Re: GetAll - Nin9r - 08.06.2016

Try this command:

Код HTML:
CMD:getallhg(playerid, params[])
{
		if(PlayerInfo[playerid][HGRank] >= 7)
		{
	        CMDMessageToAdmins(playerid,"GETAllHG");
	        new Float:x,Float:y,Float:z, interior = GetPlayerInterior(playerid);
	        GetPlayerPos(playerid,x,y,z);
	        foreach(Player, i)
	        {
	            if(i != ServerInfo[MaxAdminLevel])
	            {
					if(PlayerInfo[i][HGRank] > 0)
					{
	                PlayerPlaySound(i,1057,0.0,0.0,0.0);
	                SetPlayerPos(i,x+(playerid/4)+1,y+(playerid/4),z);
	                SetPlayerInterior(i,interior);
        			}
        			new string[128];
					format(string,sizeof(string),"HG Leader \"%s\" has teleported all HG Members", pName(playerid));
        			MessageToHG(blue, string);
	            }
	        }
		}
		else SCM(playerid, COLOR_WHITE,"You must have rank higher than 7.");
		return 1;
}



Re: GetAll - Sew_Sumi - 08.06.2016

Quote:
Originally Posted by Filbert
Посмотреть сообщение
I found this error >
Код:
H:\GAME\SA-MP Server\HGTDM\Gamemodes\HGTDM~RP.pwn(32028) : error 017: undefined symbol "GetPlayerPoolSize"

Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.
Код:
for(new i = 0, j = GetPlayerPoolSize(); i <= j; i++)
If it's prior to 0.3.7 that could be something to do with it. If you are using 0.3.7 then update your includes.

If prior to 0.3.7

Код:
for(new i = 0, i <= MAX_PLAYERS; i++)