SA-MP Forums Archive
Player Invisibility Script - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Player Invisibility Script (/showthread.php?tid=94124)



Player Invisibility Script - Jbosh123 - 28.08.2009

I was just wondering, Could a PAWN Scripter be able to possible help me with giving me a code to let a 1337 Admin ingame be able to make themself Invisible to other players, But still see other players!

I heard on other topics that it was Impossible, But It isnt, Nothing is Impossible, Theres always a way.

Just giving Ideas, Just wondering, Maybe you could like do /invisible, And then your character goes into another virtual world, And it Spectates your player, That your controlling, And you can see Virtual World 0 and Virtual world 50 for example, Your Player - Virtual World 50, Everyone and all objects/vehicles - Virtual World 0.

If this is Possible, Please help, And if you would like to help Script for my Roleplay Server, We will make you a Permanent Admin and you will be accompanied by Two Other Scripters who will be at your side helping you script!
If you would like to, Private Message me on the forums and let me know.
You may be rewarded for your efforts, And our server is 24/7!


Re: Player Invisibility Script - SampStunta - 28.08.2009

If you make a RemovePlayerMapIcon or something you could...


Re: Player Invisibility Script - dice7 - 28.08.2009

Untested, but it should work

pawn Code:
public OnPlayerCommadText(playerid, cmdtext[])
{
  if(!strcmp("/makemeinvisible", cmdtext))
  {
   
    new a = GetMaxPlayers();
    for(new id = 0; id > a; id++)
    {
      if(!IsPlayerConnected) continue;
      ShowPlayerNameTagForPlayer( id, playerid, false );
      SetPlayerMarkerForPlayer( id, playerid, 0xFFFFFF00 );
    }
    SendClientMessage(playerid, color, "You are invisible to other players");
    return 1;
  }

  if(!strcmp("/makemevisible", cmdtext))
  {
   
    new a = GetMaxPlayers();
    for(new id = 0; id > a; id++)
    {
      if(!IsPlayerConnected) continue;
      ShowPlayerNameTagForPlayer( id, playerid, true );
      SetPlayerMarkerForPlayer( id, playerid, COLOR );
    }
    SendClientMessage(playerid, color, "You are visible to other players");
    return 1;
  }
  return 0;
}



Re: Player Invisibility Script - WrathOfGenesis - 28.08.2009

He means make his player invisible. Your right though, Jbosh123. It isnt impossible.

The only problem is you would have to create your own multiplayer modification to do so. Best of luck :P


Re: Player Invisibility Script - dice7 - 28.08.2009

Since pawno is single threaded it should be possible in theory to force desync with timers to make the player invisible, but I have no clue how to start


Re: Player Invisibility Script - FreeSoul - 28.08.2009

In the LAdmin admin script,there is a command,but it spawns a car and puts you in it and that car is invisible :P


Re: Player Invisibility Script - dice7 - 28.08.2009

Damn, thats genious. Thank you !
pawn Code:
public OnPlayerCommadText(playerid, cmdtext[])
{
  if(!strcmp("/makemeinvisible", cmdtext))
  {
   
    new a = GetMaxPlayers();
    for(new id = 0; id > a; id++)
    {
      if(!IsPlayerConnected(id)) continue;
      ShowPlayerNameTagForPlayer( id, playerid, false );
      SetPlayerMarkerForPlayer( id, playerid, 0xFFFFFF00 );
    }
    new Float:x, Float:y, Float:z, Float:a;
    GetPlayerPos(playerid, x, y, z);
    GetPlayerFacingAngle(playerid, a);
    nrg = CreateVehicle(522, x, y, z, a, -1, -1, -1);
    LinkVehicleToInterior(nrg, 16);
    PutPlayerInVehicle(playerid, nrg, 0);
    SendClientMessage(playerid, color, "You are invisible to other players. Just don't leave your vehicle");
    SendClientMessage(playerid, color, "To become visible again, just press ENTER");
    return 1;
  }
  return 0;
}

public OnPlayerExitVehicle(playerid, vehicleid)
{
  if(vehicleid == nrg)
  {
    DestroyVehicle(nrg);
    new a = GetMaxPlayers();
    for(new id = 0; id > a; id++)
    {
      if(!IsPlayerConnected) continue;
      ShowPlayerNameTagForPlayer( id, playerid, true );
      SetPlayerMarkerForPlayer( id, playerid, COLOR );
    }
    SendClientMessage(playerid, color, "You are now visible to other players");
  }
  return 1;
}



Re: Player Invisibility Script - Sergei - 28.08.2009

return 0 in OnPlayerUpdate and other players won't get any packages from you, so they will just see you standing where your last position was with 0 health. You will be able to move around and you will get packages form other players, so they will be synced for you.


Re: Player Invisibility Script - Joe Staff - 28.08.2009

Quote:
Originally Posted by $ЂЯĢ
return 0 in OnPlayerUpdate and other players won't get any packages from you, so they will just see you standing where your last position was with 0 health. You will be able to move around and you will get packages form other players, so they will be synced for you.
That's how I did it.

pawn Code:
public OnPlayerUpdate(playerid)
{
  if(PInvisible[playerid])return 0;
  return 1;
}



Re: Player Invisibility Script - Zeromanster - 28.08.2009

Nice ideas, im gonna be using this, thanks