/vanish help -
jamjamnewbie - 01.11.2014
Hi, I've been trying to make a command which is to become invisible to other players while the caster can see all the players
PHP код:
public OnPlayerUpdate(playerid)
{
if(Invisible[playerid] == 1) return 0;
return 1;
}
forward OnVanish(playerid, posx, posy, posz, angle);
public OnVanish(playerid, posx, posy, posz, angle) {
SetPlayerVirtualWorld(playerid, 0);
SetPlayerPos(playerid, posx, posy, posz);
SetPlayerFacingAngle(playerid, angle);
return 1;
}
CMD:vanish(playerid, params[]) {
if(PlayerInfo[playerid][pAdmin] < 4) return 0;
if(Invisible[playerid] == 0) {
new Float:pPosX, Float:pPosY, Float:pPosZ, Float:Angle;
GetPlayerPos(playerid, pPosX, pPosY, pPosZ);
GetPlayerFacingAngle(playerid, Angle);
SetPlayerVirtualWorld(playerid, 3);
Invisible[playerid] = 1;
SetTimerEx("OnVanish", 100, false, "iffff", playerid, pPosX, pPosY, pPosZ, Angle);
SendMessage(playerid, ">> You are now invisible!");
} else {
new Float:pPosX, Float:pPosY, Float:pPosZ;
GetPlayerPos(playerid, pPosX, pPosY, pPosZ);
SetPlayerPos(playerid, pPosX, pPosY, pPosZ + 5);
Invisible[playerid] = 0;
SendMessage(playerid, ">> You are now visible to other players!");
}
return 1;
}
problem is, after i've typed it, my screen says 'stay within the world boundaries', and starts to fuck up my screen by CONSTANTLY BRIGHTEN it, and it became laggy
Re: /vanish help -
DanishHaq - 01.11.2014
It's not possible to do this. You can't make X invisible to Y but X would be able to see Y, you just can't

. The closest you can get is to using
https://sampwiki.blast.hk/wiki/ShowPlayerNameTagForPlayer and a loop.
Edit: You could place the person in a vehicle, disable their name tag and change the vehicle's interior to a different interior, so the vehicle is invisible with the player inside it, and if the player has his name off therefore he's effectively invisible to other players, but he would be able to see other players normally. That's another method.
Re: /vanish help -
jamjamnewbie - 02.11.2014
would the player change interior along with the vehicle?
Re: /vanish help -
Abagail - 02.11.2014
They won't technically, but they'll be invisible as the vehicle is.
Quick example.
pawn Код:
CMD:v(playerid, params[])
{
// make sure you turn off their name tag.
VanishVehicle[playerid] = CreateVehicle(596, pos[0], pos[1], pos[2], 0.0, 0, 0, -1);
LinkVehicleToVirtualWorld(VanishVehicle[playerid], 250);
PutPlayerInVehicle(playerid, VanishVehicle[playerid], 0);
Invisible[playerid] = true;
return 1;
}
Note that the vehicle can still be collided with by players within the normal virtual world.