Jump to content

simple script not working..


John Smith

Recommended Posts

hi

function customDamage(attacker,weapon,bodypart,loss) 
if not attacker then outputDebugString("player got damage,no attacker") return end 
if weapon == 38 or weapon == 35 or weapon == 36 then 
killPed(source,attacker,bodypart,false) 
outputDebugString("weapon was 38 or 36 or 35 and player got killed.") 
end 
end 
addEventHandler("onPlayerDamage",root,customDamage) 

this thing doesnt work at all

i tried also making similiar thingy on client side and didnt work as well

anyone knows why?

Link to comment
function customDamage(attacker,attackerweapon,bodypart,loss) 
  if attacker and getElementType(attacker) == "player" then 
if not attacker then outputDebugString("player got damage,no attacker") return end 
if attackerweapon == 38 or attackerweapon == 35 or attackerweapon == 36 then 
killPed(source,attacker,bodypart,false) 
outputDebugString("weapon was 38 or 36 or 35 and player got killed.") 
end 
end 
end 
end 
addEventHandler("onPlayerDamage",root,customDamage) 

try this and tell me if there is any error /debugscript 3

Link to comment
  
  
function customDamage(attacker,attacker,weapon,bodypart,loss) 
outputDebugString("player got damage")  
  if attacker and getElementType(attacker) == "player" then 
outputDebugString("player check")  
if attackerweapon == 38 or attackerweapon == 35 or attackerweapon == 36 then 
killPed(source,attacker,weapon,bodypart,false) 
  
outputDebugString("weapon was 38 or 36 or 35 and player got killed.") 
  
end 
  
end 
  
end 
  
addEventHandler("onPlayerDamage",root,customDamage) 
  

No errors???? There was a missing end..... Test this code and tell me what does it output.

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...