Make player invisible
#2

The first option just seems like a bad idea to me.

However, the second option seems to work fine most of the time. If you REALLY want to make a player invisible, the code below should work fine:

pawn Код:
new
    bool:g_Invisible[playerid] = false
;

CMD:toginvisibility(playerid, params[])
{
    new
        vehID = GetPlayerVehicleID(playerid)
    ;
   
    if(vehID == INVALID_VEHICLE_ID)
            return 1;

    if(!g_Invisible[playerid])
    {  
        g_Invisible[playerid] = true;
        LinkVehicleToInterior(vehID, playerid*5); // taking the player's ID and multiplying it by 5 means they will (generally) never be in the same VW as another player
        for(new i = 0; i < MAX_PLAYERS; i++) ShowPlayerNameTagForPlayer(i, playerid, 0); // normally I'd use foreach here, but whatever
    }
    else
    {
        g_Invisible[playerid] = false;
        LinkVehicleToInterior(vehID,  0);  
        for(new i = 0; i < MAX_PLAYERS; i++) ShowPlayerNameTagForPlayer(i, playerid, 1); // normally I'd use foreach here, but whatever
    }
    return 1;
}
Reply


Messages In This Thread
Make player invisible - by Morten_Guado - 25.03.2013, 04:21
Re: Make player invisible - by Scenario - 25.03.2013, 04:28
Re: Make player invisible - by Pottus - 25.03.2013, 04:44
Re: Make player invisible - by Morten_Guado - 25.03.2013, 04:51
Re: Make player invisible - by Scenario - 25.03.2013, 14:59
Re: Make player invisible - by RajatPawar - 25.03.2013, 15:03
Re: Make player invisible - by Morten_Guado - 25.03.2013, 15:11
Re: Make player invisible - by MyPony - 25.03.2013, 15:12
Re: Make player invisible - by Scenario - 25.03.2013, 15:28

Forum Jump:


Users browsing this thread: 2 Guest(s)