• Timer Job Scaling Issue
    3 replies, posted
Hey guys, so I was trying to make a way for my job (TEAM_DRAGON) to proportionally gain size over time. I came up with this code that I plopped into garrysmod/lua/autorun/server in a random lua file I called "dragonscale.lua" only issue is, the code doesn't seem to work, it doesn't create errors, but just doesn't wanna work... Here's the code local ply = LocalPlayer() if !ply:Team() == TEAM_DRAGON then return end timer.Create("taille:" .. pPlayer:SteamID(), 3600, 0, function() if !IsValid(ply) then timer.Destroy("taille:" .. pPlayer:SteamID()) return end RunConsoleCommand ( "ulx scale " .. ply .. " 1\n" ) end) ply:SetHull( Vector( 0.3, 0.3, 0 ), Vector( 1, 1, 1 ) ) Sooo, if any of you guys can help me, I would very much appreciate it, thx a lot!
it definitely does create errors because LocalPlayer() doesn't exist on the server.
So this should work, right? local ply = Player if !ply:Team() == TEAM_DRAGON thenreturnend timer.Create("taille:" .. pPlayer:SteamID(), 3600, 0, function()if !IsValid(ply) then timer.Destroy("taille:" .. pPlayer:SteamID()) returnend RunConsoleCommand ( "ulx scale " .. ply .. " 1\n" ) end) ply:SetHull( Vector( 0.3, 0.3, 0 ), Vector( 1, 1, 1 ) )
Assuming this is all there is in the lua file (Something tells me it isn't): LocalPlayer() does not exist on the server. ply = Player isn't going to work. What is "Player?" You'll need a way to pass a player through that. It currently wont know where to look for players. the timers are using pPlayer, which isnt defined anywhere. What is "pPlayer?". You probably want to be using your local ply. your ply:SetHull is probably not doing what you are wanting it to (as a guess). for context, default standing player hull is ( -16, -16, 0 ), ( 16, 16, 72 ) There probably is a better way to do what you're doing instead of using a RunConsoleCommand for a ulx command. Even if you stick with the runconsolecommand method (Which i dont know if i recommend), the console command looks for a name, so you'd use ply:Nick() or ply:GetName() or ply:Name() (it really doesn't matter which of the 3)
Sorry, you need to Log In to post a reply to this thread.