Hola tengo un problema, es que este coamndo solo lo pueden usar los admin nivel 5 y yo quiero que lo puedan usar los de nivel 1, 2, 3, 4, y 5 tambien. Este es el comando:
- Código:
COMMAND:spec(playerid, params[])
{
new id;// This will hold the ID of the player you are going to be spectating.
if(PlayerInfo[playerid][AdminLevel] >= 5)return 0;// This checks if the player is logged into RCON, if not it will return 0; (Showing "SERVER: Unknown Command") You can replace it with your own admin check.
if(sscanf(params,"u", id))return SendClientMessage(playerid, -1, "/spec [id]");// Now this is where we use sscanf to check if the params were filled, if not we'll ask you to fill them
if(id == playerid)return SendClientMessage(playerid,-1,"{FF3300}Servidor:{FFFFFF} No te puedes spectear a ti miesmo.");// Just making sure.
if(id == INVALID_PLAYER_ID)return SendClientMessage(playerid, -1, "bla bla");// This is to ensure that you don't fill the param with an invalid player id.
if(IsSpecing[playerid] == 1)return SendClientMessage(playerid,-1,"bla bla");// This will make you not automatically spec someone else by mistake.
GetPlayerPos(playerid,SpecX[playerid],SpecY[playerid],SpecZ[playerid]);// This is getting and saving the player's position in a variable so they'll respawn at the same place they typed '/spec'
Inter[playerid] = GetPlayerInterior(playerid);// Getting and saving the interior.
vWorld[playerid] = GetPlayerVirtualWorld(playerid);//Getting and saving the virtual world.
TogglePlayerSpectating(playerid, true);// Now before we use any of the 3 functions listed above, we need to use this one. It turns the spectating mode on.
if(IsPlayerInAnyVehicle(id))//Checking if the player is in a vehicle.
{
if(GetPlayerInterior(id) > 0)//If the player's interior is more than 0 (the default) then.....
{
SetPlayerInterior(playerid,GetPlayerInterior(id));//.....set the spectator's interior to that of the player being spectated.
}
if(GetPlayerVirtualWorld(id) > 0)//If the player's virtual world is more than 0 (the default) then.....
{
SetPlayerVirtualWorld(playerid,GetPlayerVirtualWorld(id));//.....set the spectator's virtual world to that of the player being spectated.
}
PlayerSpectateVehicle(playerid,GetPlayerVehicleID(id));// Now remember we checked if the player is in a vehicle, well if they're in a vehicle then we'll spec the vehicle.
}
else// If they're not in a vehicle, then we'll spec the player.
{
if(GetPlayerInterior(id) > 0)
{
SetPlayerInterior(playerid,GetPlayerInterior(id));
}
if(GetPlayerVirtualWorld(id) > 0)
{
SetPlayerVirtualWorld(playerid,GetPlayerVirtualWorld(id));
}
PlayerSpectatePlayer(playerid,id);// Letting the spectator spec the person and not a vehicle.
}
GetPlayerName(id, Name, sizeof(Name));//Getting the name of the player being spectated.
format(String, sizeof(String),"bla bla",Name);// Formatting a string to send to the spectator.
SendClientMessage(playerid,0x0080C0FF,String);//Sending the formatted message to the spectator.
IsSpecing[playerid] = 1;// Just saying that the spectator has begun to spectate someone.
IsBeingSpeced[id] = 1;// Just saying that a player is being spectated (You'll see where this comes in)
spectatorid[playerid] = id;// Saving the spectator's id into this variable.
return 1;// Returning 1 - saying that the command has been sent.
}