02.12.2013, 11:14
Can someone make something which turns you completely invisible by pressins lctrl?
if its not too much to ask
if its not too much to ask
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;
}