SA-MP Forums Archive
I had A problem - 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: I had A problem (/showthread.php?tid=643911)



I had A problem - jaberaaa - 30.10.2017

This Message is Bugged i tryed many times to fix but cannot when a player login i see the message even im not on his gang faction
This IS the edited code
PHP код:
            for(new 0GetPlayerPoolSize(); i++)
            {
                            if(
PlayerInfo[i][pFaction] == PlayerInfo[playerid][pFaction] && PlayerInfo[i][pFaction] != 0)
                            {
                                new 
string[100];
                                
format(stringsizeof(string), "*** %s from your faction has logged in"GetPlayerNameEx(playerid));
                                
printf("%s from your faction has logged in",GetPlayerNameEx(playerid));
                                
SendClientMessage(iCOLOR_JUNIORADMINstring);
                            }
                            if(
PlayerInfo[i][pGang] == PlayerInfo[playerid][pGang] && PlayerInfo[i][pGang] != 0)
                            {
                                new 
string[100];
                                
format(stringsizeof(string), "*** %s from your gang has loggedin"GetPlayerNameEx(playerid));
                                
printf("%s from your gang has logged in",GetPlayerNameEx(playerid));
                                
SendClientMessage(iCOLOR_JUNIORADMINstring);
                            }
            } 
And This is the real one
PHP код:
            GetIPCountry(PlayerInfo[playerid][pIP], countrysizeof(country));
            foreach(
Playeri)
            {
                if(
PlayerInfo[i][pFaction] == PlayerInfo[playerid][pFaction] && PlayerInfo[i][pFaction] != 0)
                {
                    
format(stringsizeof(string), "*** %s from your faction has logged in."GetPlayerNameEx(playerid));
                    
SendClientMessageEx(iCOLOR_JUNIORADMINstring);
                }
                if(
PlayerInfo[i][pGang] == PlayerInfo[playerid][pGang] && PlayerInfo[i][pGang] != 255)
                {
                    
format(stringsizeof(string), "*** %s from your gang has logged in."GetPlayerNameEx(playerid));
                    
SendClientMessageEx(iCOLOR_JUNIORADMINstring);
                }
                 if(
ipmessages[i])
                {
                    
gettime(hour,minute,second);
                    
format(stringsizeof(string), "[CONNECTIONS]{FFFF00} (%d:%d:%d) %s (IP:%s) from %s has logged in."hourminutesecondGetPlayerNameEx(playerid), PlayerInfo[playerid][pIP], country);
                    
SendClientMessageEx(iCOLOR_JUNIORADMINstring);
                }
            } 



Re: I had A problem - Arbico - 30.10.2017

Not sure if this is gonna work, but try it.

PHP код:
for(new 0GetPlayerPoolSize(); i++) 
            { 
                            if(
PlayerInfo[i][pFaction] == PlayerInfo[playerid][pFaction] && PlayerInfo[i][pFaction] != && PlayerInfo[playerid][pFaction] != 0
                            { 
                                new 
string[100]; 
                                
format(stringsizeof(string), "*** %s from your faction has logged in"GetPlayerNameEx(playerid)); 
                                
printf("%s from your faction has logged in",GetPlayerNameEx(playerid)); 
                                
SendClientMessage(iCOLOR_JUNIORADMINstring); 
                            } 
                            if(
PlayerInfo[i][pGang] == PlayerInfo[playerid][pGang] && PlayerInfo[i][pGang] != && PlayerInfo[playerid][pGang] != 0
                            { 
                                new 
string[100]; 
                                
format(stringsizeof(string), "*** %s from your gang has loggedin"GetPlayerNameEx(playerid)); 
                                
printf("%s from your gang has logged in",GetPlayerNameEx(playerid)); 
                                
SendClientMessage(iCOLOR_JUNIORADMINstring); 
                            } 

            } 



Re: I had A problem - jaberaaa - 30.10.2017

Quote:
Originally Posted by Arbico
Посмотреть сообщение
Not sure if this is gonna work, but try it.

PHP код:
for(new 0GetPlayerPoolSize(); i++) 
            { 
                            if(
PlayerInfo[i][pFaction] == PlayerInfo[playerid][pFaction] && PlayerInfo[i][pFaction] != && PlayerInfo[playerid][pFaction] != 0
                            { 
                                new 
string[100]; 
                                
format(stringsizeof(string), "*** %s from your faction has logged in"GetPlayerNameEx(playerid)); 
                                
printf("%s from your faction has logged in",GetPlayerNameEx(playerid)); 
                                
SendClientMessage(iCOLOR_JUNIORADMINstring); 
                            } 
                            if(
PlayerInfo[i][pGang] == PlayerInfo[playerid][pGang] && PlayerInfo[i][pGang] != && PlayerInfo[playerid][pGang] != 0
                            { 
                                new 
string[100]; 
                                
format(stringsizeof(string), "*** %s from your gang has loggedin"GetPlayerNameEx(playerid)); 
                                
printf("%s from your gang has logged in",GetPlayerNameEx(playerid)); 
                                
SendClientMessage(iCOLOR_JUNIORADMINstring); 
                            } 
            } 
I will Try It up


Re: I had A problem - jaberaaa - 30.10.2017

Quote:
Originally Posted by Arbico
Посмотреть сообщение
Not sure if this is gonna work, but try it.

PHP код:
for(new 0GetPlayerPoolSize(); i++) 
            { 
                            if(
PlayerInfo[i][pFaction] == PlayerInfo[playerid][pFaction] && PlayerInfo[i][pFaction] != && PlayerInfo[playerid][pFaction] != 0
                            { 
                                new 
string[100]; 
                                
format(stringsizeof(string), "*** %s from your faction has logged in"GetPlayerNameEx(playerid)); 
                                
printf("%s from your faction has logged in",GetPlayerNameEx(playerid)); 
                                
SendClientMessage(iCOLOR_JUNIORADMINstring); 
                            } 
                            if(
PlayerInfo[i][pGang] == PlayerInfo[playerid][pGang] && PlayerInfo[i][pGang] != && PlayerInfo[playerid][pGang] != 0
                            { 
                                new 
string[100]; 
                                
format(stringsizeof(string), "*** %s from your gang has loggedin"GetPlayerNameEx(playerid)); 
                                
printf("%s from your gang has logged in",GetPlayerNameEx(playerid)); 
                                
SendClientMessage(iCOLOR_JUNIORADMINstring); 
                            } 
            } 
Its Not working


Re: I had A problem - jaberaaa - 31.10.2017

Mhm? Please .


Re: I had A problem - Nyzenic - 31.10.2017

Try replacing
Код:
for(new i = 0; i < GetPlayerPoolSize(); i++)
with this
Код:
foreach(new i : Player)
update ur foreach if it doesnt work


Re: I had A problem - xMoBi - 31.10.2017

for(new i = 0; i < GetPlayerPoolSize(); i++) // wrong
for(new i = 0; i <= GetPlayerPoolSize(); i++) // correct (slower)
for(new i = GetPlayerPoolSize(); i != -1; i--) // correct (faster)

https://sampwiki.blast.hk/wiki/GetPlayerPoolSize