Hi.
Currently, printmessage prints to everyone, and ply:printmessage doesn't work at all.
How do I do so only the player see?
Do you want it to print to the console or what?
I'm remaking Fatguy55 or whatever he's name is, his RadarGun.
[lua]
PrintMessage( HUD_PRINTCENTER ,"Object speed is: "..tostring(math.floor(X + Y + Z)).." MPH" )
[/lua]
This prints in the center of the screen, Object speed is: x MPH
Currently, for everyone.
I only want it to print for the player in question.
Show us your whole SWEP.
It's not mine.
[lua]
AddCSLuaFile("cl_init.lua")
AddCSLuaFile("shared.lua")
include('shared.lua')
SWEP.ViewModel = "models/weapons/v_RPG.mdl"
SWEP.WorldModel = "models/Weapons/w_IRifle.mdl"
function SWEP:PrimaryAttack()
self.Weapon:EmitSound("npc/combine_gunship/gunship_ping_search.wav")
local tr = util.GetPlayerTrace(self.Owner)
local Trace = util.TraceLine(tr)
if Trace.HitNonWorld then
TargetEnt = Trace.Entity:GetPhysicsObject()
MPH = 23.392857142857142857142857142857
local X = math.abs(TargetEnt:GetVelocity().x) / MPH
local Y = math.abs(TargetEnt:GetVelocity().y) / MPH
local Z = math.abs(TargetEnt:GetVelocity().z) / MPH
Speed = X + Y + Z
if Speed - math.abs(math.ceil(Speed)) < math.abs(math.floor(Speed)) then
Speed = math.ceil(Speed)
else
Speed = math.floor(Speed)
end
ply:PrintMessage( HUD_PRINTCENTER ,"Object speed is: "..tostring(math.floor(X + Y + Z)).." MPH" )
end
end
function SWEP:SecondaryAttack()
end
[/lua]
[lua]self.Owner:PrintMessage( HUD_PRINTCENTER ,"Object speed is: "..tostring(math.floor(X + Y + Z)).." MPH" )[/lua]
[QUOTE=Cubar;25578212][lua]self.Owner:PrintMessage( HUD_PRINTCENTER ,"Object speed is: "..tostring(math.floor(X + Y + Z)).." MPH" )[/lua][/QUOTE]
Seems like it works.
Cheers Cubar!
Sorry, you need to Log In to post a reply to this thread.