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



Maskon - bleedis - 18.05.2012

hey there!
again im here with my problem and stuff. I ripped out this mask command i think from ravens script. dont remember but i have problem with it. when someone puts it on everything works great and so on. but when he teleports or goes out from interior name shows. someone maybe know how to prevent that?
pawn Код:
if(strcmp(cmd, "/maskon", true) == 0)
    {
        if(PlayerHasItem(playerid,"Mask") == 0) return SendClientMessage(playerid,COLOR_GREY,"{ff0000}** {C8D1CC}You dont have a mask!");
        if(IsPlayerConnected(playerid))
        {
            pColor = GetPlayerColor(playerid);
            SendClientMessage(playerid, COLOR_WHITE,"{8FE11F}** {C8D1CC}You putted on your mask.");
            for(new i = 0; i < MAX_PLAYERS; i++)
            {
            ShowPlayerNameTagForPlayer(i, playerid, false);
            SetPlayerColor(playerid, 0xFFFFFF00);
            SetPlayerAttachedObject(playerid, 2, 18912, 2,0.078534, 0.041857, -0.001727, 268.970458, 1.533374, 269.223754);
            }
        }
        return 1;
    }

    if(strcmp(cmd, "/maskoff", true) == 0)
    {
        if(PlayerHasItem(playerid,"Mask") == 0) return SendClientMessage(playerid,COLOR_GREY,"{ff0000}** {C8D1CC}You dont have a mask!");
        if(IsPlayerConnected(playerid))
        {
            for(new i = 0; i < MAX_PLAYERS; i++)
            {
                if(IsPlayerConnected(i))
                {
                  ShowPlayerNameTagForPlayer(playerid, i, true);
                  SetPlayerColor(playerid, pColor);
                  RemovePlayerAttachedObject(playerid, 2);
            }
        }
            SendClientMessage(playerid, COLOR_GREEN, "{8FE11F}** {C8D1CC}You tooked your mask off.");
        }
        return 1;
    }



Re: Maskon - milanosie - 18.05.2012

Because people stream-in and steream out.

If someone relogs he/she will see the name again.

Best way is to use :

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

without the if(IsPlayerConnected(i)
I use custom nametags though.


Re: Maskon - bleedis - 18.05.2012

Okey. Thank u for reply. I will try that.
EDIT: no its still not working


Re: Maskon - bleedis - 19.05.2012

Sorry for double post.
Any other idea?


Re: Maskon - SuperViper - 19.05.2012

Save the person's mask status (on/off) in a variable and in OnPlayerStreamIn hide/show the nametag.


Re: Maskon - bleedis - 21.05.2012

Something like that?
pawn Код:
public OnPlayerStreamIn(playerid, forplayerid)
{
    if(Maskon[playerid] == 1)
    {
        for(new i = 0; i < MAX_PLAYERS; i++)
        {
         ShowPlayerNameTagForPlayer(playerid, i, false);
         SetPlayerColor(playerid, 0xFFFFFF00);
        }
    }
    return 1;
}
Doesnt work


Re: Maskon - bleedis - 22.05.2012

bump, guys i know u can make it happen.


Re: Maskon - Tigerkiller - 22.05.2012

pawn Код:
public OnPlayerStreamIn(playerid, forplayerid)
{
    if(Maskon[playerid] == 1)
    {
         ShowPlayerNameTagForPlayer(playerid, forplayerid, false);
         SetPlayerColor(playerid, 0xFFFFFF00);
    }
    return 1;
}
//EDIT: Stop Theard Bumping please


Re: Maskon - Lorenc_ - 08.06.2012

Quote:
Originally Posted by milanosie
Посмотреть сообщение
Because people stream-in and steream out.

If someone relogs he/she will see the name again.

Best way is to use :

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

without the if(IsPlayerConnected(i)
I use custom nametags though.
What made you even think that "IsPlayerConnected" is relevant to this situation? You are just basically asking him to remove some loop that he has optimized.


Re: Maskon - bleedis - 11.06.2012

ok, now problem is that when i stream other player then i cant see his nick not he my. its like he have a mask
pawn Код:
public OnPlayerStreamIn(playerid, forplayerid)
{
    if(IsMasked[playerid] == true)
    {
        ShowPlayerNameTagForPlayer(playerid, forplayerid, false);
        SetPlayerColor(playerid, 0xFFFFFF00);
    }
    return 1;
}