/vanish help
#1

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(playeridposxposyposzangle);
public 
OnVanish(playeridposxposyposzangle) {
    
SetPlayerVirtualWorld(playerid0);
    
SetPlayerPos(playeridposxposyposz);
    
SetPlayerFacingAngle(playeridangle);
    return 
1;
}
CMD:vanish(playeridparams[]) {
    if(
PlayerInfo[playerid][pAdmin] < 4) return 0;
    if(
Invisible[playerid] == 0) {
        new 
Float:pPosXFloat:pPosYFloat:pPosZFloat:Angle;
        
GetPlayerPos(playeridpPosXpPosYpPosZ);
        
GetPlayerFacingAngle(playeridAngle);
        
SetPlayerVirtualWorld(playerid3);
        
Invisible[playerid] = 1;
        
SetTimerEx("OnVanish"100false"iffff"playeridpPosXpPosYpPosZAngle);
        
SendMessage(playerid">> You are now invisible!");
    } else {
        new 
Float:pPosXFloat:pPosYFloat:pPosZ;
        
GetPlayerPos(playeridpPosXpPosYpPosZ);
        
SetPlayerPos(playeridpPosXpPosYpPosZ 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
Reply
#2

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.
Reply
#3

would the player change interior along with the vehicle?
Reply
#4

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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)