Jump to content

Who can fix this script? (Please) [SOLVED]


KiffShark

Recommended Posts

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 by Guest
Link to comment

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

Thanks to both!

solved! :D

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?" xD

Thanks, it's solved :)

I'll add new topics in the future for more scripts haha I hope not be a bother :P

Sorry for my english.

Kiff.

Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...