SA-MP Forums Archive
Invisibility - 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)
+--- Thread: Invisibility (/showthread.php?tid=479009)



Invisibility - ReApZ - 02.12.2013

Can someone make something which turns you completely invisible by pressins lctrl?
if its not too much to ask


Re: Invisibility - Sublime - 02.12.2013

Set your own health to 65535% using SetPlayerHealth in a command


Re: Invisibility - ReApZ - 02.12.2013

didnt work i can still see myself


Re: Invisibility - Stinged - 02.12.2013

You can't make someone not visible to other players (Not talking about private worlds)


Re: Invisibility - Hansrutger - 02.12.2013

Cannot fully remember, but you have to set yourself in a car and then make the car invisible. Only way (I think) but can't remember how to do it.


Re: Invisibility - Threshold - 02.12.2013

With the assumption that you're using ZCMD, I have created this short script for you.

pawn Код:
new Invisibility[MAX_PLAYERS]; //Place this at the top of your script, under your includes.

public OnPlayerConnect(playerid) //When a player connects...
{
    Invisibility[playerid] = -1; //Just to make sure the command doesn't bug at any part.
    for(new i = 0; i < MAX_PLAYERS; i++) //Create a lopp through all players, foreach is a better option here.
    {
        if(Invisibility[i] == -1) continue; //If the player is not invisible, continue with the loop.
        SetPlayerMarkerForPlayer(playerid, i, 0xFFFFFF00); //Prevents anyone from joining the server while you're invisible, and being able to see you.
        ShowPlayerNameTagForPlayer(playerid, i, 0); //Hide the player's name tag.
    }
    return 1;
}

CMD:invisible(playerid, params[]) //The command to turn invisible is /invisible. You also use it to become visible again.
{
    if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, 0xFF0000FF, "You must be an admin to use this command."); //You can change this with your own admin variables, or remove it if you wish.
    if(GetPlayerState(playerid) != PLAYER_STATE_ONFOOT) return SendClientMessage(playerid, 0xFF0000FF, "You must be on-foot to use this command."); //The player must not be in any vehicle to prevent any bugs from occurring.
    if(Invisibility[playerid] == -1) //If the player is not invisible
    {
        new Float:x, Float:y, Float:z, Float:a; //Get the player's position and angle facing.
        Invisibility[playerid] = CreateVehicle(509, x, y, z, a, 0, 0, -1); //Create a 'BMX' at the player's position, and facing the same angle.
        PutPlayerInVehicle(playerid, Invisibility[playerid], 0); //Put the player inside the BMX.
        LinkVehicleToInterior(Invisibility[playerid], (GetPlayerInterior(playerid) + 1)); //Link the BMX to another interior, so the bike cannot be seen, and appears to be invisible.
        for(new i = 0; i < MAX_PLAYERS; i++) //Create a loop through all players, foreach is a better option here.
        {
            SetPlayerMarkerForPlayer(i, playerid, 0xFFFFFF00); //This will turn the player's color to 'white' on the TAB player's list, but their marker will become invisible on the map because of the '00' alpha values. (Fully transparent)
            ShowPlayerNameTagForPlayer(i, playerid, 0); //Hide the player's name tag.
        }
        SendClientMessage(playerid, 0xFFFF00FF, "You are now invisible until you leave the car.");
    }
    else if(Invisibility[playerid] != -1)
    {
        DestroyVehicle(Invisibility[playerid]);
        Invisibility[playerid] = -1;
        for(new i = 0; i < MAX_PLAYERS; i++)
        {
            SetPlayerMarkerForPlayer(i, playerid, 0xFFFFFFFF); //This will make the player's color white, but will show on their marker on the map. Change this to whatever color you wish.
            ShowPlayerNameTagForPlayer(i, playerid, 1); //Show the player's name tag.
        }
        SendClientMessage(playerid, 0xFFFF00FF, "You are no longer invisible, players can see you normally again.");
    }
    return 1;
}
No, I did not copy this from anywhere, I made it just then if you're wondering...


Re: Invisibility - ReApZ - 02.12.2013

thx +rep when i can