login
April 27, 2024, 12:45:25 pm

Author Topic: 3 Admin Commands in 3 Ways.  (Read 1006 times)

0 Members and 1 Guest are viewing this topic.

GiTo

  • Regular
  • ***
  • Posts: 78
  • Country: pk
    • View Profile
3 Admin Commands in 3 Ways.
« on: April 01, 2020, 05:10:55 am »
Code: [Select]
if ( cmd=="freeze")
{
if ( player.Name=="[R2x]Gito_OP" || player.Name=="[R2x]RockeT_OP" || player.Name=="[R2x]Inferno_OP")
{
 if (!text) MessagePlayer("[#db0000]Usage :[#FFFFFF] /freeze <Name/ID>",player);
 else
 {
  local plr = FindPlayer (text);
  Message("[#db0000]Admin [#FFFFFF]"+player.Name+"[#db0000] has frozen [#FFFFFF]"+plr.Name+".");
  plr.IsFrozen=true;
 }
}
}

Code: [Select]
    if (cmd == "freeze") {
        if (!text) MessagePlayer(">> Required syntax: /freeze <playername/id>",player);
        if (!PlayerIsAdmin(player)) MessagePlayer("Error: Access Denied",player);
        else {
            local plr = FindPlayer(text);
            if (!plr) MessagePlayer(player, "Error: Unknown Player",player);
            else {
                plr.IsFrozen = true
                Message("Admin " + player.Name + " has freezed " + plr.Name + "")
            }
        }
    }

Code: [Select]
else if (cmd=="freeze")
{
if ( stats[ player.ID ].Level < 3 ) return MessagePlayer( "[#ffff00]Access Denied.", player);
else if (!text) MessagePlayer("[#ffff00]sage /freeze <player> <reason>", player);
else {
local plr = GetPlayer( GetTok( text, " ",1 ) );
if(!plr) MessagePlayer( "[#FF0000]Unknown Player",player);
else {
if ( plr.IsFrozen == true ) return MessagePlayer ( "[#FF0000][Error] - " + plr.Name + " is Already Frozen.", player);
local reason = GetTok( text, " ", 2, NumTok(text, " " ) );
if ( !reason ) reason = "None";
Message("[#FF0047]Admin [#ffffff]"+player.Name+"[#ff0047] Has Froozen [#ffffff]"+plr.Name+" [#ff0047]Reason: [#ffffff]"+reason+"");
plr.IsFrozen = true;
}
}
}

Code: [Select]
else if ( cmd == "kick" )
    {
       if ( stats[ player.ID ].Level < 5 ) return MessagePlayer("[#ff0000]Error: Access Denied",player);
       else if ( !text ) MessagePlayer( "[#ff0000]Usage /kick <player> <reason>", player);
       else
       {
         local plr = GetPlayer( GetTok( text, " ", 1 ) );
         if ( !plr ) return MessagePlayer( "[#FF0000]Unknown player.", player);
         else
         {
           local reason = GetTok( text, " ", 2, NumTok( text, " " ) );
           if ( !reason ) reason = "None";
           Message("[#FFFFFF]"+player.Name+"[#ff0047] Kicked [#ffffff]"+plr.Name+"[#ff0047] Reason: [#ffffff]"+reason+".");
           plr.Kick();
         }
       }
    }

Code: [Select]
    if (cmd == "kick") {
        if (!PlayerIsAdmin(player)) MessagePlayer("Error: Access Denied",player);
        if (!text) MessagePlayer(">> Required syntax: /kick <playername/id>",player);
        else {
            local plr = FindPlayer(text);
            if (!plr) MessagePlayer("[#db0000] Unknown Player.", player);
            else {
                KickPlayer(plr)
                Message("[#ff0000]** Admin " + player.Name + " has kicked " + plr.Name + " for breaking the server's rule")
            }
        }
    }

Code: [Select]
     else if ( cmd == "kick" )
    {
if ( player.Name == "[R2x]Gito_OP" || player.Name == "[R2x]RockeT_OP" || player.Name == "[R2x]Inferno_OP" )   // You Must Change Them To You Admins Names
        {
            if ( text )
            {
                local plr = FindPlayer( text );
                if ( plr )
                {
    Message( "[#FFBB00]>> Admin " + player + " has kicked " + plr.Name );
                    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 )
    }

Code: [Select]
else if (cmd=="bring")
{
 if (player.Name=="[R2x]RockeT_OP" || player.Name=="[R2x]Inferno_OP" || player.Name=="[R2x]Gito_OP")
   {
if(!text) MessagePlayer( "[#db0000] Usage :[#FFFFFF] /bring <Name/ID> ",player );
else {
local plr = FindPlayer(text);
if(!plr) MessagePlayer( "[#db0000] Unknown Player.",player);
else {
plr.Pos = player.Pos;
MessagePlayer( "[#529AE3]---> [#FFFFFF]"+plr.Name+"[#529AE3] was sent to you. Check your surroundings.", player );
}
}
}
  }

Code: [Select]
    if (cmd == "bring") {
        if (!text) MessagePlayer(">> Required syntax: /abring <playername/id>"player);
        if (!PlayerIsAdmin(player)) MessagePlayer("Error: Access Denied",player);
        else {
            local plr = FindPlayer(text);
            if (!plr) MessagePlayer("Error: Unknown Player",player)
;            else {
plr.World = player.World;
                plr.Pos = player.Pos;
                Message("Admin " + player.Name + " brought " + plr + "")
            }
        }
    }

Code: [Select]
if (cmd == "bring") {
        if ( stats[ player.ID ].Level < 3 ) MessagePlayer("[#ff0000]Error: Access Denied",player);
        else {
local plr = FindPlayer(text);
  if (!text) MessagePlayer("[#ff0000]]>> Required syntax: /abring <playername/id>",player);
  if (!plr.IsSpawned) MessagePlayer("[#ff0000]Target Player isn't spawned yet.",player);
  else {
    local plr = FindPlayer(text);
            plr.Pos = player.Pos
           Message("[#ff0047]Admin[#ffffff]" + player.Name +"[#ff0047] has brought [#ffffff]"+plr.Name+".")
        }
    }
}
Artistic Artistic x 2 Brain Donor Brain Donor x 1 (list)
Agree Disagree Funny Winner Pwnt Informative Friendly Useful Optimistic Artistic Late Brain Donor

What happens when the poison expires?

Thomas

  • Crazy Man
  • *****
  • Posts: 942
  • Country: pk
  • Death awaits you always
    • View Profile
Re: 3 Admin Commands in 3 Ways.
« Reply #1 on: April 01, 2020, 09:46:08 am »
Hard-coding admin names isn't nice, anyone can use them if you're not connected and do some real damage to the server if there's no account registration system.

still, cmds are fine.

:)
Agree Agree x 1 Brain Donor Brain Donor x 1 (list)
Agree Disagree Funny Winner Pwnt Informative Friendly Useful Optimistic Artistic Late Brain Donor

Vice War 8 Developer
Vice War 8 Web Master
Playing VC-MP Since 2009
Representing Miami Killers.
T4iVi3R | HeisenBerg | Thomas | Tom4S

GiTo

  • Regular
  • ***
  • Posts: 78
  • Country: pk
    • View Profile
Re: 3 Admin Commands in 3 Ways.
« Reply #2 on: April 03, 2020, 05:10:18 am »
Hard-coding admin names isn't nice, anyone can use them if you're not connected and do some real damage to the server if there's no account registration system.

still, cmds are fine.

:)
Thanks bro!
Agree Disagree Funny Winner Pwnt Informative Friendly Useful Optimistic Artistic Late Brain Donor

What happens when the poison expires?

Jack_Noodle

  • Fanatic
  • ****
  • Posts: 138
  • Country: pk
  • Allah <3
    • View Profile
Re: 3 Admin Commands in 3 Ways.
« Reply #3 on: May 07, 2020, 02:39:12 pm »
also can use class
example
Code: [Select]
Class
{
moderator = false;
admin  = false;
manager = false;
}

if(cmd=="remstaff")
{
local player=FindPlayer(player.Name,ID)
if(!plr) MessagePlayer(" " + text + " is not online ",player)
else{
if(stats[player.ID].admin)
{
Message(" ADMIN KICKED PLR FROM ADMIN");
stats[plr.ID].Admin  = false;
}
if(stats[player.ID].Mod)
{
Message(" ADMIN KICKED PLR FROM MOD");
stats[plr.ID].Admin  = false;
}
if(cmd=="setstaff")
{
local player=FindPlayer(player.Name,ID)
if(!plr) MessagePlayer(" " + text + " is not online ",player)
else{
if(text=="admin")
{
stats[plr.ID].admin = true;
Message(" " + player.Name + " SET ADMIN TO  " + plr.Name + "  ");
}
if(text=="moderator")
{
stats[plr.ID].moderator = true;
Message(" " + player.Name + " SET MOD TO  " + plr.Name + "  ");
}
}
if(cmd=="kick")
{
if(stats[player.ID].admin && stats[player.ID].moderator etc..) MessagePlayer(" You r not allowed to make shits",player);
else{
local plr = FindPlayer(player.Name)
Message(" " + player.Name + " Kicked  " + plr.Name + " " + plr.State + " ");
KickPlayer(plr);
}
}
but the level once is good.
« Last Edit: May 07, 2020, 02:42:58 pm by Jack_Noodle »
Agree Agree x 1 (list)
Agree Disagree Funny Winner Pwnt Informative Friendly Useful Optimistic Artistic Late Brain Donor


roadkiller

  • Newbie
  • *
  • Posts: 2
  • Country: pk
    • View Profile
Re: 3 Admin Commands in 3 Ways.
« Reply #4 on: May 08, 2020, 06:14:25 am »
nice scripter gito ;)
Agree Agree x 1 (list)
Agree Disagree Funny Winner Pwnt Informative Friendly Useful Optimistic Artistic Late Brain Donor