Welcome, Guest. Please login or register.
Did you miss your activation email?
November 22, 2024, 07:47:14 AM
Home Help Login Register
News: Zombie Master 2 discussion

Zombie Master  |  Other  |  Trouble in Terrorist Town  |  Topic: Change Ply move speed
Pages: [1]
Author Topic: Change Ply move speed  (Read 4569 times)
Mr. Wepz.
Poster

Posts: 65


« on: March 29, 2011, 04:30:53 PM »

Hey this is actolly a question for BKU because I made a SWEP based on your health station, but when you press E on it, it removes itself and its supposed to put the walk/runspeed of the player to a higher level, like this:

function ENT:GiveSpeed(ply)
  if self:GetStoredHealth() > 0 then
  ply:SetWalkSpeed(280)
      ply:SetRunSpeed(280)
      ply:SetMaxSpeed(280)
        return true
end
end
 

function ENT:Use(ply)
   
  if IsValid(ply) and ply:IsPlayer() then
    local speed = self:GiveSpeed(ply)
  self:EmitSound(healsound)
  self:Remove()
      end
  end

Is there some of special value for it or is this code just wrong?

Thanks :)
Bad King Urgrain
Administrator
*****
Posts: 12276



« Reply #1 on: March 29, 2011, 05:57:58 PM »

You can't do this from a SENT/SWEP. TTT constantly adjusts player speed in order to make the ironsighting-slowdown happen. Any speed changes you make are instantly reset.
Mr. Wepz.
Poster

Posts: 65


« Reply #2 on: March 29, 2011, 07:14:01 PM »

Is there a way how to bypass it/ give it a exception?
Bad King Urgrain
Administrator
*****
Posts: 12276



« Reply #3 on: March 29, 2011, 09:29:21 PM »

Editing/overriding the SetSpeed function in player_ext.lua.
Mr. Wepz.
Poster

Posts: 65


« Reply #4 on: March 30, 2011, 06:41:22 AM »

Editing/overriding the SetSpeed function in player_ext.lua.


Ah ok, yeah thanks got it working now :D

Edit: Only 1 question, when equipment gets destroyed eg. The Decoy it gives a warning in the right top, but when I want to add my own text in there it says "Error cant find language" or something like that, is there a way how to add my own stuffs there too? Thanks :D
« Last Edit: March 30, 2011, 07:12:45 AM by Mr. Wepz. »
Bad King Urgrain
Administrator
*****
Posts: 12276



« Reply #5 on: March 30, 2011, 08:27:17 AM »

Easiest way is TraitorMsg(ply, "words") or PlayerMsg(ply, "words").
Mr. Wepz.
Poster

Posts: 65


« Reply #6 on: March 30, 2011, 11:42:06 AM »

This works but it sends 3x the same message?

TraitorMsg(ply, "words")
Bad King Urgrain
Administrator
*****
Posts: 12276



« Reply #7 on: March 30, 2011, 12:21:18 PM »

No it doesn't, you are calling it three times.

This level of questions is useless lua-newb stuff, thread closed.
Pages: [1]
Zombie Master  |  Other  |  Trouble in Terrorist Town  |  Topic: Change Ply move speed « previous next »
Jump to:  


Login with username, password and session length

Powered by SMF 1.1.21 | SMF © 2015, Simple Machines
Page created in 0.008 seconds with 18 queries.