Jump to content

KILL ZOMBIE


Recommended Posts

Boa Noite, 

 

não queria vim pedir ajuda no forum mas fui forçado a pedir ajuda eu to com problema de aviso numa linha do script que tava criando no Client.lua.. a função é quando da dano no ped (zombie) 

na linha eu coloco o Blood do zombie > 0 só que quando da numo menor que 0 ele da aviso.

 

AVISO ===  attempt to compare with number boolean

 

 

                 if getElementData(source,"bloodZumbie") > 0 then -- aviso aqui
				    if weapon == 0 then
                        damage = 2500 
                    else
                        damage = getWeaponDamage(weapon,attacker)
                    end
                    if bodypart == 9 then
                        damage = damage * 9.5
					    headshot = true
				    end
				    setElementData(source, "bloodZumbie", getElementData(source, "bloodZumbie") - math.random(damage * 0.75, damage * 1.25))
                    outputChatBox("DANO ZUMBIE: "..damage.." / "..getElementData(source,"bloodZumbie"))
					if getElementData(source,"bloodZumbie") <= 0 and not getElementData(source,"isDeadZumbie") then 
					    triggerServerEvent("onZombieGetsKilled", source, attacker, headshot, getWeaponNameFromID(weapon))
					    setElementData ( source, "isDeadZumbie", true )
						outputChatBox("MATOU")
					end
                 end

 

 

Edited by felipebaidoloko
Link to comment
  • Moderators

Tente:

                 if (getElementData(source,"bloodZumbie") or 0) > 0 then -- aviso aqui
				    if weapon == 0 then
                        damage = 2500 
                    else
                        damage = getWeaponDamage(weapon,attacker)
                    end
                    if bodypart == 9 then
                        damage = damage * 9.5
					    headshot = true
				    end
				    setElementData(source, "bloodZumbie", getElementData(source, "bloodZumbie") - math.random(damage * 0.75, damage * 1.25))
                    outputChatBox("DANO ZUMBIE: "..damage.." / "..getElementData(source,"bloodZumbie"))
					if getElementData(source,"bloodZumbie") <= 0 and not getElementData(source,"isDeadZumbie") then 
					    triggerServerEvent("onZombieGetsKilled", source, attacker, headshot, getWeaponNameFromID(weapon))
					    setElementData ( source, "isDeadZumbie", true )
						outputChatBox("MATOU")
					end
                 end

 

Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...