TheIceman1 Posted March 19, 2013 Share Posted March 19, 2013 Why i didnt get money and message?No errors. Server side: bankTimer = setTimer ( function() givePlayerMoney ( source, 50000 ) removeElementData( source, "bankrobber" ) exports ["guimessages"] : outputServer ( source, "You succesfully robbed the bank and get $50000!" , 255, 255, 0) end ,10000, 1 ) Link to comment
-ffs-Sniper Posted March 19, 2013 Share Posted March 19, 2013 Are you sure source is defined? (source is only used as pre-defined variable in event handlers) The timer itself is correct. Link to comment
TheIceman1 Posted March 19, 2013 Author Share Posted March 19, 2013 Nothing happens bankTimer = setTimer ( function(player) givePlayerMoney ( player, 50000 ) removeElementData( player, "bankrobber" ) exports ["guimessages"] : outputServer ( player, "You succesfully robbed the bank and get $50000!" , 255, 255, 0) end,10000,1) Link to comment
Anderl Posted March 19, 2013 Share Posted March 19, 2013 You didn't pass any argument to the timer's function. Link to comment
TheIceman1 Posted March 19, 2013 Author Share Posted March 19, 2013 Its full code: function startbank () setElementData ( source, "bankrobber", "true" ) exports ["guimessages"] : outputServer ( source, "You start bank rob!" , 255, 255, 0) exports ["guimessages"] : outputServer ( source, "You must stay in bank 5 minutes to get money!" , 255, 255, 0) setElementInterior ( source, 3, 387.6708, 173.8050, 1008.3893 ) setPlayerWantedLevel ( source, 6 ) bankTimer = setTimer ( function(player) givePlayerMoney ( player, 50000 ) removeElementData( player, "bankrobber" ) exports ["guimessages"] : outputServer ( player, "You successfully robbed the bank and get $50000!" , 255, 255, 0) end ,10000,1) end addEvent ( "start", true ) addEventHandler ( "start", root, startbank ) Link to comment
iPrestege Posted March 19, 2013 Share Posted March 19, 2013 Hmm.. Try This : function startbank () setElementData ( source, "bankrobber", true ) exports ["guimessages"] : outputServer ( source, "You start bank rob!" , 255, 255, 0) exports ["guimessages"] : outputServer ( source, "You must stay in bank 5 minutes to get money!" , 255, 255, 0) setElementInterior ( source, 3, 387.6708, 173.8050, 1008.3893 ) setPlayerWantedLevel ( source, 6 ) bankTimer = setTimer ( function(player) givePlayerMoney ( player, 50000 ) removeElementData( player, "bankrobber" ) exports ["guimessages"] : outputServer ( player, "You successfully robbed the bank and get $50000!" , 255, 255, 0) end end ,10000,1) addEvent ( "start", true ) addEventHandler ( "start", root, startbank ) Link to comment
Anderl Posted March 19, 2013 Share Posted March 19, 2013 And why do we need the full code? I already told you the problem, just fix it. Link to comment
TheIceman1 Posted March 19, 2013 Author Share Posted March 19, 2013 Hmm.. Try This : function startbank () setElementData ( source, "bankrobber", true ) exports ["guimessages"] : outputServer ( source, "You start bank rob!" , 255, 255, 0) exports ["guimessages"] : outputServer ( source, "You must stay in bank 5 minutes to get money!" , 255, 255, 0) setElementInterior ( source, 3, 387.6708, 173.8050, 1008.3893 ) setPlayerWantedLevel ( source, 6 ) bankTimer = setTimer ( function(player) givePlayerMoney ( player, 50000 ) removeElementData( player, "bankrobber" ) exports ["guimessages"] : outputServer ( player, "You successfully robbed the bank and get $50000!" , 255, 255, 0) end end ,10000,1) addEvent ( "start", true ) addEventHandler ( "start", root, startbank ) Nothing Link to comment
TheIceman1 Posted March 19, 2013 Author Share Posted March 19, 2013 And why do we need the full code? I already told you the problem, just fix it. I dont understand... Link to comment
Anderl Posted March 19, 2013 Share Posted March 19, 2013 setTimer - Take a look at the syntax, and your timer's function arguments. Link to comment
iPrestege Posted March 19, 2013 Share Posted March 19, 2013 Try : function startbank () setElementData ( source, "bankrobber", true ) exports ["guimessages"] : outputServer ( source, "You start bank rob!" , 255, 255, 0) exports ["guimessages"] : outputServer ( source, "You must stay in bank 5 minutes to get money!" , 255, 255, 0) setElementInterior ( source, 3, 387.6708, 173.8050, 1008.3893 ) setPlayerWantedLevel ( source, 6 ) bankTimer = setTimer (function(player) if not isElement(player) then return end givePlayerMoney ( player, 50000 ) removeElementData( player, "bankrobber" ) exports ["guimessages"] : outputServer ( player, "You successfully robbed the bank and get $50000!" , 255, 255, 0) end ,10000,1,source) end addEvent ( "start", true ) addEventHandler ( "start", root, startbank ) Link to comment
TheIceman1 Posted March 19, 2013 Author Share Posted March 19, 2013 setTimer - Take a look at the syntax, and your timer's function arguments. Fixed,thanks! 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