SA-MP Forums Archive
Help On this msg - 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: Help On this msg (/showthread.php?tid=632123)



Help On this msg - Bojaa - 09.04.2017

This Script Have prob When I join I Must Not See it Just Other members who are in gang or on the faction see it
PHP код:
                if(PlayerInfo[playerid][pFaction] == PlayerInfo[playerid][pFaction] && PlayerInfo[i][pFaction] != 0)
                {
                    
format(stringsizeof(string), "*** %s from your faction has logged in."GetPlayerNameEx(playerid));
                    
SendClientMessageEx(playeridCOLOR_JUNIORADMINstring);
                }
                if(
PlayerInfo[playerid][pGang] == PlayerInfo[playerid][pGang] && PlayerInfo[i][pGang] != 255)
                {
                    
format(stringsizeof(string), "*** %s from your gang has logged in."GetPlayerNameEx(playerid));
                    
SendClientMessageEx(playeridCOLOR_JUNIORADMINstring);
                } 



Re: Help On this msg - coool - 09.04.2017

Код:
                if(PlayerInfo[playerid][pFaction] == PlayerInfo[playerid][pFaction] && PlayerInfo[i][pFaction] != 0) 
                {
Faction number or any thing other there no time to explain.


Re: Help On this msg - Bojaa - 09.04.2017

Quote:
Originally Posted by coool
Посмотреть сообщение
Код:
                if(PlayerInfo[playerid][pFaction] == PlayerInfo[playerid][pFaction] && PlayerInfo[i][pFaction] != 0) 
                {
Faction number or any thing other there no time to explain.
... I Just Wont See It Just others see


Re: Help On this msg - coool - 09.04.2017

You are not in the faction, but the others are? yes I am!!!. Even without being in any faction you get the message of faction joining. That's your problem. It is because this sentence
Код:
if(PlayerInfo[playerid][pFaction] == PlayerInfo[playerid][pFaction]
will evaluate true because you are checking if the same variables are equal. And the code nested in will run. To solve this do
Код:
if(PlayerInfo[playerid][pFaction] == //Here the appropriate number of faction)



Re: Help On this msg - Bojaa - 09.04.2017

Quote:
Originally Posted by coool
Посмотреть сообщение
You are not in the faction, but the others are? yes I am!!!. Even without being in any faction you get the message of faction joining. That's your problem. It is because this sentence
Код:
if(PlayerInfo[playerid][pFaction] == PlayerInfo[playerid][pFaction]
will evaluate true because you are checking if the same variables are equal. And the code nested in will run. To solve this do
Код:
if(PlayerInfo[playerid][pFaction] == //Here the appropriate number of faction)
No Im In A faction And On Gang But i wont see that msg Just other members of faction or gang


Re: Help On this msg - khRamin78 - 09.04.2017

PHP код:
public OnPlayerConnect(playerid)
{
    new 
string[128];
    if(
PlayerInfo[playerid][pFaction] != 0)
    {
        
format(stringsizeof(string), "*** %s from your faction has logged in."GetPlayerNameEx(playerid));
        for(new 
i;i<MAX_PLAYER;i++)
        {
                    if(
== playerid) continue;
            if(
PlayerInfo[playerid][pFaction] == PlayerInfo[i][pFaction])
            {
                
SendClientMessage(i,-1,string);
            }
        }
    }
    return 
1;

do this method for your gang too it will work for you


Re: Help On this msg - Vin Diesel - 09.04.2017

Delete please.


Re: Help On this msg - khRamin78 - 09.04.2017

PlayerInfo[playerid][pGang] == PlayerInfo[playerid][pGang]

i realy cant understand this part ? why u are using this ? they are always same like using 1=1


Re: Help On this msg - Bojaa - 09.04.2017

Quote:
Originally Posted by khRamin78
Посмотреть сообщение
PlayerInfo[playerid][pGang] == PlayerInfo[playerid][pGang]

i realy cant understand this part ? why u are using this ? they are always same like using 1=1
Yes Its False I delted It


Re: Help On this msg - Bojaa - 09.04.2017

Quote:
Originally Posted by khRamin78
Посмотреть сообщение
PHP код:
public OnPlayerConnect(playerid)
{
    new 
string[128];
    if(
PlayerInfo[playerid][pFaction] != 0)
    {
        
format(stringsizeof(string), "*** %s from your faction has logged in."GetPlayerNameEx(playerid));
        for(new 
i;i<MAX_PLAYER;i++)
        {
                    if(
== playerid) continue;
            if(
PlayerInfo[playerid][pFaction] == PlayerInfo[i][pFaction])
            {
                
SendClientMessage(i,-1,string);
            }
        }
    }
    return 
1;

do this method for your gang too it will work for you
Im getting this warning
warning 219: local variable "i" shadows a variable at a preceding level