KiffShark Posted October 25, 2012 Share Posted October 25, 2012 (edited) Hi everyone, I'm from Spain so I don't speak english very good but I think that you will be able to understand me I need somebody to fix this script: (I have delete the text from outputchatbox) function robar ( attacker, attackerweapon, bodypart, loss ) local playerTeam = getPlayerTeam ( source ) if no ( playerTeam ) and(attackerweapon == 0) then givePlayerMoney ( attacker, 15 ) takePlayerMoney ( source, 15 ) outputChatBox ( "-", attacker, 255, 0, 0 ) outputChatBox ( "-", attacker, 255, 0, 0 ) outputChatBox ( "-", source, 255, 0, 0 ) else cancelEvent() end end end addEventHandler ("onPlayerDamage", getRootElement(), robar) addCommandHandler("adminrobar",robar) the console says: WARNING: psg\steal.server.lua:98: Bad argument @ 'addEventHandler' [Expected function at argument 3, got nil]WARNING: psg\steal.server.lua:99: Bad argument @ 'addCommandHandler' [Expected function at argument 2, got nil] the lines there are: addEventHandler ("onPlayerDamage", getRootElement(), robar) addCommandHandler("robar",robar) waht is wrong? the function? Thanks! Kiff Edited November 20, 2012 by Guest Link to comment
Bober Posted October 25, 2012 Share Posted October 25, 2012 check this: function robar ( attacker, attackerweapon, bodypart, loss ) local playerTeam = getPlayerTeam ( source ) if not ( playerTeam ) and(attackerweapon == 0) then givePlayerMoney ( attacker, 15 ) takePlayerMoney ( source, 15 ) outputChatBox ( "-", attacker, 255, 0, 0 ) outputChatBox ( "-", attacker, 255, 0, 0 ) outputChatBox ( "-", source, 255, 0, 0 ) else cancelEvent() end end addEventHandler ("onPlayerDamage", getRootElement(), robar) addCommandHandler("adminrobar",robar) Link to comment
Renkon Posted October 25, 2012 Share Posted October 25, 2012 There was one more end than what you had to. Remove one from the last two --es: Has agregado un end de más Link to comment
KiffShark Posted October 25, 2012 Author Share Posted October 25, 2012 Thanks to both! solved! the command doesn't work but it's ok, I think it's because of when I type the command there isn't attacker and attacked players so "wtF?" Thanks, it's solved I'll add new topics in the future for more scripts haha I hope not be a bother Sorry for my english. Kiff. 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