DRW Posted May 8, 2015 Posted May 8, 2015 I'm making a kind of a stat upgrade system, I made an event that is supposed to give you 20 stat points to the Colt45 for example, cancel the event and output a chat message when you have the weapon stat upgraded to the max. The script gives 20 stat points and works perfectly: addEvent("addstat1",true) addEventHandler ("addstat1", root,function () setPedStat (source, 69, (getPedStat (source, 69)+20)) outputChatBox ("Has mejorado 2 puntos de Colt 45.",source,255,255,255) end) but when I try to cancel event when on max stats: addEvent("addstat1",true) addEventHandler ("addstat1", root,function () if getPedStat (source,69,1000) then outputChatBox ("NO PUEDES MEJORAR.",source,255,255,255) cancelEvent() else setPedStat (source, 69, (getPedStat (source, 69)+20)) outputChatBox ("Has mejorado 2 puntos de Colt 45.",source,255,255,255) end end) This one is not working. Proud owner and developer of ZNEXT: Aftermath. Enter a post-apocalyptic San Andreas and fight over 30 types of enemies and bosses with varying difficulties and skills, improve and customize your character by leveling up, completing challenges and a solid lootbox system with no Pay-to-Win mechanics that will break your experience. Meet new characters, creatures and weapon metas, experience an innovative combo-based melee system, or join our solid PvP modes to show other survivors who’s boss. Español, Pусский, Türk, عربى, Polski, Português IP: mtasa://104.36.110.227:22003 - Discord: https://discord.gg/CxMxjvC5pB
Walid Posted May 8, 2015 Posted May 8, 2015 use return Instead of cancelEvent() Do not yield your back to your enemy, might feel something strange in your ass. Two things are infinite the universe and human stupidity and i'm not sure about the universe. UF: IsTextInGridList | GetGridListRowIndexFromText | Table.removeValue | removeHex | dxDrawTriangle Skype: SaSuki102 | About Me | Youtube channel | Lua Tips & Tricks | Lua Strings | Lua Tables | Lua Operators
DRW Posted May 8, 2015 Author Posted May 8, 2015 use return Instead of cancelEvent() Not working. Proud owner and developer of ZNEXT: Aftermath. Enter a post-apocalyptic San Andreas and fight over 30 types of enemies and bosses with varying difficulties and skills, improve and customize your character by leveling up, completing challenges and a solid lootbox system with no Pay-to-Win mechanics that will break your experience. Meet new characters, creatures and weapon metas, experience an innovative combo-based melee system, or join our solid PvP modes to show other survivors who’s boss. Español, Pусский, Türk, عربى, Polski, Português IP: mtasa://104.36.110.227:22003 - Discord: https://discord.gg/CxMxjvC5pB
Walid Posted May 8, 2015 Posted May 8, 2015 use return Instead of cancelEvent() Not working. :3 i pretty sure that u didn't try it by yourself addEvent("addstat1",true) addEventHandler ("addstat1", root, function () local weaponState = getPedStat (source,69) if tonumber (weaponState) >= 1000 then outputChatBox ("NO PUEDES MEJORAR.",source,255,255,255) return end setPedStat (source, 69, tonumber(weaponState)+20) outputChatBox ("Has mejorado 2 puntos de Colt 45.",source,255,255,255) end) Do not yield your back to your enemy, might feel something strange in your ass. Two things are infinite the universe and human stupidity and i'm not sure about the universe. UF: IsTextInGridList | GetGridListRowIndexFromText | Table.removeValue | removeHex | dxDrawTriangle Skype: SaSuki102 | About Me | Youtube channel | Lua Tips & Tricks | Lua Strings | Lua Tables | Lua Operators
DRW Posted May 8, 2015 Author Posted May 8, 2015 use return Instead of cancelEvent() Not working. :3 i pretty sure that u didn't try it by yourself addEvent("addstat1",true) addEventHandler ("addstat1", root, function () local weaponState = getPedStat (source,69) if tonumber (weaponState) >= 1000 then outputChatBox ("NO PUEDES MEJORAR.",source,255,255,255) return end setPedStat (source, 69, tonumber(weaponState)+20) outputChatBox ("Has mejorado 2 puntos de Colt 45.",source,255,255,255) end) addEvent("addstat1",true) addEventHandler ("addstat1", root,function () if not (getPedStat (source,69,1000)) then setPedStat (source, 69, (getPedStat (source, 69)+20)) outputChatBox ("Has mejorado 2 puntos de Colt 45.",source,255,255,255) else outputChatBox ("NO PUEDES MEJORAR.",source,255,255,255) return end end) I did this, not working. You've done it way better, thank you so much, man Proud owner and developer of ZNEXT: Aftermath. Enter a post-apocalyptic San Andreas and fight over 30 types of enemies and bosses with varying difficulties and skills, improve and customize your character by leveling up, completing challenges and a solid lootbox system with no Pay-to-Win mechanics that will break your experience. Meet new characters, creatures and weapon metas, experience an innovative combo-based melee system, or join our solid PvP modes to show other survivors who’s boss. Español, Pусский, Türk, عربى, Polski, Português IP: mtasa://104.36.110.227:22003 - Discord: https://discord.gg/CxMxjvC5pB
Walid Posted May 8, 2015 Posted May 8, 2015 I did this, not working. You've done it way better, thank you so much, man You are welcome Do not yield your back to your enemy, might feel something strange in your ass. Two things are infinite the universe and human stupidity and i'm not sure about the universe. UF: IsTextInGridList | GetGridListRowIndexFromText | Table.removeValue | removeHex | dxDrawTriangle Skype: SaSuki102 | About Me | Youtube channel | Lua Tips & Tricks | Lua Strings | Lua Tables | Lua Operators
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