• [Darkrp] Making single jobs walking speed faster
    20 replies, posted
I want to make the walking speed of one of my jobs a bit fast than the others. How can I do this?
First off, DarkRp questions don't go here. As for your question: [QUOTE=Zboy71;41386538]I want to make the walking speed of one of my jobs a bit fast than the others. How can I do this?[/QUOTE] 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) [/CODE]
[QUOTE=runedog48;41386589]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) [/CODE][/QUOTE] And if the name of the team isn't 'Cop' ? Just check if team == TEAM_CP
I seem to be going the same speed
[QUOTE=Zboy71;41386874]I seem to be going the same speed[/QUOTE] How did you use the code? Where did you put it?
I made a new module for it in gamemode/modules/speedchange.lua
[QUOTE=Zboy71;41386920]I made a new module for it in gamemode/modules/speedchange.lua[/QUOTE] Eh, not so sure about darkrp modules. Did you change what team it checks for or just put what I gave you?
Well, I did the same thing with a similar code for with armor and it worked in modules. Also, I did change the team.
[QUOTE=Zboy71;41386950]Well, I did the same thing with a similar code for with armor and it worked in modules. Also, I did change the team.[/QUOTE] Did you include the file in the init.lua? Edit: brandonj4 stop marking my shit as dumb you stupid fuck.
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 ) [/code] 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) [/code] 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
[QUOTE=Zboy71;41387025]This was the code for the armor that I placed in Darkrp/gamemode/modules/juggerarmor.lua: [code] -snip- [/code] It is very similar to your code: [code] -snip- [/code] 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[/QUOTE] 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)[/CODE] 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.
Still didn't seem to work. what if we change it from [code] GAMEMODE:SetPlayerSpeed(ply, 350, 600) else GAMEMODE:SetPlayerSpeed(ply, 250, 500) [/code] to [code] ply:SetPlayerSpeed(ply, 350, 600) else ply:SetPlayerSpeed(ply, 250, 500) [/code]
[QUOTE=Zboy71;41387152]Still didn't seem to work. what if we change it from [code] GAMEMODE:SetPlayerSpeed(ply, 350, 600) else GAMEMODE:SetPlayerSpeed(ply, 250, 500) [/code] to [code] ply:SetPlayerSpeed(ply, 350, 600) else ply:SetPlayerSpeed(ply, 250, 500) [/code][/QUOTE] Dafaq? Try restarting your server.
changing to ply didn't work either...
[QUOTE=Zboy71;41387184]changing to ply didn't work either...[/QUOTE] 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?
Yes, the module is in the modules folder
[QUOTE=Zboy71;41387204]Yes, the module is in the modules folder[/QUOTE] Does the file name have the sv_ prefix on it? Any console errors?
no, I just named it speedchange.lua and no console errors
[QUOTE=Zboy71;41387296]no, I just named it speedchange.lua and no console errors[/QUOTE] Add sv_ in front of it.
Still nothing
[QUOTE=Zboy71;41387432]Still nothing[/QUOTE] Have you already tried restarting the server? If not do it.
Sorry, you need to Log In to post a reply to this thread.