1. Check out the Store if you're looking to Buy HL2RP or other schemas for your server. You can click Buy Schemas on the very top navigation bar to visit the store.
  2. Use the Plugin Center to easily subscribe to and auto-install Clockwork plugins to your server, or submit and share plugins you have developed.
  3. Having trouble setting up or developing with Clockwork? Check out the Wiki or post in the Support Forum for advice from fellow users.
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!

Other Setting walk/run speed for certain factions

Discussion in 'Development' started by Sergeant Ian Sharp, Jun 2, 2018.

  1. Sergeant Ian Sharp

    Sergeant Ian Sharp Clockwork Customer

    Hi there, I kinda need help setting run and walk speed for certain factions for my schema. But I have no clue how to do this. Could somebody possibly help me out here?
     
  2. Sergeant Ian Sharp

    Sergeant Ian Sharp Clockwork Customer

    Well it's for a SCP-RP Schema, and I need to set the run and walk speed for certain SCPs (I.e. SCP-173)
     
  3. RJ

    RJ no pay Legend Clockwork Customer

    This should do the trick (in sv_hooks.lua):
    Code:
    -- Called at an interval while a player is connected.
    function PLUGIN:PlayerThink(player, curTime, infoTable)
        local factionRunSpeedIncrease1 = 5;
        local factionRunSpeedIncrease2 = 10;
        local factionRunSpeedIncrease3 = 20;
    
        local factionWalkSpeedIncrease1 = 5;
        local factionWalkSpeedIncrease2 = 10;
        local factionWalkSpeedIncrease3 = 20;
    
        if (player:GetFaction() == FACTION_ONE) then
            infoTable.runSpeed = infoTable.runSpeed + factionRunSpeedIncrease1;
            infoTable.walkSpeed = infoTable.walkSpeed + factionWalkSpeedIncrease1;
        elseif (player:GetFaction() == FACTION_TWO) then
            infoTable.runSpeed = infoTable.runSpeed + factionRunSpeedIncrease2;
            infoTable.walkSpeed = infoTable.walkSpeed + factionWalkSpeedIncrease2;
        elseif (player:GetFaction() == FACTION_THREE) then
            infoTable.runSpeed = infoTable.runSpeed + factionRunSpeedIncrease3;
            infoTable.walkSpeed = infoTable.walkSpeed + factionWalkSpeedIncrease3;
        end;
    end;
    You can make a plugin here: https://clockworkconstructors.com/construct-plugin.php

    Code is un-tested so keep that in mind. Also change factionRunSpeedIncreaseX/factionWalkSpeedIncreaseX/FACTION_X as needed.
     
    • Informative Informative x 1
    • Good Coder Good Coder x 1
  4. Sergeant Ian Sharp

    Sergeant Ian Sharp Clockwork Customer

    I got it working in the end, using the same type of code from NightAngel's zombie plugin and just replacing some code to work.
     
    • Like Like x 1