^Dev-PoinT^ Posted November 26, 2011 Share Posted November 26, 2011 Hi all i made this but i want killer kill a player got 1 if he kill another player give second start ... 6 starts addEventHandler("onPlayerWasted", getRootElement(), function(ammo, killer, weapon, bodypart) if source then if (bodypart == 4) then outputChatBox("#Outch ! " ..getPlayerName(killer).. " has shot in your ass !", source, 255, 255, 0, true) elseif (bodypart == 9)then outputChatBox("#OWNED ! "..getPlayerName(killer).." has shot in your head !", source, 255, 255, 0, true) else outputChatBox(getPlayerName(killer).."# has kill you ! Now Kill him Noob -_-'", source, 255, 255, 0, true) end end end) addEventHandler("onPlayerWasted", getRootElement(), function(ammo, killer, weapon, bodypart) if killer then local stars = getPlayerWantedLevel(killer) setPlayerWantedLevel(killer, stars+1) else if WantedLevel = 1 then setPlayerWantedLevel(killer, stars+2) else if WantedLevel = 3 then setPlayerWantedLevel(killer, stars+3) outputChatBox(getPlayerName(killer) .. "Has Now 6 Wanted Start Watch out! ", 255, 255, 0, true) end end) sry for bad english Link to comment
12p Posted November 26, 2011 Share Posted November 26, 2011 Step 1: http://ajaxtrans.com/index.es.php Step 2: What is the error? Link to comment
^Dev-PoinT^ Posted November 26, 2011 Author Share Posted November 26, 2011 its say then expected near '=' Link to comment
CapY Posted November 26, 2011 Share Posted November 26, 2011 its say then expected near '=' else if WantedLevel = 1 then should be elseif WantedLevel == 1 then Link to comment
Aibo Posted November 26, 2011 Share Posted November 26, 2011 and it won't help, because this is another copypasted mess and WantedLevel isnt even defined. Link to comment
J.S. Posted November 26, 2011 Share Posted November 26, 2011 addEventHandler("onPlayerWasted", getRootElement(), function(ammo, killer, weapon, bodypart) if source then if (bodypart == 4) then outputChatBox("#Ouch ! " ..getPlayerName(killer).. " shot you in your ass!", source, 255, 255, 0, true) elseif (bodypart == 9)then outputChatBox("#OWNED ! "..getPlayerName(killer).." shot you in your head!", source, 255, 255, 0, true) else outputChatBox("# "..getPlayerName(killer).." killed you! Now kill him, noob! -_-'", source, 255, 255, 0, true) end end end) addEventHandler("onPlayerWasted", getRootElement(), function(ammo, killer, weapon, bodypart) if killer then local stars = getPlayerWantedLevel(killer) if stars == 0 then setPlayerWantedLevel(killer, stars+1) else if stars == 1 then setPlayerWantedLevel(killer, stars+2) else if stars == 3 then setPlayerWantedLevel(killer, stars+3) outputChatBox(getPlayerName(killer) .. " now has 6 wanted stars! Watch out!", 255, 255, 0, true) end end end) Fixed the whole thing (including the grammar), should work now Link to comment
^Dev-PoinT^ Posted November 26, 2011 Author Share Posted November 26, 2011 unexpected symbol near '>' Link to comment
^Dev-PoinT^ Posted November 26, 2011 Author Share Posted November 26, 2011 i fix it thank you Capy i shuold learn from the first lua scripting Link to comment
Castillo Posted November 26, 2011 Share Posted November 26, 2011 (edited) addEventHandler("onPlayerWasted", getRootElement(), function(ammo, killer, weapon, bodypart) if (killer) then if (bodypart == 4) then outputChatBox("#Ouch ! " ..getPlayerName(killer).. " shot you in your ass!", source, 255, 255, 0, true) elseif (bodypart == 9)then outputChatBox("#OWNED ! "..getPlayerName(killer).." shot you in your head!", source, 255, 255, 0, true) else outputChatBox("# "..getPlayerName(killer).." killed you! Now kill him, noob! -_-'", source, 255, 255, 0, true) end if (killer ~= source) then local stars = getPlayerWantedLevel(killer) if (stars == 0) then setPlayerWantedLevel(killer, stars+1) elseif (stars == 1) then setPlayerWantedLevel(killer, stars+2) elseif (stars == 3) then setPlayerWantedLevel(killer, stars+3) outputChatBox(getPlayerName(killer) .. " now has 6 wanted stars! Watch out!", 255, 255, 0, true) end end end end) Edited November 27, 2011 by Guest Link to comment
J.S. Posted November 27, 2011 Share Posted November 27, 2011 Aha, smart thinking Castillo. I don't know why I didn't think of that. Link to comment
Aibo Posted November 27, 2011 Share Posted November 27, 2011 "if (source) then" -- is useless and wrong. source always exists, or there wouldnt be an event otherwise. you need to check if killer exists, because if it's not, getPlayerName(killer) will cause an error. addEventHandler("onPlayerWasted", root, function(ammo, killer, weapon, bodypart) if (killer) then if (bodypart == 4) then outputChatBox("#Ouch ! " ..getPlayerName(killer).. " shot you in your ass!", source, 255, 255, 0, true) elseif (bodypart == 9) then outputChatBox("#OWNED ! "..getPlayerName(killer).." shot you in your head!", source, 255, 255, 0, true) else outputChatBox("# "..getPlayerName(killer).." killed you! Now kill him, noob! -_-'", source, 255, 255, 0, true) end if (killer ~= source) then local stars = getPlayerWantedLevel(killer) if (stars == 0) then setPlayerWantedLevel(killer, stars+1) elseif (stars == 1) then setPlayerWantedLevel(killer, stars+2) elseif (stars == 3) then setPlayerWantedLevel(killer, stars+3) outputChatBox(getPlayerName(killer) .. " now has 6 wanted stars! Watch out!", 255, 255, 0, true) end end end end) Link to comment
^Dev-PoinT^ Posted November 27, 2011 Author Share Posted November 27, 2011 ok Thx Very Mutch Aibo thx to every one who helped me Topic Closed 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