/maskon
#1

How to make that when player do /maskon it change his name to (id)(masked)? And to show his health and armour ,example if player is id 10 when he do maskon he will be (10)(Masked) and when he do /maskoff to return his name back to normal?
Reply
#2

I'm quite uncertain if what you're trying to do will have the actual effect you want.

You can either use SetPlayerName() with format() to set the nickname, or simply hide the nickname with ShowPlayerNameTagForPlayer(). However, the second option won't have the health or armour visible.

From top of my head, that's the only solution which I can think of right now.
Reply
#3

I used already setplayername but it was like (Masked) not (id)(masked) and i dont know how to return to old name
Reply
#4

Well show us the code you tried to use. Also, with the old name, you just have to store it in an array variable before changing the name, using playerid as variable's index.
Reply
#5

You could use
format it

format(string, sizeof(string),"%d Masked", pid);
Create3DTextLabela(text[], color, Float:X, Float:Y, Float:Z, FloatrawDistance, virtualworld, testLOS)
and
Attach3DTextLabelToPlayer(Text3D:id, playerid, Float:OffsetX, Float:OffsetY, Float:OffsetZ)
Reply
#6

Here is my /maskon :

pawn Код:
if(strcmp(cmd, "/maskon", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            if(PlayerInfo[playerid][pMask] == 0)
            {
                 SendClientMessage(playerid, COLOR_GRAD1, "   Nemate masku");
                 return 1;
            }
            if(PlayerInfo[playerid][pLevel] < 5)
            {
                SendClientMessage(playerid, COLOR_GRAD1, "  Niste u mogucnosti da je koristite.");
                return 1;
            }
            foreach (Player, i)
            {
                ShowPlayerNameTagForPlayer(i, playerid, 0);
            }
            PlayerInfo[playerid][pMaskuse] = 1;
            SendClientMessage(playerid, COLOR_WHITE, "Stavili ste vasu masku [/maskoff da je skinete].");
            GetPlayerName(playerid, sendername, sizeof(sendername));
            format(string, sizeof(string), "* %s stavlja masku.", sendername);
            ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
        }
        return 1;
    }
And here /maskoff :

pawn Код:
if(strcmp(cmd, "/maskoff", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            if(PlayerInfo[playerid][pMask] == 0)
            {
                SendClientMessage(playerid, COLOR_GRAD1, "   Nemate masku");
                return 1;
            }
            if(PlayerInfo[playerid][pLevel] < 5)
            {
                SendClientMessage(playerid, COLOR_GRAD1, "   Niste u mogucnosti da je koristite.");
                return 1;
            }
            foreach (Player, i)
            {
                ShowPlayerNameTagForPlayer(i, playerid, 1);
            }
            PlayerInfo[playerid][pMaskuse] = 0;
            SendClientMessage(playerid, COLOR_WHITE, "Skinuli ste masku [/maskon da je opet stavite].");
            GetPlayerName(playerid, sendername, sizeof(sendername));
            format(string, sizeof(string), "* %s skida masku.", sendername);
            ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
        }
        return 1;
    }
And command for admins to see who is wearing a mask /masked :

pawn Код:
if (strcmp(cmd, "/masked", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            if(PlayerInfo[playerid][pAdmin] < 1 && PlayerInfo[playerid][pGm] < 1)
            {
                SendClientMessage(playerid, COLOR_GREY, "  Niste ovlasteni da koristite tu komandu . ");
                return 1;
            }
            SendClientMessage(playerid, COLOR_GRAD1, "[ Igraci sa maskama ]:");
            foreach (Player, i)
            {
                if(PlayerInfo[i][pMaskuse] == 1)
                {
                    GetPlayerName(i, sendername, sizeof(sendername));
                    format(string, 256, "[ID: %d] %s", i, sendername);
                    SendClientMessage(playerid, COLOR_GRAD2, string);
                }
            }
        }
        return 1;
    }
Could somebody now make command that when I put mask my nick change to (ID)(Masked) and when I /maskoff to return to my normal nick? Also this for admins /masked would be great to make work with that system
Reply
#7

I dont really get it why people use "IsPlayerConnected",
Ofcourse they are? If they're not they woulnd't be able to use the commands anyway...
Or is it just me?
Reply
#8

Dude,you didnt help me with that
Reply
#9

Bump
Reply
#10

pawn Код:
foreach (Player, i)
            {
                ShowPlayerNameTagForPlayer(i, playerid, 0);
            }
Instead of the above do:
pawn Код:
new maskedstr[50];
format(maskedstr, sizeof(maskedstr), "(%d)(Masked)", playerid);
GetPlayerName(playerid, pname[playerid], sizeof(pname[playerid]));
SetPlayerName(playerid, maskedstr);
Remember to create a global variable (in the above example 'pname[MAX_PLAYERS]') in which you save the persons name, otherwise you wont be able to set it back.

For the maskoff:
pawn Код:
SetPlayerName(pname[playerid]);
Also, remember to unset the variable if OnPlayerDisconnect gets called, or else someone may get another persons name
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)