1. This forum is ARCHIVED! Visit the new Cloud Sixteen forums, codename Eden, at https://eden.cloudsixteen.com. These forums will remain archived for a few months before being closed down, so try to encourage plugin developers to begin moving their content across to the new forums.
Dismiss Notice
Hi Guest, you need a Steam account to register and post on these forums. Login with Steam at the top of the forums to get started!
Dismiss Notice
Hi Guest, do you want to buy HL2RP or another Clockwork schema? Visit the Cloud Sixteen Store to get started!

Custom Commands?

Discussion in 'Discussion' started by Pawn, Oct 16, 2014.

  1. Pawn

    Pawn Registered User

    How can I make a command so that when players type in say, /rules it opens the Steam Browser with a link to the rules of the server?

    Thanks!
     
  2. Pawn

    Pawn Registered User

    Anybody know how to?
     
  3. Sir Trolled

    Sir Trolled Guest

    Don't doublepost.

    If you have any knowledge of Lua, you should be able to do an if, then statement with the command and opening the URL

    Idk. [member=5482]duck[/member] you're the smart guy
     
  4. Pawn

    Pawn Registered User

    Sorry, I just need to get this in there.

    I figured I would go ahead and put my code for it and hopefully someone can tell me whats wrong with it,

    Code:
    local COMMAND = Clockwork.command:New("rules");
    COMMAND.tip = "View the rules.";
    COMMAND.text = "<none>";
    COMMAND.flags = CMD_DEFAULT;
    
    -- Called when the command has been run.
    function COMMAND:OnRun(player)
    	gui.OpenURL("http://lsgcommunity.net78.net")
    
    COMMAND:Register();
     
  5. !

    !

    Replace your current GUI.OpenURL code with the following:
    Code:
    player:ConCommand("rules")
    Stick this in a clientside lua file:
    Code:
    concommand.Add("rules", function()
    gui.OpenURL("http://www.lsgcommunity.net78.net")
    end)
    
    I am also smart, [member=4801]Sir Trolled[/member]
    [member=5702][LSG] Pawn[/member]
     
  6. NightAngel

    NightAngel Fuck off Lev

    Code:
    local COMMAND = Clockwork.command:New("rules");
    COMMAND.tip = "View the rules.";
    COMMAND.text = "<none>";
    COMMAND.flags = CMD_DEFAULT;
    
    -- Called when the command has been run.
    function COMMAND:OnRun(player)
    	player:SendLua("gui.OpenURL(\"http://lsgcommunity.net78.net\")")
    end;
    
    COMMAND:Register();
    You could try that too, if it doesn't work work, [member=5873]Polis[/member] 's method would work. This is a lot more simple doe. You also forgot to put an end to end the OnRun function. Hope that helps ya'.
     

Previous Readers (Total: 0)