Page 2 of 3 FirstFirst 123 LastLast
Results 11 to 20 of 23

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

  1. #11

    Default

    So the "1" (clientnum) doesn't count as an arg? Using your example:

    local.command = forceteam
    args[0] = 1
    args[1] = spectator

    ?

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

    Default

    Guess so. But from the docs args might be a string splitted with spaces. I rly can't remember.

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

    Default

    Hi

    From Documentation
    http://www.x-null.net/wiki/index.php...#Servercommand

    local.player - player that has sent special server command to server
    local.command - command
    local.args - command arguments as single not splitted string

    So its a not splitted string, so it would be

    local args = 1spectator

    So what your best of doing is actually sending 01 as client number, then get first 2 characters of arg string and convert to clientnum. That way it will work for clients from 00 - 99 without the need for different string parsing statements.

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




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

    Default

    Hmm why is it not splitted? Why not an array ?

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

    Default

    Probably easier to pass the single string through the event handler then an array, because the engine does not know how many arguments you wish to send, but that being said, i think my earlier post is wrong, ill have to test, but it might include the white-space if you used white-spaces when calling it.

    The way it might work is just parse whats left after the local.command and save it all in the local.arg string.

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




  6. #16

    Default

    Finally have some time to work on this again.

    I'm able to get the scmd event for "callvote" to work without issue, but I'm not able to get the event for "map" to work. Any idea why?


    main:
    if(level.mod_run)
    end
    level.mod_run = 1
    local.result = registerev "servercommand" global/servercommandhandler.scr::servercommand
    end

    servercommand local.player local.command local.args:
    if (local.command == "callvote") {
    local.text = local.command + " " + local.args
    local.player stufftext local.text
    }

    if (local.command == "map") {
    if (local.player isadmin) {
    local.text = local.command + " " + local.args
    local.player.name = netname local.player
    set LastAdmin = local.player.name
    local.player stufftext local.text
    }
    }
    end


    I've tried (unsuccessfully) this script using a reborn account with full permissions, and even with taking the "isadmin" line out of the script as to avoid the authentication step. The idea is to update a huddraw line with the "lastadmin" line of this scmd event. Even with that line removed from the script however, I'm still unable to change the map using scmd map obj/obj_team1 or scmd map dm/mohdm1 (depending on the current gametype of the map). Ideas?

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

    Default

    I am unclear as to what you are trying to do, are you trying to change the map on the server, or change the map for the client, because stuff text makes the client send those commands, and since 'map' is a predefined cvar for mohaa, it will change the clients map, and not on the server.
    Stufftext worked for call vote because call vote is a client only command, not a server one, whereas map is both client and server side.

    If you want to be able to change the map on the server with the above scmd event script, change Stufftext to stuffsrv, which is a reborn command to sent commands to the server from script.

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




  8. #18

    Default

    I want the map on the server to change. Just like "rcon map" but I want to be able to grab the player name who is sending that command. AFAIK the only way to do that is through the SCMD event. There's no documentation on the SCMD event so I'm learning as I go lol. I changed the stufftext to stuffsrv in the scr, and it's still not working. Does anything else look wrong?


    main:
    if(level.mod_run)
    end
    level.mod_run = 1
    local.result = registerev "servercommand" global/servercommandhandler.scr::servercommand
    end

    servercommand local.player local.command local.args:
    if (local.command == "callvote") {
    local.text = local.command + " " + local.args
    local.player stufftext local.text
    }

    if (local.command == "map") {
    //if (local.player isadmin) {
    local.text = local.command + " " + local.args
    local.player.name = netname local.player
    set LastAdmin = local.player.name
    local.player stuffsrv local.text
    //}
    }
    end

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

    Default

    Sorry try it without the local.player infront

    I was on my phone at uni when i replied


    main:
    if(level.mod_run)
    end
    level.mod_run = 1
    local.result = registerev "servercommand" global/servercommandhandler.scr::servercommand
    end

    servercommand local.player local.command local.args:
    if (local.command == "callvote") {
    local.text = local.command + " " + local.args
    local.player stufftext local.text
    }

    if (local.command == "map") {
    //if (local.player isadmin) {
    local.text = local.command + " " + local.args
    local.player.name = netname local.player
    set LastAdmin = local.player.name
    stuffsrv local.text
    //}
    }
    end


    Also what is LastAdmin ?
    Also set is not a valid command for mohaa AFAIK, if it is a cvar you need setcvar "LastAdmin" "value"

    These would be picked up in the logfile aswell so you should check that for minor mistakes like this
    Last edited by Purple Elephant1au; May 18th, 2016 at 10:42 PM.

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




  10. #20

    Default

    This one is working:


    main:
    if(level.mod_run)
    end
    level.mod_run = 1
    local.result = registerev "servercommand" global/servercommandhandler.scr::servercommand
    end

    servercommand local.player local.command local.args:
    if (local.command == "callvote")
    {
    local.text = ( local.command + " " + local.args )
    local.player_callvote = netname local.player
    iprintln ("Player called the vote: " + local.player_callvote)

    }

    if (local.command == "map")
    {

    local.text = local.args
    local.name = netname local.player //player name

    if(local.player isadmin) // get admin name
    {
    local.admin_name = netname local.player
    iprintln ("Admin called the vote: " + local.admin_name)

    }

    stuffsrv ("say Changing map to " + local.text)
    wait 3 // need delay or server dont change map
    stuffsrv ("map " + local.text) //change map on server

    }
    end
    Last edited by DoubleKill; May 19th, 2016 at 04:41 AM.

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
  •