rbb27 Posted August 26, 2011 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
rbb27 Posted August 26, 2011 Author Posted August 26, 2011 i have past the bad code. thank you anyway, but i have still error.
rbb27 Posted August 26, 2011 Author Posted August 26, 2011 Nothing, Just One Error on one other script.
rbb27 Posted August 26, 2011 Author 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)
SHC//Sniper Posted August 26, 2011 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?
JR10 Posted August 26, 2011 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 )
NotAvailable Posted August 26, 2011 Posted August 26, 2011 you forgot to declare them somewhere. Army = getTeamFromName("Army") Scientific = getTeamFromName("Scientific")
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