Page 1 of 3 123 LastLast
Results 1 to 10 of 23

Thread: Basic TEMPLATE for using rcon to issue command on players

  1. #1
    Purple Developer Purple Elephant1au's Avatar
    Join Date
    Feb 2012
    Location
    Australia
    Posts
    1,269

    Default Basic TEMPLATE for using rcon to issue command on players

    Hey guys

    I have decided to post up a simple script that people can use which acts as a template for those wishing to create their own punishment type or rcon based commands onto players.

    Examples such as:
    • Kill the player
    • Random change players name
    • Reset score


    Basically the script below is blank atm and does not do anything, it is up to you to fill in the blanks to suit your needs.
    ////// TEMPLATE FOR RCON COMMAND ON PLAYER
    // USAGE:
    // rcon CVAR <clientnum>
    // This is for single commands on players ONLY, no values to be passed EXCEPT playerID

    main:

    if(level.customcommand1) /// Change number as you go
    end

    level.customcommand1 = 1 /// Again change number to same as above

    local.cvar = "test" /// << THIS IS WHERE YOU CHANGE IT TO YOUR GIVEN CVAR YOU WISH TO USE

    ///////////////////////////////////////////////////////////////////////////////////
    while(1)
    {
    setcvar local.cvar ""

    while(getcvar local.cvar == "")
    wait 1

    local.num = getcvar local.cvar

    local.player = waitthread convert local.num

    if(local.player != 0 && local.player != NULL && local.player != NIL)
    {
    thread command local.player
    }
    else
    {
    println("--Error - No such player --- ")
    }
    }
    end

    convert local.num:
    for(level.who = 1;level.who <= $player.size;level.who++)
    {
    if($player[level.who].entnum == int(local.num))
    {
    end $player[level.who]
    }
    }
    level.who = -1 //no such client
    end 0
    //////////////////////////////^^^^^ DO NOT CHANGE ^^^^^//////////////////////////////////////////////

    command local.player:

    ///////////// THIS IS WHERE YOU ADD THE CODE THAT YOU WISH TO USE ON THE PLAYER
    ///////////// PLAYER IS local.player

    end

    Purple's Playground
    OBJ :
    103.29.85.127:12203
    xfire: purpleelephant1au
    email: purpleelephant1au@gmail.com
    skydrive: PurpleElephantSkydrive




  2. #2
    Developer RyBack's Avatar
    Join Date
    Apr 2014
    Location
    In Front of the screen
    Posts
    1,603

    Default

    Would STRONGLY recommend using scmd event & reborns isadmin for validation:

    Player (player) -> Sentient -> Animate -> Entity -> SimpleEntity -> Listener -> Class

    isadmin ( void )
    {


    Checks if player is currently logged in as server administrator.
    Example:
    Code:

    Code:
    local.admin = $player[1] isadmin
    
    or
    
    local.admin = $player[1] isadmin( )
    Result:
    Code:

    Code:
    Returns 1 if player is logged in as administrator, otherwise it returns 0.

    }

  3. #3
    Purple Developer Purple Elephant1au's Avatar
    Join Date
    Feb 2012
    Location
    Australia
    Posts
    1,269

    Default

    Not everyone understands how to use client admin system, let alone reborn events. Also SH and BT servers can't use reborn.

    I agree that for reborn servers and people who understand it, the server command event is perfect, but unfortunately not everyone can.
    I redid my punishment mod to use it aswell.

    Also for FYI I am currently updating the wiki aswell so the documentation will be on there aswell.

    Purple's Playground
    OBJ :
    103.29.85.127:12203
    xfire: purpleelephant1au
    email: purpleelephant1au@gmail.com
    skydrive: PurpleElephantSkydrive




  4. #4
    Developer RyBack's Avatar
    Join Date
    Apr 2014
    Location
    In Front of the screen
    Posts
    1,603

    Default

    Quote Originally Posted by Purple Elephant1au View Post
    Also for FYI I am currently updating the wiki aswell so the documentation will be on there aswell.
    Would you allow heading to a function in the wiki page through location.hash ? That's what seems to be missing in the docs.

  5. #5
    Purple Developer Purple Elephant1au's Avatar
    Join Date
    Feb 2012
    Location
    Australia
    Posts
    1,269

    Default

    I will see how i go, still getting used to the mediaWiki syntax but should be able to, ill let you know

    Purple's Playground
    OBJ :
    103.29.85.127:12203
    xfire: purpleelephant1au
    email: purpleelephant1au@gmail.com
    skydrive: PurpleElephantSkydrive




  6. #6
    Administrator James's Avatar
    Join Date
    May 2010
    Location
    on the intraweb
    Posts
    3,180

    Default

    Very nice share Purple! Thanks for this. And thanks for updating the wiki!

  7. #7

    Default

    RyBack/PE,

    Could you give an example template of what this would look like with the scmd event and isAdmin validation??

  8. #8

    Default


    servercommand local.player local.command local.args:
    if (local.player == NULL || local.player == NIL) {
    end;
    }
    if (local.player isadmin) {
    exec global/admin.scr::servercommand local.player local.command local.args;
    }
    end;

  9. #9

    Default

    Thanks, that part looks straight forward enough. I'm not sure how something like a punishment would work with this though. In the script you posted above (zap), local.player is the player sending the command. In PE's initial post, local.player is the player the action is being taken upon. How would I go about taking action on a player with the scmd event? Just something simple for example, like forcing a player to join a team.
    Last edited by [cB]SplatterGuts; May 9th, 2016 at 10:39 AM.

  10. #10
    Developer RyBack's Avatar
    Join Date
    Apr 2014
    Location
    In Front of the screen
    Posts
    1,603

    Default

    Scmd event has command and args.
    So if I type
    Code:
    scmd forceteam 1 spectator
    local.command would be "forceteam" and args [0] would be "spectator"

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •