1. Post #1
    Zboy71's Avatar
    June 2010
    265 Posts
    I want to make the walking speed of one of my jobs a bit fast than the others. How can I do this?
    Reply With Quote Edit / Delete Show Events

  2. Post #2

    November 2011
    48 Posts
    First off, DarkRp questions don't go here. As for your question:

    I want to make the walking speed of one of my jobs a bit fast than the others. How can I do this?
    Check what team their in and if they're in team X then set their speed to your liking using GAMEMODE:SetPlayerSpeed(ply, 350, 650)

    Example:
    Code:
    function Loadout( ply )
         if team.GetName( ply:Team() ) == "Cop" then
            GAMEMODE:SetPlayerSpeed(ply, 350, 600)
        else
    	GAMEMODE:SetPlayerSpeed(ply, 250, 500)
        end
         return true
    end
     
    hook.Add( "PlayerLoadout", "PlayerLoadouts", Loadout)
    Reply With Quote Edit / Delete Windows 7 United States Show Events Lua Helper Lua Helper x 1Dumb Dumb x 1 (list)

  3. Post #3
    Dennab
    March 2012
    43 Posts
    First off, DarkRp questions don't go here. As for your question:



    Check what team their in and if they're in team X then set their speed to your liking using GAMEMODE:SetPlayerSpeed(ply, 350, 650)

    Example:
    Code:
    function Loadout( ply )
         if team.GetName( ply:Team() ) == "Cop" then
            GAMEMODE:SetPlayerSpeed(ply, 350, 600)
        else
    	GAMEMODE:SetPlayerSpeed(ply, 250, 500)
        end
         return true
    end
     
    hook.Add( "PlayerLoadout", "PlayerLoadouts", Loadout)
    And if the name of the team isn't 'Cop' ? Just check if team == TEAM_CP
    Reply With Quote Edit / Delete Windows 7 Ireland Show Events Agree Agree x 1 (list)

  4. Post #4
    Zboy71's Avatar
    June 2010
    265 Posts
    I seem to be going the same speed
    Reply With Quote Edit / Delete Windows 8 United States Show Events

  5. Post #5

    November 2011
    48 Posts
    I seem to be going the same speed
    How did you use the code? Where did you put it?
    Reply With Quote Edit / Delete Windows 7 United States Show Events Lua Helper Lua Helper x 1 (list)

  6. Post #6
    Zboy71's Avatar
    June 2010
    265 Posts
    I made a new module for it in gamemode/modules/speedchange.lua
    Reply With Quote Edit / Delete Windows 8 United States Show Events

  7. Post #7

    November 2011
    48 Posts
    I made a new module for it in gamemode/modules/speedchange.lua
    Eh, not so sure about darkrp modules. Did you change what team it checks for or just put what I gave you?
    Reply With Quote Edit / Delete Windows 7 United States Show Events Lua Helper Lua Helper x 1 (list)

  8. Post #8
    Zboy71's Avatar
    June 2010
    265 Posts
    Well, I did the same thing with a similar code for with armor and it worked in modules. Also, I did change the team.
    Reply With Quote Edit / Delete Windows 8 United States Show Events

  9. Post #9

    November 2011
    48 Posts
    Well, I did the same thing with a similar code for with armor and it worked in modules. Also, I did change the team.
    Did you include the file in the init.lua?

    Edit: brandonj4 stop marking my shit as dumb you stupid fuck.
    Reply With Quote Edit / Delete Windows 7 United States Show Events Lua Helper Lua Helper x 1Dumb Dumb x 1 (list)

  10. Post #10
    Zboy71's Avatar
    June 2010
    265 Posts
    This was the code for the armor that I placed in Darkrp/gamemode/modules/juggerarmor.lua:
    Code:
    function ArmorSpawn( ply )
    	if ply:Team() == TEAM_JUGG then
    		ply:SetArmor(100)
    	end
    end
    hook.Add( "PlayerLoadout", "ArmorSpawn", ArmorSpawn )
    It is very similar to your code:

    Code:
    function Loadout( ply )
         if team.GetName( ply:Team() ) == "Cop" then
            GAMEMODE:SetPlayerSpeed(ply, 350, 600)
        else
    	GAMEMODE:SetPlayerSpeed(ply, 250, 500)
        end
         return true
    end
     
    hook.Add( "PlayerLoadout", "PlayerLoadouts", Loadout)
    So I figured I would put it in modules as well. I also did not include it in the init.lua because I made it a module
    Reply With Quote Edit / Delete Windows 8 United States Show Events

  11. Post #11

    November 2011
    48 Posts
    This was the code for the armor that I placed in Darkrp/gamemode/modules/juggerarmor.lua:
    Code:
    -snip-
    It is very similar to your code:

    Code:
    -snip-
    So I figured I would put it in modules as well. I also did not include it in the init.lua because I made it a module
    Ok try:

    Code:
    function SpeedyJobs( ply )
         if ply:Team() == TEAMNAME then
            GAMEMODE:SetPlayerSpeed(ply, 350, 600)
        else
    	GAMEMODE:SetPlayerSpeed(ply, 250, 500)
        end
    end
     
    hook.Add( "PlayerLoadout", "SpeedyJobs", SpeedyJobs)
    Do it the same as the juggernaut armor ( place in modules folder or whatever ). Sorry you've had to try this 10 times. I usually don't work with teams. I think it was the GetName that was making it not work.
    Reply With Quote Edit / Delete Windows 7 United States Show Events

  12. Post #12
    Zboy71's Avatar
    June 2010
    265 Posts
    Still didn't seem to work. what if we change it from

    Code:
            GAMEMODE:SetPlayerSpeed(ply, 350, 600)
        else
    	GAMEMODE:SetPlayerSpeed(ply, 250, 500)
    to

    Code:
            ply:SetPlayerSpeed(ply, 350, 600)
        else
    	ply:SetPlayerSpeed(ply, 250, 500)
    Reply With Quote Edit / Delete Windows 8 United States Show Events

  13. Post #13

    November 2011
    48 Posts
    Still didn't seem to work. what if we change it from

    Code:
            GAMEMODE:SetPlayerSpeed(ply, 350, 600)
        else
    	GAMEMODE:SetPlayerSpeed(ply, 250, 500)
    to

    Code:
            ply:SetPlayerSpeed(ply, 350, 600)
        else
    	ply:SetPlayerSpeed(ply, 250, 500)
    Dafaq? Try restarting your server.
    Reply With Quote Edit / Delete Windows 7 United States Show Events

  14. Post #14
    Zboy71's Avatar
    June 2010
    265 Posts
    changing to ply didn't work either...
    Reply With Quote Edit / Delete Windows 8 United States Show Events

  15. Post #15

    November 2011
    48 Posts
    changing to ply didn't work either...
    Already knew it wouldn't, the function doesn't operate like that. Please double check the team name. Is the module in the modules folder?
    Reply With Quote Edit / Delete Windows 7 United States Show Events

  16. Post #16
    Zboy71's Avatar
    June 2010
    265 Posts
    Yes, the module is in the modules folder
    Reply With Quote Edit / Delete Windows 8 United States Show Events

  17. Post #17

    November 2011
    48 Posts
    Yes, the module is in the modules folder
    Does the file name have the sv_ prefix on it? Any console errors?
    Reply With Quote Edit / Delete Windows 7 United States Show Events

  18. Post #18
    Zboy71's Avatar
    June 2010
    265 Posts
    no, I just named it speedchange.lua and no console errors
    Reply With Quote Edit / Delete Windows 8 United States Show Events

  19. Post #19

    November 2011
    48 Posts
    no, I just named it speedchange.lua and no console errors
    Add sv_ in front of it.
    Reply With Quote Edit / Delete Windows 7 United States Show Events

  20. Post #20
    Zboy71's Avatar
    June 2010
    265 Posts
    Still nothing
    Reply With Quote Edit / Delete Windows 8 United States Show Events Funny Funny x 1 (list)

  21. Post #21

    November 2011
    48 Posts
    Still nothing
    Have you already tried restarting the server? If not do it.
    Reply With Quote Edit / Delete Windows 7 United States Show Events