Jump to content

Bad Argument


Xeno

Recommended Posts

Posted

I get a bad arguement on the getElementData... It should work so im confused... Here is the code.

function checkOnDeath(player, killer) 
if (player and getElementType(player) == "player") then 
    local kills = tonumber(getElementData(player,"Zombie kills")) 
    if (not kills) then setElementData(player, "Zombie kills", 0) kills = 0 end 
    if (kills <= 24) then 
    spawnPlayer ( player, 839, -1375, -0.3, 90.0, 0 ) 
    elseif (kills >= 25 and kills <= 49) then 
    elseif (kills >= 35 and kills <=49) then 
  
    elseif (kills >= 50 and kills <=149) then 
  
    elseif (kills >= 150 and kills <=349) then 
        
 elseif (kills >= 350 and kills <=499) then 
    
      elseif (kills >= 500 and kills <=899) then 
  
      elseif (kills >= 900 ) then 
  
   end 
    end 
end 
  
  
addEventHandler("onPlayerWasted", root, checkOnDeath) 
  
  

Posted

Show us how do you use the checkOnDeath function.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted
Show us how do you use the checkOnDeath function.

That is the checkOnDeath function? I dont understand what you mean..

Posted

My bad, I didn't see the event handler, anyway, you're doing it wrong.

function checkOnDeath(ammo, killer) 
if (killer and getElementType(killer) == "player" and killer ~= source) then 
    local kills = tonumber(getElementData(killer,"Zombie kills")) 
    if (not kills) then setElementData(killer, "Zombie kills", 0) kills = 0 end 
    if (kills <= 24) then 
    spawnPlayer ( killer, 839, -1375, -0.3, 90.0, 0 ) 
    elseif (kills >= 25 and kills <= 49) then 
    elseif (kills >= 35 and kills <=49) then 
  
    elseif (kills >= 50 and kills <=149) then 
  
    elseif (kills >= 150 and kills <=349) then 
        
 elseif (kills >= 350 and kills <=499) then 
    
      elseif (kills >= 500 and kills <=899) then 
  
      elseif (kills >= 900 ) then 
  
   end 
    end 
end 
addEventHandler("onPlayerWasted", root, checkOnDeath) 

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

first argument in onPlayerWasted event handler is not a player element, its total ammo integer.

wasted player is the source of the event.

also i think you should look into onPedWasted event instead.

right now this makes no sense, spawnPlayer(killer)? what?

?

Posted
My bad, I didn't see the event handler, anyway, you're doing it wrong.
function checkOnDeath(ammo, killer) 
if (killer and getElementType(killer) == "player" and killer ~= source) then 
    local kills = tonumber(getElementData(killer,"Zombie kills")) 
    if (not kills) then setElementData(killer, "Zombie kills", 0) kills = 0 end 
    if (kills <= 24) then 
    spawnPlayer ( killer, 839, -1375, -0.3, 90.0, 0 ) 
    elseif (kills >= 25 and kills <= 49) then 
    elseif (kills >= 35 and kills <=49) then 
  
    elseif (kills >= 50 and kills <=149) then 
  
    elseif (kills >= 150 and kills <=349) then 
        
 elseif (kills >= 350 and kills <=499) then 
    
      elseif (kills >= 500 and kills <=899) then 
  
      elseif (kills >= 900 ) then 
  
   end 
    end 
end 
addEventHandler("onPlayerWasted", root, checkOnDeath) 

Yeah, this doesnt work, I dont get any errors.

Posted

Can you explain me what are you trying to do?

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted
Can you explain me what are you trying to do?

I'm trying to make it so it sets a certain spawn area for each team, i did try another script too do it, but I thought this would be easier, I guess not...

function setTeamOnDeath() 
local team = getTeamFromName("Clan1")  
if ( team) then 
spawnPlayer... ect 
end 
addEventHandler("onPlayerWasted", root, setTeamOnDeath) 

Posted

If you want to spawn the player who died back to his team location, then why do you check for kills? o_O.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted
If you want to spawn the player who died back to his team location, then why do you check for kills? o_O.

I used the function I did before, didn't think really.

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...