rbb27 Posted August 26, 2011 Share Posted August 26, 2011 Hi. When You kill on zombie you should win your reward or you malus depending on your team but i have all the time error =( Can you show me my error? addEvent( "onZombieWasted" ); addEventHandler( "onZombieWasted", getRootElement(), function( killer ) local playerTeam = getPlayerTeam ( killer ) if ( playerTeam == Army) then setAccountData (killer,"zombieKills",zombieKills+2) givePlayerMoney( killer, math.random( 80, 110 ) ) elseif ( playerTeam == Scientific) then setAccountData (killer,"zombieKills",zombieKills-1) outputChatBox ( "You Don't Kill Zombies! -1 EXP", killer, 0, 0, 255 ) else outputChatBox ( "Error", killer, 0, 0, 255 ) end end ) Thank,Rbb27 Link to comment
SHC//Sniper Posted August 26, 2011 Share Posted August 26, 2011 Can you show us what /debugscript 3 says? Link to comment
rbb27 Posted August 26, 2011 Author Share Posted August 26, 2011 i have past the bad code. thank you anyway, but i have still error. Link to comment
rbb27 Posted August 26, 2011 Author Share Posted August 26, 2011 Nothing, Just One Error on one other script. Link to comment
rbb27 Posted August 26, 2011 Author Share Posted August 26, 2011 i Try That but still error =( function zkill() for i,v in pairs(getElementsByType("player")) do local playerTeam = getPlayerTeam(v) if ( playerTeam == Army) then setAccountData (v,"zombieKills",zombieKills+2) givePlayerMoney(v, math.random( 80, 110 ) ) elseif ( playerTeam == Scientific) then setAccountData (v,"zombieKills",zombieKills-1) outputChatBox ( "You Don't Kill Zombies! -1 EXP", v, 0, 0, 255 ) else outputChatBox ( "Error", v, 0, 0, 255 ) end end end addEventHandler("onZombieWasted", getRootElement(), zkill) Link to comment
SHC//Sniper Posted August 26, 2011 Share Posted August 26, 2011 Are you sure that 'Army' and 'Scientific' are declared somewhere? You should also check if the player is logged in. Ah and you can't use setAccountData with a player element. It must be: setAccountData (getPlayerAccount(v),"zombieKills",zombieKills+2) Also where is the 'zombieKills' variable declared? Link to comment
JR10 Posted August 26, 2011 Share Posted August 26, 2011 Don't double post, use the edit button. addEvent( "onZombieWasted" ) addEventHandler( "onZombieWasted", root, function ( killer ) local playerTeam = getPlayerTeam ( killer ) if ( playerTeam == Army) then local account = getPlayerAccount ( killer ) setAccountData (account,"zombieKills",getAccountData ( account , "zombiekills" ) + 2 ) givePlayerMoney( killer, math.random( 80, 110 ) ) elseif ( playerTeam == Scientific) then setAccountData (account,"zombieKills",getAccountData ( account , "zombiekills" )-1) outputChatBox ( "You Don't Kill Zombies! -1 EXP", killer, 0, 0, 255 ) else outputChatBox ( "Error", killer, 0, 0, 255 ) end end ) Link to comment
NotAvailable Posted August 26, 2011 Share Posted August 26, 2011 you forgot to declare them somewhere. Army = getTeamFromName("Army") Scientific = getTeamFromName("Scientific") Link to comment
rbb27 Posted August 26, 2011 Author Share Posted August 26, 2011 Work! Thank all for help me. 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