stefutz101 Posted January 8, 2016 Posted January 8, 2016 function player_Wasted ( attacker ) if attacker and getElementType(attacker) == "player" and attacker ~= source then outputChatBox(getPlayerName(attacker).." killed "..getPlayerName (source),getRootElement(),255,255,255) end end addEventHandler ( "onPlayerWasted", getRootElement(), player_Wasted ) Error "outputChatBox(getPlayerName(attacker).." killed "..getPlayerName (source),getRootElement(),255,255,255)" Boolean value
ViRuZGamiing Posted January 8, 2016 Posted January 8, 2016 function player_Wasted (totalAmmo, attacker)
stefutz101 Posted January 8, 2016 Author Posted January 8, 2016 Now nothing happen ... no errors or warns
luskanek Posted January 8, 2016 Posted January 8, 2016 function player_Wasted(_, attacker) if attacker then if getElementType(attacker) == "player" then outputChatBox(getPlayerName(attacker).. " killed " ..getPlayerName(source),getRootElement(),255,255,255) end end end addEventHandler ( "onPlayerWasted", getRootElement(), player_Wasted )
stefutz101 Posted January 8, 2016 Author Posted January 8, 2016 Still nothing happen No warns or errors
luskanek Posted January 8, 2016 Posted January 8, 2016 Well ofcourse someone else should kill you in order for the message to appear. Are you killed by an another player or not?
stefutz101 Posted January 8, 2016 Author Posted January 8, 2016 I put another player to kill me . Yes ,it is server side /
AMARANT Posted January 8, 2016 Posted January 8, 2016 I put another player to kill me . What do you mean by this? Is there another player on your server who can kill you? Or you kill yourself with some function? Because your code seems OK. UPD: Maybe your meta file is not correct. It should be like this:
stefutz101 Posted January 8, 2016 Author Posted January 8, 2016 I just put a player from server to kill me . Nope i don't suicide with a function , or command . And yah i meta.xml is fine.
stefutz101 Posted January 8, 2016 Author Posted January 8, 2016 I know ... . Nope no errors or warnings ... nothing.
ALw7sH Posted January 8, 2016 Posted January 8, 2016 (edited) I'm not sure if anyone here can help you since your code is fine and it's server-side on meta as you said it must be something like you forgot to do restart or you have to do refresh for some reason or the script isn't working at all Just to find out where's the problem write on F8 debugscript 3 function player_Wasted(_, attacker) outputDebugString("true:1") if attacker then outputDebugString("true:2") if getElementType(attacker) == "player" then outputDebugString("true:3") outputChatBox(getPlayerName(attacker).. " killed " ..getPlayerName(source),getRootElement(),255,255,255) end end end addEventHandler ( "onPlayerWasted", getRootElement(), player_Wasted ) Edited January 8, 2016 by Guest
ViRuZGamiing Posted January 8, 2016 Posted January 8, 2016 Yeah stop refresh start does sometimes fix it.
stefutz101 Posted January 9, 2016 Author Posted January 9, 2016 In debugscript display only true:1 So problem is from if attacker then
ViRuZGamiing Posted January 9, 2016 Posted January 9, 2016 Try adding before the if then. outputDebugString(getPlayerName(attacker)) and see if there comes a name, this'll only be the case when being attacked by a person ofcourse.
stefutz101 Posted January 9, 2016 Author Posted January 9, 2016 boolean . Warning . Didn't working ... . And i'm was killed by another player .
ViRuZGamiing Posted January 9, 2016 Posted January 9, 2016 I don't know if it's true but I think it's fixed since in you're server it outputs true in chat when I got killed
stefutz101 Posted January 9, 2016 Author Posted January 9, 2016 function player_Wasted(_, attacker) outputDebugString("true:1") if attacker then outputDebugString("true:2") if getElementType(attacker) == "player" then outputDebugString("true:3") outputChatBox(getPlayerName(attacker).. " killed " ..getPlayerName(source),getRootElement(),255,255,255) end end end addEventHandler ( "onPlayerWasted", getRootElement(), player_Wasted ) it display only "true : 1 " . If script worked must display "test:1" , "test:2" , "test:3" . So script stop working at if attacker then
Army@1 Posted January 9, 2016 Posted January 9, 2016 Looks like there is some problem with attacker. function player_Wasted(_, attacker) outputDebugString(tostring(attacker)) if attacker then outputDebugString("true:2") if getElementType(attacker) == "player" then outputDebugString("true:3") outputChatBox(getPlayerName(attacker).. " killed " ..getPlayerName(source),getRootElement(),255,255,255) end end end addEventHandler ( "onPlayerWasted", getRootElement(), player_Wasted ) What does debugscript output?
ALw7sH Posted January 9, 2016 Posted January 9, 2016 That's weird problem lol Is that the full code? attacker doesn't return bool(false) except if who killed you isn't element Custom weapons maybe?
stefutz101 Posted January 9, 2016 Author Posted January 9, 2016 No . This isn't full script . But i create a new resource with a server-side function . function player_Wasted(_, attacker) outputDebugString("true:1") if isElement(attacker) then outputDebugString("true:2") if getElementType(attacker) == "player" then outputDebugString("true:3") outputChatBox(getPlayerName(attacker).. " killed " ..getPlayerName(source),getRootElement(),255,255,255) end end end addEventHandler ( "onPlayerWasted", getRootElement(), player_Wasted ) Still don't working . I dont have new weapons ... i have m4 , ak etc same id but guns are added in a DayZ gamemode . This is the problem ?
stefutz101 Posted January 9, 2016 Author Posted January 9, 2016 I found something . I works but it works only if player kill me with knife ... WTF
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