[UCG]Mike Posted August 3, 2014 Posted August 3, 2014 what is the problem here ??? exports.scoreboard:addScoreboardColumn('Score') addEventHandler("onPlayerWasted", root, function(attacker,attackerweapon) if (getElementData(attacker, "Score") == false) or (getElementData(attacker, "Score") == nil) then setElementData(attacker, "Score", 1) setElementData(source, "Score", -1) else setElementData( attacker, "Score", getElementData(attacker,"Score")+1) setElementData( source, "Score", getElementData(source,"Score")-1) end ) You are now in Mark Zone !!!
Addlibs Posted August 3, 2014 Posted August 3, 2014 exports.scoreboard:addScoreboardColumn('Score') addEventHandler("onPlayerWasted", root, function(attacker,attackerweapon) local sScore = getElementData(source, "Score") or 0 local aScore = getElementData(attacker, "Score") or 0 setElementData(source, "Score", sScore-1) setElementData(attacker, "Score", aScore+1) end) Previously known as MrTasty.
[UCG]Mike Posted August 3, 2014 Author Posted August 3, 2014 exports.scoreboard:addScoreboardColumn('Score') addEventHandler("onPlayerWasted", root, function(attacker,attackerweapon) local sScore = getElementData(source, "Score") or 0 local aScore = getElementData(attacker, "Score") or 0 setElementData(source, "Score", sScore-1) setElementData(attacker, "Score", aScore+1) end) ty but see this errors any fix here ? You are now in Mark Zone !!!
Et-win Posted August 3, 2014 Posted August 3, 2014 Why making 2 topics? Your script already has been fixed by me on your other one. viewtopic.php?f=108&t=78639 Learn to be patient. ~Scripts~ Clan War System V1.2.0 ~Maps~ [DM]Et-win - The Run [FUN]Et-win - Drift Rocket [FUN]Et-win - Drift Rocket // [DD]Et-win - Cross 3xC
Addlibs Posted August 3, 2014 Posted August 3, 2014 addEventHandler("onPlayerWasted", root, function(ammo,attacker,attackerweapon) Previously known as MrTasty.
[UCG]Mike Posted August 3, 2014 Author Posted August 3, 2014 addEventHandler("onPlayerWasted", root, function(ammo,attacker,attackerweapon) errors dont fixed You are now in Mark Zone !!!
Max+ Posted August 3, 2014 Posted August 3, 2014 --ServerSide exports.scoreboard:addScoreboardColumn('Score') addEventHandler ( 'onPlayerWasted', root, function ( attacker ) if ( attacker ) and ( attacker ~= source ) then local sScore = getElementData(source, 'Score') or 0 local aScore = getElementData(attacker, 'Score') or 0 setElementData(source, 'Score', sScore -1) setElementData(attacker, 'Score', aScore +1) end end ) - New , Kill System - New, GameMode Intro - Leve / Exp System - New nametag showing style - New , Hud For Players - Skin Selection from SA-MP - Money System / Buy Weapons - Drop Weapons - New, Flood System - New , Group Assign - Gun license For Weapons - Random Rule System For Money
[UCG]Mike Posted August 3, 2014 Author Posted August 3, 2014 --ServerSide exports.scoreboard:addScoreboardColumn('Score') addEventHandler ( 'onPlayerWasted', root, function ( attacker ) if ( attacker ) and ( attacker ~= source ) then local sScore = getElementData(source, 'Score') or 0 local aScore = getElementData(attacker, 'Score') or 0 setElementData(source, 'Score', sScore -1) setElementData(attacker, 'Score', aScore +1) end end ) WARNING: Score\server.lua:8: Bad argument @ 'setElementData' [Expected element at argument 1, got number '1'] You are now in Mark Zone !!!
Addlibs Posted August 3, 2014 Posted August 3, 2014 --ServerSide exports.scoreboard:addScoreboardColumn('Score') addEventHandler ( 'onPlayerWasted', root, function ( attacker ) if ( attacker ) and ( attacker ~= source ) then local sScore = getElementData(source, 'Score') or 0 local aScore = getElementData(attacker, 'Score') or 0 setElementData(source, 'Score', sScore -1) setElementData(attacker, 'Score', aScore +1) end end ) Wrong - first parameter of onPlayerWasted is the totalAmmo (int) - Thats why line 8 says it gets an integer '1' instead of the attacker. Line 3: Change function ( attacker ) to function ( ammo, attacker ) Previously known as MrTasty.
Max+ Posted August 3, 2014 Posted August 3, 2014 there is not point of adding ammo to the script Change it to function ( _, attacker ) - New , Kill System - New, GameMode Intro - Leve / Exp System - New nametag showing style - New , Hud For Players - Skin Selection from SA-MP - Money System / Buy Weapons - Drop Weapons - New, Flood System - New , Group Assign - Gun license For Weapons - Random Rule System For Money
Addlibs Posted August 3, 2014 Posted August 3, 2014 It doesn't actually matter, does it? Previously known as MrTasty.
Et-win Posted August 3, 2014 Posted August 3, 2014 I just wanted to ask, whenever you put ammo on 'ammo', 'ajfhjdfhjjhkgf' or '_', it's all the same? ~Scripts~ Clan War System V1.2.0 ~Maps~ [DM]Et-win - The Run [FUN]Et-win - Drift Rocket [FUN]Et-win - Drift Rocket // [DD]Et-win - Cross 3xC
Addlibs Posted August 3, 2014 Posted August 3, 2014 (edited) Just defines the variable you'd use, if you put 'HelloWorld', You'd have to use outputChatBox(HelloWorld) to get it to output whatever was in the place of the parameter... eg: --Version 1: addEventHandler("onPlayerWasted", root, function(ammo) outptuChatBox("Ammo: "..ammo, root, 255, 255, 255, false) end) --Version 2: addEventHandler("onPlayerWasted", root, function(HelloWorld) outptuChatBox("Ammo: "..HelloWorld, root, 255, 255, 255, false) end) --They work exactly the same Edited August 3, 2014 by Guest Previously known as MrTasty.
Et-win Posted August 3, 2014 Posted August 3, 2014 I know, but he says "there is not point of adding ammo to the script". So, why does changing 'ammo' to '_' in the function matter? I would think it doesn't matter a thing, because '_' is a variable now too? ~Scripts~ Clan War System V1.2.0 ~Maps~ [DM]Et-win - The Run [FUN]Et-win - Drift Rocket [FUN]Et-win - Drift Rocket // [DD]Et-win - Cross 3xC
Addlibs Posted August 3, 2014 Posted August 3, 2014 Yeah, that's what I think - maybe it's just for the purpose of "ignoring" it, cause if you don't see what is the actual variable about, you won't use it (?) Previously known as MrTasty.
Et-win Posted August 3, 2014 Posted August 3, 2014 Alright, thanks ~Scripts~ Clan War System V1.2.0 ~Maps~ [DM]Et-win - The Run [FUN]Et-win - Drift Rocket [FUN]Et-win - Drift Rocket // [DD]Et-win - Cross 3xC
[UCG]Mike Posted August 3, 2014 Author Posted August 3, 2014 exports.scoreboard:addScoreboardColumn('Score') addEventHandler ( 'onPlayerWasted', root, function ( attacker ) if ( attacker ) and ( attacker ~= source ) then local sScore = getElementData(source, 'Score') or 0 local aScore = getElementData(attacker, 'Score') or 0 setElementData(source, 'Score', sScore -1) setElementData(attacker, 'Score', aScore +1) end end ) function myscore ( thePlayer ) outputChatBox("Your score is"..getElementData..(source, 'Score'), thePlayer, 0, 255, 0) end addCommandHandler("myscore", myscore) any fix plzz You are now in Mark Zone !!!
Et-win Posted August 3, 2014 Posted August 3, 2014 tostring() getElementData will return a number, use tostring on it. ~Scripts~ Clan War System V1.2.0 ~Maps~ [DM]Et-win - The Run [FUN]Et-win - Drift Rocket [FUN]Et-win - Drift Rocket // [DD]Et-win - Cross 3xC
[UCG]Mike Posted August 3, 2014 Author Posted August 3, 2014 tostring() getElementData will return a number, use tostring on it. im not a scripter if you can fix it You are now in Mark Zone !!!
Et-win Posted August 3, 2014 Posted August 3, 2014 So... Then learn... tostring(getElementData(yourstuff)) ~Scripts~ Clan War System V1.2.0 ~Maps~ [DM]Et-win - The Run [FUN]Et-win - Drift Rocket [FUN]Et-win - Drift Rocket // [DD]Et-win - Cross 3xC
[UCG]Mike Posted August 4, 2014 Author Posted August 4, 2014 exports.scoreboard:addScoreboardColumn('Score') addEventHandler ( 'onPlayerWasted', root, function ( attacker ) if ( attacker ) and ( attacker ~= source ) then local sScore = getElementData(source, 'Score') or 0 local aScore = getElementData(attacker, 'Score') or 0 setElementData(source, 'Score', sScore -1) setElementData(attacker, 'Score', aScore +1) end end ) function myscore ( thePlayer ) outputChatBox("Your score is" tostring(getElementData('Score')), thePlayer, 0, 255, 0) end addCommandHandler("myscore", myscore) Right ?? You are now in Mark Zone !!!
TAPL Posted August 4, 2014 Posted August 4, 2014 exports.scoreboard:addScoreboardColumn("Score") addEventHandler("onPlayerWasted", root, function(_, attacker) if (attacker and getElementType(attacker) == "player") and (attacker ~= source) then local sScore = getElementData(source, "Score") or 0 local aScore = getElementData(attacker, "Score") or 0 setElementData(source, "Score", sScore-1) setElementData(attacker, "Score", aScore+1) end end) function myscore(player) local MyScore = getElementData(player, "Score") or 0 outputChatBox("Your score is "..tostring(MyScore), player, 0, 255, 0) end addCommandHandler("myscore", myscore)
[UCG]Mike Posted August 4, 2014 Author Posted August 4, 2014 exports.scoreboard:addScoreboardColumn("Score") addEventHandler("onPlayerWasted", root, function(_, attacker) if (attacker and getElementType(attacker) == "player") and (attacker ~= source) then local sScore = getElementData(source, "Score") or 0 local aScore = getElementData(attacker, "Score") or 0 setElementData(source, "Score", sScore-1) setElementData(attacker, "Score", aScore+1) end end) function myscore(player) local MyScore = getElementData(player, "Score") or 0 outputChatBox("Your score is "..tostring(MyScore), player, 0, 255, 0) end addCommandHandler("myscore", myscore) ty bro its fixed now You are now in Mark Zone !!!
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