SA-MP Forums Archive
Is it possible to make this? - 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: Is it possible to make this? (/showthread.php?tid=206610)



Is it possible to make this? - Universal - 04.01.2011

Hey i wanted to ask if tis possible to make this, like:

if you dont know that player it will show his name, otherwise it wont display player name with ShowPlayerNameTagForPlayer, but instead it will show his id with attach3dtextlabel... And if its possible, could you please get me on the right way of doing this? Like, the arrays combination or everything else...

Thanks in advice!


Re: Is it possible to make this? - ғαιιοцт - 04.01.2011

OnPlayerStreamIn you would need to use ShowPlayerNameTagForPlayer, as you said
You need to use an array for saving "does the player know eachother"?
you could do that at OnPlayerConnect by looping trough all players, and then setting the variable on true or false:

at top:
Код:
new bool:DoesPlayerKnowPlayer[MAX_PLAYERS][MAX_PLAYERS];
for example: DoesPlayerKnowPlayer[1][20] would mean that playerid 1 knows playerid 20 if it returns True
if it returns False they don't know eachother

so at onplayerconnect you would have:

Код:
public OnPlayerConnect(playerid, ...)
{
    for(new i; i<MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i))
        {
            if(TheyOnowEachOther)
            {
                DoesPlayerKnowPlayer[playerid][i] = true; //setting for the player himself
                DoesPlayerKnowPlayer[i][playerid] = true; //and also for the other player
            }
            else
            {
                DoesPlayerKnowPlayer[playerid][i] = false;
                DoesPlayerKnowPlayer[i][playerid] = false;
            }
        }
    }
}



Re: Is it possible to make this? - Universal - 04.01.2011

Quote:
Originally Posted by ғαιιοцт
Посмотреть сообщение
OnPlayerStreamIn you would need to use ShowPlayerNameTagForPlayer, as you said
You need to use an array for saving "does the player know eachother"?
you could do that at OnPlayerConnect by looping trough all players, and then setting the variable on true or false:

at top:
Код:
new bool:DoesPlayerKnowPlayer[MAX_PLAYERS][MAX_PLAYERS];
for example: DoesPlayerKnowPlayer[1][20] would mean that playerid 1 knows playerid 20 if it returns True
if it returns False they don't know eachother

so at onplayerconnect you would have:

Код:
public OnPlayerConnect(playerid, ...)
{
    for(new i; i<MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i))
        {
            if(TheyOnowEachOther)
            {
                DoesPlayerKnowPlayer[playerid][i] = true; //setting for the player himself
                DoesPlayerKnowPlayer[i][playerid] = true; //and also for the other player
            }
            else
            {
                DoesPlayerKnowPlayer[playerid][i] = false;
                DoesPlayerKnowPlayer[i][playerid] = false;
            }
        }
    }
}
Thanks!