YopMan Posted February 16, 2012 Share Posted February 16, 2012 Hi all, I've got a problem in my script. This script does not work: if ( isPlayerWasted () then triggerEvent("msgBoxInfo", getRootElement(), "my text") end Thanks. Link to comment
Xeno Posted February 16, 2012 Share Posted February 16, 2012 What. This is a total mess. function onDeath() outputChatBox("your dead, cool story bro") end addEventHandler("onPlayerWasted", getRootElement(), onDeath) That is a simple way to do it. Link to comment
Castillo Posted February 16, 2012 Share Posted February 16, 2012 function onDeath() outputChatBox("your dead, cool story bro", source, 255, 0, 0) -- You forgot about the player element. end addEventHandler("onPlayerWasted", getRootElement(), onDeath) Link to comment
YopMan Posted February 16, 2012 Author Share Posted February 16, 2012 I don't wan't to put it in the chatbox. (Sorry I'm french) Here is my full code: MsgBoxWindow = {} MsgBoxText = {} MsgBoxWindow = guiCreateWindow(0.3984,0.3841,0.2061,0.1901,"Info",true) guiSetAlpha(MsgBoxWindow,0. MsgBoxText = guiCreateLabel(0.1991,0.2808,0.5498,0.4726,"",true,MsgBoxWindow) guiSetVisible(MsgBoxWindow, false) showCursor(false) function newmsgbox(co) guiSetVisible(MsgBoxWindow, true) guiSetText(MsgBoxText, tostring(co)) showCursor(false) setTimer(function() guiSetAlpha(MsgBoxWindow,0.70000000000000) end, 300, 1) setTimer(function() guiSetAlpha(MsgBoxWindow,0.60000000000000) end, 700, 1) setTimer(function() guiSetAlpha(MsgBoxWindow,0.50000000000000) end, 1000, 1) setTimer(function() guiSetAlpha(MsgBoxWindow,0.40000000000000) end, 1300, 1) setTimer(function() guiSetAlpha(MsgBoxWindow,0.30000000000000) end, 1500, 1) setTimer(function() guiSetAlpha(MsgBoxWindow,0.20000000000000) end, 1800, 1) setTimer(function() guiSetAlpha(MsgBoxWindow,0.10000000000000) end, 2000, 1) setTimer(function() guiSetAlpha(MsgBoxWindow,0.00000000000000) end, 2300, 1) setTimer(function() guiSetVisible(MsgBoxWindow, false) end, 2300, 1) end addEvent("msgBoxInfo", true) addEventHandler("msgBoxInfo", getRootElement(), newmsgbox) if ( isPlayerWasted () then triggerEvent("msgBoxInfo", getRootElement(), "my text") end the type is client. Link to comment
Castillo Posted February 16, 2012 Share Posted February 16, 2012 MsgBoxWindow = {} MsgBoxText = {} MsgBoxWindow = guiCreateWindow(0.3984,0.3841,0.2061,0.1901,"Info",true) guiSetAlpha(MsgBoxWindow, 0.80) MsgBoxText = guiCreateLabel(0.1991,0.2808,0.5498,0.4726,"",true,MsgBoxWindow) guiSetVisible(MsgBoxWindow, false) showCursor(false) function newmsgbox(co) guiSetVisible(MsgBoxWindow, true) guiSetText(MsgBoxText, tostring(co)) showCursor(false) setTimer(function() guiSetAlpha(MsgBoxWindow,0.70000000000000) end, 300, 1) setTimer(function() guiSetAlpha(MsgBoxWindow,0.60000000000000) end, 700, 1) setTimer(function() guiSetAlpha(MsgBoxWindow,0.50000000000000) end, 1000, 1) setTimer(function() guiSetAlpha(MsgBoxWindow,0.40000000000000) end, 1300, 1) setTimer(function() guiSetAlpha(MsgBoxWindow,0.30000000000000) end, 1500, 1) setTimer(function() guiSetAlpha(MsgBoxWindow,0.20000000000000) end, 1800, 1) setTimer(function() guiSetAlpha(MsgBoxWindow,0.10000000000000) end, 2000, 1) setTimer(function() guiSetAlpha(MsgBoxWindow,0.00000000000000) end, 2300, 1) setTimer(function() guiSetVisible(MsgBoxWindow, false) end, 2300, 1) end addEvent("msgBoxInfo", true) addEventHandler("msgBoxInfo", getRootElement(), newmsgbox) addEventHandler("onClientPlayerWasted",localPlayer, function () triggerEvent("msgBoxInfo", localPlayer, "my text") end ) Link to comment
YopMan Posted February 16, 2012 Author Share Posted February 16, 2012 YYEEAH ! You are the best Solidsnake14 !! It work Thanks to all Link to comment
karlis Posted February 18, 2012 Share Posted February 18, 2012 the timers for fade are unnecessary and not optimized, call same timer more than one time and deduct bit of alpha each call. Link to comment
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