UAEpro Posted February 2, 2012 Share Posted February 2, 2012 (edited) function rankk() local gotexp2 = getElementData(source,"exp212") if gotexp2 == 1 then outputChatBox(gotexp2) outputChatBox("*sorry",source,0,255,0,true) else outputChatBox("ok",source,0,255,0,true) setElementData(source,"exp212",1) end end addEventHandler("onPlayerWasted",getRootElement(),rankk) function new() setElementData(source,"exp212",0) alvw = getElementData(source,"exp212") outputChatBox(""..alvw) end addEvent("onMapStarting",true) addEventHandler("onMapStarting",getRootElement(),new) it always show "sorry" idk why another stupid problem Edited February 2, 2012 by Guest Link to comment
Castillo Posted February 2, 2012 Share Posted February 2, 2012 function rankk() local gotexp2 = tonumber(getElementData(source,"exp212")) if (gotexp2 == 1) then outputChatBox(gotexp2) outputChatBox("*sorry",source,0,255,0,true) else outputChatBox("ok",source,0,255,0,true) setElementData(source,"exp212",1) end end addEventHandler("onPlayerWasted",getRootElement(),rankk) function new() setElementData(source,"exp212",0) alvw = getElementData(source,"exp212") outputChatBox(""..alvw) end addEvent("onMapStarting",true) addEventHandler("onMapStarting",getRootElement(),new) Link to comment
Castillo Posted February 2, 2012 Share Posted February 2, 2012 Have you checked manually the data "exp212"? Link to comment
UAEpro Posted February 3, 2012 Author Share Posted February 3, 2012 1st getElementData(source,"exp212") must be nill it will say sorry in the chatbox then the value will be 1 so it will not say sorry again until another map start but it's not working Link to comment
Kenix Posted February 3, 2012 Share Posted February 3, 2012 function rankk( ) local gotexp2 = tonumber( getElementData( source,"exp212" ) or 0 ) if gotexp2 == 1 then -- you can use if some then instand of if ( some ) then outputChatBox( tostring( gotexp2 ) ) -- gotexp2 is number value convert to string --outputChatBox( "*sorry",source,0,255,0,true ) -- why true ? Need use false see in arguments function outputChatBox( "*sorry",source,0,255,0 ) else --outputChatBox("ok",source,0,255,0,false ) -- same outputChatBox( "ok",source,0,255,0 ) setElementData( source,"exp212",1 ) end end addEventHandler( "onPlayerWasted",root,rankk ) function new( ) setElementData( source,"exp212",0 ) local alvw = getElementData( source,"exp212" ) -- variable alvw is number outputChatBox( tostring( alvw ) ) -- convert to string end addEvent( "onMapStarting",true) addEventHandler( "onMapStarting",root,new ) SolidShake14,Your code is wrong ... P.S Tabulate your code in next time. P.S See in /debugscript 3 P.S Code updated. Link to comment
UAEpro Posted February 3, 2012 Author Share Posted February 3, 2012 the problem is not from the value or outputchatbox .. i put outputchatbox to know what is the element i just care about (( if gotexp2 == 1 then )) it's always 1 even when i change the value in onMapStarting Link to comment
Kenix Posted February 3, 2012 Share Posted February 3, 2012 /reconnect and try again. Show full code. Link to comment
Castillo Posted February 3, 2012 Share Posted February 3, 2012 function rankk( ) local gotexp2 = tonumber( getElementData( source,"exp212" ) or 0 ) if gotexp2 == 1 then -- you can use if some then instand of if ( some ) then outputChatBox( tostring( gotexp2 ) ) -- gotexp2 is number value convert to string --outputChatBox( "*sorry",source,0,255,0,true ) -- why true ? Need use false see in arguments function outputChatBox( "*sorry",source,0,255,0 ) else --outputChatBox("ok",source,0,255,0,false ) -- same outputChatBox( "ok",source,0,255,0 ) setElementData( source,"exp212",1 ) end end addEventHandler( "onPlayerWasted",root,rankk ) function new( ) setElementData( source,"exp212",0 ) local alvw = getElementData( source,"exp212" ) -- variable alvw is number outputChatBox( tostring( alvw ) ) -- convert to string end addEvent( "onMapStarting",true) addEventHandler( "onMapStarting",root,new ) SolidShake14,Your code is wrong ... P.S Tabulate your code in next time. P.S See in /debugscript 3 P.S Code updated. That's just useless, true and false in outputChatBox will just enable and disable the HEX color codes. 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