• Speed Increasing perk Help?
    8 replies, posted
Isn't there a way to make a Player faster with a point shop Item?
[url]http://wiki.garrysmod.com/page/Player/SetWalkSpeed[/url] [url]http://wiki.garrysmod.com/page/Player/SetRunSpeed[/url]
[QUOTE=code_gs;45645909][url]http://wiki.garrysmod.com/page/Player/SetWalkSpeed[/url] [url]http://wiki.garrysmod.com/page/Player/SetRunSpeed[/url][/QUOTE] I already did that. What I mean is, Can I use it in a pointshop item file for the player who buys it, and how would I make it?
Just put those in the OnEquip function.
[QUOTE=code_gs;45645940]Just put those in the OnEquip function.[/QUOTE] Tried, Did not work... Here is the code. [CODE]ITEM.Name = 'Speed Boost' ITEM.Price = 0 function ITEM:OnEquip(ply, modifications) if not Player:SetWalkSpeed = 250 then Player:SetWalkSpeed = 300 end end function ITEM:OnHolster(ply) if Player:SetWalkSpeed = 250 then Player:SetWalkspeed = 250 end end function ITEM:OnSell(ply) if Player:SetWalkSpeed = 250 then Player:SetWalkSpeed = 250 end[/CODE] I am not entirely sure what is the default walk speed.
[Lua] ITEM.Name = 'Speed Boost' ITEM.Price = 0 function ITEM:OnEquip(ply, modifications) ply:SetWalkSpeed( 300 ) end function ITEM:OnHolster(ply) ply:SetWalkSpeed( 260 ) end [/Lua] That is the basic you need, the default walk speed depends on what gamemode you are playing.
1. No point in using an if statement there. Just set it in the OnEquip, and change it back in the OnHolster. 2. Why use Player: when you've defined the player as ply in the function? 3. It's SetWalkSpeed(number), not = number. [editline]10th August 2014[/editline] Ninja'd [editline]10th August 2014[/editline] [QUOTE=Jewno;45646085][Lua] ITEM.Name = 'Speed Boost' ITEM.Price = 0 function ITEM:OnEquip(ply, modifications) ply:SetWalkSpeed( 300 ) end function ITEM:OnHolster(ply) ply:SetWalkSpeed( 260 ) end function ITEM:OnSell(ply) ply:SetWalkSpeed( 260 ) end [/Lua] That is the basic you need, the default walk speed depends on what gamemode you are playing.[/QUOTE] OnSell is useless since the OnHolster already does it.
Yeah true, I just kept it there because he used it.
If its for TTT then use the TTTPlayerSpeed hook
Sorry, you need to Log In to post a reply to this thread.