Xeonmeister Posted July 3, 2016 Share Posted July 3, 2016 So i just wanted to test things clientside and was trying to make some basic scripts, and this doesn't wanna run. I can't see why. Any suggestions? regen2 = {} hp2 = {} function sethp2(amount) setElementHealth(localPlayer, amount) hp2[localPlayer] = amount outputChatBox("sethp "..tostring(amount)) end addEventHandler("onClientPlayerWasted", root, function(killer, weapon, bodypart) if localPlayer == source then playSound("sounds/wasted.mp3") else if localPlayer == killer then playSound("sounds/kill.mp3") end end) function regen() if hp2[localPlayer] < 99 then sethp2(hp2[localPlayer]+1) if regen2[localPlayer] == true then setTimer(regen, 250, 1) end else sethp2(100) regen2[localPlayer] = false end end addEventHandler("onClientResourceStart", root, function() for i, v in ipairs(getElementsByType("object")) do engineSetModelLODDistance(getElementModel(v), 170) end end) addEventHandler("onClientPlayerSpawn", localPlayer, function() sethp2(100) regen2[localPlayer] = false end) addEventHandler("onClientPlayerWeaponFire", localPlayer, function(weapon, ammo, ammoInClip, hitX, hitY, hitZ, hitElement, startX, startY, startZ) outputChatBox("hit: "..hitX..", "..hitY..", "..hitZ) outputChatBox(getDistanceBetweenPoints3D(hitX, hitY, hitZ, startX, startY, startZ).." meters.") outputChatBox(" ") end) addEventHandler("onClientPlayerDamage", localPlayer, function(attacker, weapon, bodypart, loss) hp2[localPlayer] = hp2[localPlayer]-loss if regen2[localPlayer] == false then regen2[localPlayer] = true regen() end end) addEventHandler("onClientPlayerQuit", localPlayer, function() regen2[localPlayer] = nil hp2[localPlayer] = nil end) Link to comment
Bonsai Posted July 3, 2016 Share Posted July 3, 2016 So i just wanted to test things clientside and was trying to make some basic scripts, and this doesn't wanna run. I can't see why. Any suggestions? regen2 = {} hp2 = {} function sethp2(amount) setElementHealth(localPlayer, amount) hp2[localPlayer] = amount outputChatBox("sethp "..tostring(amount)) end addEventHandler("onClientPlayerWasted", root, function(killer, weapon, bodypart) if localPlayer == source then playSound("sounds/wasted.mp3") else if localPlayer == killer then playSound("sounds/kill.mp3") end end) function regen() if hp2[localPlayer] < 99 then sethp2(hp2[localPlayer]+1) if regen2[localPlayer] == true then setTimer(regen, 250, 1) end else sethp2(100) regen2[localPlayer] = false end end addEventHandler("onClientResourceStart", root, function() for i, v in ipairs(getElementsByType("object")) do engineSetModelLODDistance(getElementModel(v), 170) end end) addEventHandler("onClientPlayerSpawn", localPlayer, function() sethp2(100) regen2[localPlayer] = false end) addEventHandler("onClientPlayerWeaponFire", localPlayer, function(weapon, ammo, ammoInClip, hitX, hitY, hitZ, hitElement, startX, startY, startZ) outputChatBox("hit: "..hitX..", "..hitY..", "..hitZ) outputChatBox(getDistanceBetweenPoints3D(hitX, hitY, hitZ, startX, startY, startZ).." meters.") outputChatBox(" ") end) addEventHandler("onClientPlayerDamage", localPlayer, function(attacker, weapon, bodypart, loss) hp2[localPlayer] = hp2[localPlayer]-loss if regen2[localPlayer] == false then regen2[localPlayer] = true regen() end end) addEventHandler("onClientPlayerQuit", localPlayer, function() regen2[localPlayer] = nil hp2[localPlayer] = nil end) /debugscript 3 first please. Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now