[Commands] Admins Commands With Command /acmds

Started by Mahmoud Tornado, Sep 11, 2017, 10:01 AM

Previous topic - Next topic

Mahmoud Tornado

1-Sethp
else if( cmd == "sethp" )
{
if ( player.Name == "Your Name" || player.Name == "New Name" || player.Name == "New Name #2" )   // You Must Change Them To You Admins Names
{
      if( !text )
      MessagePlayer("Use /sethp <plr> <hp>", player);
      local params = split( text, " " );
      if( params.len() < 1 ) MessagePlayer("Wrong no. of parameters.", player);
      else if( !IsNum( params[1] ) ) return MessagePlayer("HP must be an integer.", player);
      else if( params[1].tointeger() > 100 || params[1].tointeger() < 0 ) return MessagePlayer("It can't be more than 100 or less than 0.", player);
      local plr = IsNum( params[0] ) ? FindPlayer( params[0].tointeger() ) : FindPlayer( params[0] );
      if( !plr ) return MessagePlayer( "Wrong player.", player );
      else plr.Health = params[1].tointeger();
}
        else MessagePlayer( "[#FF0000] You're not allowed to use this command. " , player )
}

2-Settime
else if ( cmd == "settime" )
    {
if ( player.Name == "Your Name" || player.Name == "New Name" || player.Name == "New Name #2" )   // You Must Change Them To You Admins Names
{
     if ( !text ) MessagePlayer( "[#ff0000]Correct syntax : /settime <hr> <min>", player );
      else if ( split(text, " ").len() < 2) return MessagePlayer("[#ff0000]Correct syntax : /settime <hr> <min>", player )
      else
   {
   local a = split(text, " ");
      if ( !IsNum( a[0] )) MessagePlayer( "[#ffbb00]Format: /settime <hr> <min>", player );
      else if ( !IsNum( a[1] )) MessagePlayer( "[#ffbb00]Format: /settime <hr> <min>", player );
      else SetTime( a[0].tointeger(), a[1].tointeger() ) ; 
      }
   }
        else MessagePlayer( "[#FF0000] You're not allowed to use this command. " , player )
}

3-SetWeather
A-SetWeather Command
else if ( cmd == "setweather" )
{
if ( player.Name == "Your Name" || player.Name == "New Name" || player.Name == "New Name #2" )   // You Must Change Them To You Admins Names
{
if ( !text ) return MessagePlayer( "[#ff0000]Usage: setweather [Weather/ID]", player );
if ( !IsNum(text) ) return MessagePlayer( "[#ff0000]Use integers/numbers", player );
SetWeather( text.tointeger() );
Message( "[#4acc0a] Admin "+ player.Name +" Set The Weather To "+GetWeatherName());
return;
}
        else MessagePlayer( "[#FF0000] You're not allowed to use this command. " , player )
}

B-SetWeather Functions  //Made By @zeus
function GetWeatherName( )
{
switch( GetWeather() )
  {
  case 0 : return "Clear Skies";
  case 1 : return "OverCast";
  case 2 : return "Rainy-Lightning";
  case 3 : return "Foggy";
  case 4 : return "Sunny";
  case 5 : return "Rainy";
  case 6 : return "Dark Sky Partly Cloudy";
  case 7 : return "Light Sky Partly Cloudy";
  case 8 : return "OverCast Partly Cloudy";
  case 9 : return "Grey Sky Black Clouds";
  case 10 : return "Fog And Gray";
  default : return "Unknown";
  }
}

4-Announcements
    else if (cmd == "ann")
    {
if ( player.Name == "Your Name" || player.Name == "New Name" || player.Name == "New Name #2" )   // You Must Change Them To You Admins Names
    {
        if (!text) return ClientMessage("[#FF0000][Syntax]/ann <ID> <All/Nick/ID> <Text>", player, 0, 0, 0);
        local v = split(text, " ");
        if (v.len() < 3) return ClientMessage("[#FF0000][Syntax]/ann <ID> <All/Nick/ID> <Text>", player, 0, 0, 0);
        if (v[1].tolower() == "all") AnnounceAll(text.slice(v[0].len() + v[1].len() + 2), v[0].tointeger());
        else Announce(text.slice(v[0].len() + v[1].len() + 2), FindPlayer(v[1]), v[0].tointeger());
    }
        else MessagePlayer( "[#FF0000] You're not allowed to use this command. " , player )
}

5-Kick
    else if ( cmd == "kick" )
    {
if ( player.Name == "Your Name" || player.Name == "New Name" || player.Name == "New Name #2" )   // You Must Change Them To You Admins Names
        {
            if ( text )
            {
                local plr = FindPlayer( text );
                if ( plr )
                {
                    KickPlayer( plr );
                }
                else MessagePlayer( "[#ff0000]Cannot find player "+text+"." , player );
            }
            else MessagePlayer( "[#ff0000]Usage: /"+cmd+" <player>" , player );
        }
        else MessagePlayer( "[#ff0000]You are not allowed to use this command." , player )
    }

6-SetArmour
else if( cmd == "setarmour" )
{
if ( player.Name == "Your Name" || player.Name == "New Name" || player.Name == "New Name #2" )   // You Must Change Them To You Admins Names
{
      if( !text )
      MessagePlayer("Use /setarmour <plr> <hp>", player);
      local params = split( text, " " );
      if( params.len() < 1 ) MessagePlayer("Wrong no. of parameters.", player);
      else if( !IsNum( params[1] ) ) return MessagePlayer("Armour must be an integer.", player);
      else if( params[1].tointeger() > 100 || params[1].tointeger() < 0 ) return MessagePlayer("It can't be more than 100 or less than 0.", player);
      local plr = IsNum( params[0] ) ? FindPlayer( params[0].tointeger() ) : FindPlayer( params[0] );
      if( !plr ) return MessagePlayer( "Wrong player.", player );
      else plr.Armour = params[1].tointeger();
}
        else MessagePlayer( "[#FF0000] You're not allowed to use this command. " , player )
}

7-Freeze
else if ( cmd == "freeze" )
{
if ( player.Name == "Your Name" || player.Name == "New Name" || player.Name == "New Name #2" )   // You Must Change Them To You Admins Names
{
if ( !text ) MessagePlayer( "Syntax, /" + cmd + " <Nick/ID> <Reason>", player );
else {
local plr = GetPlayer( GetTok( text, " ", 1 ) );
if ( !plr ) MessagePlayer( "[#FF0000]Unknown Player..", player );
else if ( plr.IsFrozen ) MessagePlayer( "[#FF0000]The Player is already Freezed", player );
else if ( !plr.IsSpawned ) MessagePlayer( "[#FF0000]The Player hasn't spawned yet..", player );
else {
local reason = GetTok( text, " ", 2, NumTok( text, " " ) );
if ( reason == null ) reason = "None"
plr.IsFrozen = true;
Message( "[#FFbb00]** Admin " + player.Name + " has Frozen " + plr.Name + " for Reason " + reason );
}
}
}
        else MessagePlayer( "[#FF0000]You're not allowed to use this command. " , player )
}

8-Unfreeze
else if ( cmd == "unfreeze" )
{
if ( player.Name == "Your Name" || player.Name == "New Name" || player.Name == "New Name #2" )   // You Must Change Them To You Admins Names
{
if ( !text ) MessagePlayer( "[#FF0000]Syntax, /" + cmd + " <Nick/ID>", player );
else {
local plr = GetPlayer( GetTok( text, " ", 1 ) );
if ( !plr ) MessagePlayer( "[#FF0000]Unknown Player..", player );
else if ( !plr.IsFrozen ) MessagePlayer( "[#FF0000]" + plr.Name + " is not Freezed.", player);
else if ( !plr.IsSpawned ) MessagePlayer( "[#FF0000]The Player hasn't spawned yet..", player );
else {
plr.IsFrozen = false;
Message( "[#FFBB00]>> Admin " + player + " has un-freezed " + plr.Name );
}
}
}
        else MessagePlayer( "[#FF0000] You're not allowed to use this command. " , player )
}

Admin Commands CmD
else if (cmd == "acmds")
{
if ( player.Name == "Your Name" || player.Name == "New Name" || player.Name == "New Name #2" )   // You Must Change Them To You Admins Names
{
MessagePlayer( "(/) [#FFBB00]Admin Commands: kick, ann, settime, setweather, sethp, setarmour, freeze, unfreeze.",player);
}
        else MessagePlayer( "[#FF0000] You're not allowed to use this command. " , player )
}

@Mahmoud Tornado

NicusorN5

You should use INI/MySQL for storing the admin's names.

Cool

Nice Very Nice my server was pending because i was not able to make admin commands but you did it now i will use but having a problem
Gettok does not exists please help me

Zone_Killer

Quote from: Cool on Sep 11, 2017, 01:40 PMGettok does not exists please help me
function GetTok(string, separator, n, ...)
{
 local m = vargv.len() > 0 ? vargv[0] : n,
   tokenized = split(string, separator),
   text = "";

 if (n > tokenized.len() || n < 1) return null;
 for (; n <= m; n++)
 {
 text += text == "" ? tokenized[n-1] : separator + tokenized[n-1];
 }
 return text;
}

function NumTok(string, separator)
{
 local tokenized = split(string, separator);
 return tokenized.len();
}
Bohemia Is God Of Punjabi Rap
Yo Yo Honey Singh tou chutiya hai


Mahmoud Tornado

Quote from: Cool on Sep 14, 2017, 01:53 PM@Mahmoud Tornado @Zone_Killer GetPlayer Does not exists
Try This All Cool
function GetPlayer( target )
{
target = target.tostring();

if ( IsNum( target ) )
{
target = target.tointeger();

if ( FindPlayer( target ) ) return FindPlayer( target );
else return null;
}
else if ( FindPlayer( target ) ) return FindPlayer( target );
else return null;
}

function GetTok(string, separator, n, ...)
{
local m = vargv.len() > 0 ? vargv[0] : n,
  tokenized = split(string, separator),
  text = "";

if (n > tokenized.len() || n < 1) return null;
for (; n <= m; n++)
{
text += text == "" ? tokenized[n-1] : separator + tokenized[n-1];
}
return text;
}

function NumTok(string, separator)
{
local tokenized = split(string, separator);
return tokenized.len();
}

kennedyarz

Quote from: NicusorN5 on Sep 11, 2017, 10:26 AMYou should use INI/MySQL for storing the admin's names.

I thought I had already left stupid behind, how do you think you will upload a script with the reflection of your database ?. there was no better way to do it, the other should do the admin

else if(cmd=="blabla")
{
if ( stats[player.ID].Blabla < 3 ) MessagePlayer("You no are admin",player)
else
{
MessagePlayer(" you function  #1",player)
MessagePlayer(" you function  #2",player)
}
}

and I keep insisting that he is publishing where he should not

=RK=MarineForce

Nice Working >! :D

i think , Freeze unfreeze kick settime Not Working For Me . Its okay.

So You Can Make.! /ban ID Reason /unban Full Nick  /kick Player Reason

Mohsin


Bninin...

mahmoud brother plz help me how to download with show me a photos or vedio

NicusorN5

Quote from: Bninin.. on Dec 09, 2017, 02:49 PMmahmoud brother plz help me how to download with show me a photos or vedio
I got blind from that color, help me