Lua Error - Custom kill
5 replies



18.08.11 12:56:27 pm
I want to make a turrets that you can sit in it and controll
But I got problem with customkill:
Here is the script:
There is no error
Just not working
But I got problem with customkill:
Here is the script:
Code:
1
2
3
4
5
6
7
8
9
2
3
4
5
6
7
8
9
function hit_hook(id, source, weapon, hpdmg, apdmg)
if entered[source] ~= 0 then
parse('sethealth '.. id ..' '.. player(id, 'health') - turrets[entered[source]][4])
if player(id, 'health') < 1 then
parse('customkill '.. source ..' '.. turrets[entered[source]][7] ..' '.. id)
end
return 1
end
end
if entered[source] ~= 0 then
parse('sethealth '.. id ..' '.. player(id, 'health') - turrets[entered[source]][4])
if player(id, 'health') < 1 then
parse('customkill '.. source ..' '.. turrets[entered[source]][7] ..' '.. id)
end
return 1
end
end
There is no error
Just not working
A thousand may fall at your side, ten thousand at your right hand, but it will not come near you. You will only look with your eyes and see the recompense of the wicked. - Psalm 91:7-8 ESV
wee we have same problem, i think use strinng.format work, just like this:
maybe work
Code:
1
parse(string.format('customkill %s %s %s", source, turrets[entered[source]][7], id))
maybe work


No, its not working
And my string is 100% right
And my string is 100% right
A thousand may fall at your side, ten thousand at your right hand, but it will not come near you. You will only look with your eyes and see the recompense of the wicked. - Psalm 91:7-8 ESV
I think the problem is the hook, because a function with the hook "hit" reacts before the damage
For example, I have 20 HP, and you shoot me with a deagle, it is an instant kill, but the script reacts first, and the player(id,"health") will return 20
you should change the second if to
with that, it will check if the damage after the shot is < 1 (correct me if I am wrong)
For example, I have 20 HP, and you shoot me with a deagle, it is an instant kill, but the script reacts first, and the player(id,"health") will return 20
you should change the second if to
Code:
1
if player(id, 'health') - hpdmg < 1 then
with that, it will check if the damage after the shot is < 1 (correct me if I am wrong)
Should I come back and make one last map for CS2D?
Try this.
Code:
1
2
3
4
5
6
7
8
9
10
2
3
4
5
6
7
8
9
10
function hit_hook(id, source, weapon, hpdmg, apdmg)
if entered[source] ~= 0 then
if player(id, 'health')-hpdmg <= 0 then
parse('customkill '.. source ..' '.. turrets[entered[source]][7] ..' '.. id)
else
parse('sethealth '.. id ..' '.. player(id, 'health') - turrets[entered[source]][4])
end
return 1
end
end
if entered[source] ~= 0 then
if player(id, 'health')-hpdmg <= 0 then
parse('customkill '.. source ..' '.. turrets[entered[source]][7] ..' '.. id)
else
parse('sethealth '.. id ..' '.. player(id, 'health') - turrets[entered[source]][4])
end
return 1
end
end
Thanks Context but it must be:
Theres is custom damage for weapon tanks BTW
Code:
1
2
3
4
5
6
7
8
9
10
2
3
4
5
6
7
8
9
10
function hit_hook(id, source, weapon, hpdmg, apdmg)
if entered[source] ~= 0 then
if player(id, 'health') - turrets[entered[source]][4] <= 0 then
parse('customkill '.. source ..' '.. turrets[entered[source]][7] ..' '.. id)
else
parse('sethealth '.. id ..' '.. player(id, 'health') - turrets[entered[source]][4])
end
return 1
end
end
if entered[source] ~= 0 then
if player(id, 'health') - turrets[entered[source]][4] <= 0 then
parse('customkill '.. source ..' '.. turrets[entered[source]][7] ..' '.. id)
else
parse('sethealth '.. id ..' '.. player(id, 'health') - turrets[entered[source]][4])
end
return 1
end
end
Theres is custom damage for weapon tanks BTW
A thousand may fall at your side, ten thousand at your right hand, but it will not come near you. You will only look with your eyes and see the recompense of the wicked. - Psalm 91:7-8 ESV



