25.03.2013, 04:28
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:
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;
}