i got a little question
#1

They say that the ''42'' make player 42 invinsible for player ''1'' on map with own colour.
pawn Код:
//pinvis
    if(strcmp(cmdtext, "/pinvis", true) == 0)
    {
        if(pInvisOn == 0)
            {
            SetPlayerMarkerForPlayer(42, 1, (GetPlayerColor(1) & 0xFFFFFF00));
            for(new i = 0; i < MAX_PLAYERS; i++) ShowPlayerNameTagForPlayer(playerid, i, false);
            SendClientMessage(playerid, COLOR_YELLOW, "You have dissapeared from the radar and your nametag has been removed.");
            pInvisOn = 1;
       
        }
        else
        {
            SetPlayerMarkerForPlayer(42, 1, (GetPlayerColor(1)));
            for(new i = 0; i < MAX_PLAYERS; i++) ShowPlayerNameTagForPlayer(playerid, i, true);
            SendClientMessage(playerid, COLOR_YELLOW, "Your blip is now back on the radar and your name tag has appeared back.");
            pInvisOn = 0;
        }
        return 1;
    }
I just want to make a player, when using /pinvis invinsible on map and nametag disappear but keep their own colour. But the samp wiki says otherwise... I don't know if I did right or wrong.

1 thing, i wanted to make this if you type /pinvis your nametag and radarblip will disappear, and when you type it again they will appear again but I really get too much errors so i just ask help then. you can see above what i did but i really think that's not the way
Reply
#2

ZCMD + foreach.
pawn Код:
COMMAND:pinvisible(playerid, params[])
{
    if ( GetPVarInt ( playerid, "invisibleToggle" ) == 0 ) //Checks if they are currently invisible.
    {
        foreach(Player, i ) // Does a loop.
        {
            SetPlayerMarkerForPlayer    ( i, playerid, 0xFFFFFF00 ) ; //Sets the player's marker white / transparent.
            ShowPlayerNameTagForPlayer  ( i, playerid, 0 ); // Hides the nametags.
            SendClientMessage           ( playerid, 0xFFFFFFAA, "You're a ninja."); //Tell them they are invisible.
            SetPVarInt                  ( playerid, "invisibleToggle" , 1 ); //Set a variable so it would check on the command.
        }
        return 1;
    }
    else
    {
        foreach(Player , i )
        {
            SetPlayerMarkerForPlayer    ( i, playerid, 0xFF7700AA ) ; //Sets the player's marker to orange.
            ShowPlayerNameTagForPlayer  ( i, playerid, 0 ); // Show the nametags to players.
            SendClientMessage           ( playerid, 0xFFFFFFAA, "You have lost your ninja ability"); //Tell them they are not invisible.
            SetPVarInt                  ( playerid, "invisibleToggle" , 0 ); //Set a variable so it would check on the command.
        }
        return 1;
    }
}

NOT TESTED.
Reply
#3

omg... i asked if my command above was correct? not for a zcmd which i don't even use.
Reply
#4

I should say sorry but its totally wrong.
Reply
#5

I tested this command (my cmd /pinvis). When i type /pinvis, someone elses nametag disappears, his radar blip just stays (wrong). My nametag and radar blip should disappear. But can anyone see what's wrong in my cmd?

i also don't get a shit of this:
pawn Код:
SetPlayerMarkerForPlayer( 42, 1, ( GetPlayerColor( 1 ) & 0xFFFFFF00 ) );
Why player 42 and why 1? I want my radar blip to disappear for everyone
Reply
#6

Therefore you use a loop.

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


Read the parameters carefully.
Reply
#7

Quote:
Originally Posted by Retardedwolf
Посмотреть сообщение
Therefore you use a loop.

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


Read the parameters carefully.
Do you think I haven't visit that page? How else do you think I got this? The only thing I want to know is; How can I make it hide MY blip and nametag and not someone elses? I don't understand shit of those parameters, serious... i would be happy if you explain
Reply
#8

Okay, I'll make it easier for you and guide you through the function.

SetPlayerMarkerForPlayer ( playerid, showplayerid, color )
Код:
playerid	The player whose view you want to change
showplayerid	The player whose color will be changed
color	New color. Set the alpha part to 00 for an invisible blip. This works because 00 will set the transparency to nothing, which is invisible.
"playerid" in SPMFP means whose view to change. ( A player that will see the another player as a colour or invisible. )
"showplayerid" in SPMFP means whose colour would be changed. ( A player that will became invisible in simple words. )
"color" in SPMFP means the colour you want to change the player into.

Okay to make it show for everyone that showplayerid is invisible you make a loop.

pawn Код:
foreach(Player, i)
OR
pawn Код:
for( new i = 0; i < MAX_PLAYERS; i++)
i would be the loop's player id.

So you want everyone to see a player invisible you put 'i' in the first playerid slot. You put 'i' because it is the playerid the loop is providing you with.ShowPlayerMarkerForPlayer ( i, ....).


After making that you must put something in for the showplayerid slot. The person who made the command would be 'playerid' so we input 'playerid' into the showplayerid box to make him invisible. ShowPlayerMarkerForPlayer ( i, playerid, ....).

After that you must choose a colour. White + low opacity makes it go transparreent. O'yay. So we input '0xFFFFFFAA' into the last slot. ShowPlayerMarkerForPlayer ( i, playerid, 0xFFFFFFAA );.


I hope you actually learnt something. If you think I'm a huge dick head you can just choose to ignore my posts. I do understand my explanation is not good at all.
Reply
#9

Okay, i'm sorry and thank you! But here is what i have so far:
pawn Код:
//pinvis
    if(strcmp(cmdtext, "/pinvis", true) == 0)
    {
        if(pInvisOn == 0)
            {
            for( new i = 0; i < MAX_PLAYERS; i++) SetPlayerMarkerForPlayer(i, playerid, 0xFFFFFF00);
            for(new i = 0; i < MAX_PLAYERS; i++) ShowPlayerNameTagForPlayer(i, playerid, false);
            SendClientMessage(playerid, COLOR_YELLOW, "You have dissapeared from the radar and your nametag has been removed.");
            pInvisOn = 1;
       
        }
        else
        {
            for( new i = 0; i < MAX_PLAYERS; i++) SetPlayerMarkerForPlayer(i, playerid, (GetPlayerColor(1)));
            for(new i = 0; i < MAX_PLAYERS; i++) ShowPlayerNameTagForPlayer(i, playerid, true);
            SendClientMessage(playerid, COLOR_YELLOW, "Your blip is now back on the radar and your name tag has appeared back.");
            pInvisOn = 0;
        }
        return 1;
    }
When I type /pinvis to hide and again /pinvis to unhide, it changed my colour to black or another colour that's not right. Chatcolour
Reply
#10

Yes, I realised that too. You could convert the hexadecimal colour to decimal notation then store it into a variable.
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)