iPrestege Posted July 12, 2013 Share Posted July 12, 2013 function equi ( ) setPedStat ( source, 75, 500 ) end addEventHandler ( "onPlayerJoin", root, equi ) addEvent ( "onZombieWasted",true ) addEventHandler ( "onZombieWasted", root, function ( killer ) if ( killer and getElementType ( killer ) == "player" ) then local current = getPedStat ( killer, 75 ) setPedStat ( killer, 75, ( current + 100 ) ) end end ) Link to comment
MOHAKO Posted July 12, 2013 Share Posted July 12, 2013 function equi() setPedStat(source, 75, 500) end addEventHandler("onPlayerJoin", root, equi) function playerDeath(ammo, killer) if (killer) then if (getElementType(killer) == "player") then local old = getPedStat(killer, 75) local new = oldstat + 100 setPedStat(killer, 75, new) end end end addEventHandler("onPlayerWasted", root, playerDeath) Try this... oldstat = ? Ups... At the first I wrote "oldstat" and "newstat", but then rewrote them to "old" and "new". Sorry my fault, it's supposed to be "old" (oldstat -> old). It doesn't work. addEventHandler ( "onZombieWasted", root, function ( _, killer ) if ( killer and getElementType ( killer ) == "player" ) then local current = getPedStat ( killer, 75 ) setPedStat ( killer, 75, ( current + 100 ) ) end end ) addEvent ("onZombieWasted" addEventHandler ( "onZombieWasted", root, function ( _, killer ) if ( killer and getElementType ( killer ) == "player" ) then local current = getPedStat ( killer, 75 ) setPedStat ( killer, 75, ( current + 100 ) ) end end ) addEvent ("onZombieWasted", true) Link to comment
iPrestege Posted July 12, 2013 Share Posted July 12, 2013 function equi() setPedStat(source, 75, 500) end addEventHandler("onPlayerJoin", root, equi) function playerDeath(ammo, killer) if (killer) then if (getElementType(killer) == "player") then local old = getPedStat(killer, 75) local new = oldstat + 100 setPedStat(killer, 75, new) end end end addEventHandler("onPlayerWasted", root, playerDeath) Try this... oldstat = ? Ups... At the first I wrote "oldstat" and "newstat", but then rewrote them to "old" and "new". Sorry my fault, it's supposed to be "old" (oldstat -> old). It doesn't work. addEventHandler ( "onZombieWasted", root, function ( _, killer ) if ( killer and getElementType ( killer ) == "player" ) then local current = getPedStat ( killer, 75 ) setPedStat ( killer, 75, ( current + 100 ) ) end end ) addEvent ("onZombieWasted" addEventHandler ( "onZombieWasted", root, function ( _, killer ) if ( killer and getElementType ( killer ) == "player" ) then local current = getPedStat ( killer, 75 ) setPedStat ( killer, 75, ( current + 100 ) ) end end ) addEvent ("onZombieWasted", true) the attacker is the first parameter! Link to comment
GamerDeMTA Posted July 12, 2013 Author Share Posted July 12, 2013 function equi ( ) setPedStat ( source, 75, 500 ) end addEventHandler ( "onPlayerJoin", root, equi ) addEvent ( "onZombieWasted",true ) addEventHandler ( "onZombieWasted", root, function ( killer ) if ( killer and getElementType ( killer ) == "player" ) then local current = getPedStat ( killer, 75 ) setPedStat ( killer, 75, ( current + 100 ) ) end end ) It says error in the getElementType Link to comment
Castillo Posted July 12, 2013 Share Posted July 12, 2013 function equi ( ) setPedStat ( source, 75, 500 ) end addEventHandler ( "onPlayerJoin", root, equi ) addEvent ( "onZombieWasted",true ) addEventHandler ( "onZombieWasted", root, function ( killer ) if ( isElement ( killer ) and getElementType ( killer ) == "player" ) then local current = getPedStat ( killer, 75 ) setPedStat ( killer, 75, ( current + 100 ) ) end end ) Link to comment
GamerDeMTA Posted July 12, 2013 Author Share Posted July 12, 2013 Thanks but it doesn't work I think. Or is it my fault? function equi ( ) setPedStat ( source, 75, 500 ) end addEventHandler ( "onPlayerJoin", root, equi ) addEvent ( "onZombieWasted",true ) addEventHandler ( "onZombieWasted", root, function ( killer ) if ( isElement ( killer ) and getElementType ( killer ) == "player" ) then local current = getPedStat ( killer, 75 ) setPedStat ( killer, 75, ( current + 1000 ) ) end end ) I put +1000 for get double weapon in Uzi Dual wield capability (At stat level 1000, you receive a 2nd gun and dual wield is enabled) But I haven't double Uzi. Is it wrong? Link to comment
PaiN^ Posted July 12, 2013 Share Posted July 12, 2013 the new value of the stat (0..999) Link to comment
GamerDeMTA Posted July 12, 2013 Author Share Posted July 12, 2013 then how to do that it gives u 1000? Dual weapon Link to comment
PaiN^ Posted July 12, 2013 Share Posted July 12, 2013 function equi ( ) setPedStat( source, 75, 500 ) end addEventHandler( "onPlayerJoin", root, equi ) addEvent( "onZombieWasted",true ) addEventHandler( "onZombieWasted", root, function( killer ) if isElement( killer ) and getElementType( killer ) == "player" then setPedStat ( killer, 75, 999 ) end end ) And if it didn't work replace "999" with "1000" . Link to comment
GamerDeMTA Posted July 12, 2013 Author Share Posted July 12, 2013 It didn't work addEvent ( "onZombieWasted",true ) addEventHandler ( "onZombieWasted", root, function ( killer ) if ( isElement ( killer ) and getElementType ( killer ) == "player" ) then local current = getPedStat ( killer, 75 ) setPedStat ( killer, 75, ( current + 999 ) ) end end ) Link to comment
PaiN^ Posted July 12, 2013 Share Posted July 12, 2013 copy my code, I don't have getPedStat in mine ! Link to comment
GamerDeMTA Posted July 12, 2013 Author Share Posted July 12, 2013 copy my code, I don't have getPedStat in mine ! But I want to do that when you kill a zombie you get +999 in your weapon. so i put current + 999 but it didnt work i havent double Uzi Link to comment
PaiN^ Posted July 12, 2013 Share Posted July 12, 2013 In your code, when the player join the stat will be set to 500, and when he kills a zombie, If you but "current + 999" then it will be 500 + 900 = 1400, which is not allowed ! So if you want to set it to 1000, just but 1000 in it ( i told that in my replay ! ) . Link to comment
GamerDeMTA Posted July 12, 2013 Author Share Posted July 12, 2013 function equi ( ) setPedStat ( source, 75, 0 ) end addEventHandler ( "onPlayerJoin", root, equi ) addEvent ( "onZombieWasted",true ) addEventHandler ( "onZombieWasted", root, function ( killer ) if ( isElement ( killer ) and getElementType ( killer ) == "player" ) then local current = getPedStat ( killer, 75 ) setPedStat ( killer, 75, ( current + 999 ) ) end end ) this will work? Link to comment
PaiN^ Posted July 12, 2013 Share Posted July 12, 2013 This will make the first part of the script useless, Just use my code above ^ Link to comment
GamerDeMTA Posted July 12, 2013 Author Share Posted July 12, 2013 thanks. oh u know the "symbol" for make a thing when it's less than? I think it's this am I wrong? if ... =< Is it? Link to comment
GamerDeMTA Posted July 12, 2013 Author Share Posted July 12, 2013 isn't that?? Oh and now it works, but i need something when I die and spawn again I havent the Stats How to save them for when u spawn? Link to comment
MIKI785 Posted July 12, 2013 Share Posted July 12, 2013 thanks. oh u know the "symbol" for make a thing when it's less than? I think it's this am I wrong? if ... =< Is it? That's equal or less than. less than is < itself Link to comment
denny199 Posted July 12, 2013 Share Posted July 12, 2013 >= means greater than or equal to > means greater than <= means less than or equal to < means less than == means equal to ~= means not equal to I have learned this the first year of primary school, so you need to know it too. 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