hook kill, bot vampire
4 replies



11.11.22 11:51:47 pm
Hi everyone,
I looking for a make a script for make a bot (yes again
) "vampire" (personnality of bots)
When bot Dracula kill, he win the blood (+ 20 HP)
But, have a error(s) :
LUA ERROR: sys/lua/autorun/check vampire.lua:3: bad argument #1 to 'player' (number expected, got nil)
-> [C]: in function 'player'
Thanks for advance.
I looking for a make a script for make a bot (yes again

When bot Dracula kill, he win the blood (+ 20 HP)
Code:
1
2
3
4
5
6
7
8
9
10
2
3
4
5
6
7
8
9
10
addhook("kill", "bot_vampire")
function bot_vampire(killer, victim, weapon, x, y)
if player(id,"bot")==true and player(id,"name")=="Dracula" then
if weapon==50 then
parse('equip '..id..' '..65)
else
return
end
end
end
function bot_vampire(killer, victim, weapon, x, y)
if player(id,"bot")==true and player(id,"name")=="Dracula" then
if weapon==50 then
parse('equip '..id..' '..65)
else
return
end
end
end
But, have a error(s) :

-> [C]: in function 'player'
Thanks for advance.
id
is not set. I think you mean killer
in function bot_vampire(-->killer<--, victim, weapon, x, y)
.In addition you have one "end" too many.
Here you go, remove
-->
and <--
to make it work.Code:
1
2
3
4
5
6
7
8
9
10
11
2
3
4
5
6
7
8
9
10
11
addhook("kill", "bot_vampire")
function bot_vampire(killer, victim, weapon, x, y)
if player(-->killer<---, "bot")==true and player(-->killer<--, "name") == "Dracula" then
if weapon == 50 then
-- 65 = bandage
parse('equip '..id..' '..65)
else
return
end
--> End removed <--
end
function bot_vampire(killer, victim, weapon, x, y)
if player(-->killer<---, "bot")==true and player(-->killer<--, "name") == "Dracula" then
if weapon == 50 then
-- 65 = bandage
parse('equip '..id..' '..65)
else
return
end
--> End removed <--
end
Muh
Code:
1
2
3
4
5
6
7
8
9
2
3
4
5
6
7
8
9
addhook("kill", "bot_vampire")
function bot_vampire(id, victim, weapon, x, y)
if player(id, "bot") == true and player(id, "name") == "Dracula" then
if weapon == 50 then
local hp = player(id, "health") + 20
parse(string.format("sethealth %d %d", id, hp))
end
end
end
function bot_vampire(id, victim, weapon, x, y)
if player(id, "bot") == true and player(id, "name") == "Dracula" then
if weapon == 50 then
local hp = player(id, "health") + 20
parse(string.format("sethealth %d %d", id, hp))
end
end
end



