Jump to content

onClientPlayerWasted not being called :/


Franc[e]sco

Recommended Posts

I dunno if it's a LUA bug but even if the code seems perfect my onClientPlayerWasted doesnt even call, it doesnt give any error or any debug i setted... here's the code (client-sided script)

-- Simple dm 0.1a coded by Franc[e]sco 
--//--------------------------------------------------------------------------// 
addEventHandler ( "onClientResourceStart",getResourceRootElement(getThisResource()), 
    function() 
        local gogogo = guiCreateLabel ( 0, 0.2, 1, 0.5, "Go Go Go! Kill as much as you can!", true ) 
        guiSetFont ( gogogo, "sa-gothic" ) 
        guiLabelSetColor ( gogogo, 206, 0, 5 ) 
        guiLabelSetHorizontalAlign ( gogogo, "center", false ) 
        setTimer ( destroyElement, 10000, 1, gogogo ) 
    end 
) 
--//--------------------------------------------------------------------------// 
function playerGotPwned  (killer, weapon, bodypart) 
    outputDebugString("onClientPlayerWasted called") 
    secondsleft = 10 
    outputDebugString("Seconds before respawn: " ..secondsleft) 
    countdownToSpawn = guiCreateLabel ( 0, 0.2, 1, 0.5, secondsleft, true ) 
    guiSetFont (countdownToSpawn, "sa-gothic" ) 
    guiLabelSetColor (countdownToSpawn, 206, 0, 5) 
    guiLabelSetHorizontalAlign (countdownToSpawn, "center", false) 
    outputDebugString("GUI created") 
    setTimer (destroyElement, 10000, 1, countdownToSpawn) 
    outputDebugString("setted timer to destroy countdownToSpawn") 
    setTimer (countdownFunction, 1000, 10) 
    outputDebugString("setted timer to countdownFunction") 
    setGuiVisible(countdownToSpawn, true) 
    outputDebugString("setted gui to visible") 
end 
addEventHandler ("onClientPlayerWasted", getLocalPlayer(), playerGotPwned) 
--//--------------------------------------------------------------------------// 
function countdownFunction () 
    secondsleft = secondsleft-1 
    outputDebugString(secondsleft) 
    guiSetText (countdownToSpawn, secondsleft) 
end 
--//--------------------------------------------------------------------------// 

Link to comment
Screen

:/ i think something's wrong in the script

As you can see, it is triggered, but you are using an unknown function called setGuiVisible in line 26.

Happy coding,

Jan (DracoBlue)

also make sure that you added the event client-side (in your client-script: addEvent("event name", true), true needs to be supplied to make it remotely triggerable, by your serverscript for example :) )

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