Xeno Posted December 2, 2011 Share Posted December 2, 2011 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) Link to comment
Castillo Posted December 2, 2011 Share Posted December 2, 2011 Show us how do you use the checkOnDeath function. Link to comment
Xeno Posted December 2, 2011 Author Share Posted December 2, 2011 Show us how do you use the checkOnDeath function. That is the checkOnDeath function? I dont understand what you mean.. Link to comment
Castillo Posted December 2, 2011 Share Posted December 2, 2011 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) Link to comment
Aibo Posted December 2, 2011 Share Posted December 2, 2011 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? Link to comment
Xeno Posted December 2, 2011 Author Share Posted December 2, 2011 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. Link to comment
Castillo Posted December 2, 2011 Share Posted December 2, 2011 Can you explain me what are you trying to do? Link to comment
Xeno Posted December 2, 2011 Author Share Posted December 2, 2011 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) Link to comment
Castillo Posted December 2, 2011 Share Posted December 2, 2011 If you want to spawn the player who died back to his team location, then why do you check for kills? o_O. Link to comment
Xeno Posted December 2, 2011 Author Share Posted December 2, 2011 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. 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