Jump to content

Help


stefutz101

Recommended Posts

Posted
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 :(

Posted
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 ) 

Posted
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:

    

Posted (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 by Guest
Posted
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 

Posted

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?

Posted

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?

Posted

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 ?

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