Jump to content

what is the problem here


[UCG]Mike

Recommended Posts

Posted

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 !!!

Posted
  
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.

Posted
  
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

9hjKOxv.png

any fix here ?

You are now in Mark Zone !!!

Posted

--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

Posted
--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 !!!

Posted
--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.

Posted

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

Posted (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 by Guest

Previously known as MrTasty.

Posted

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.

Posted
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 !!!

Posted
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 :D??

You are now in Mark Zone !!!

Posted
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) 

CiTLh.png
Posted
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 !!!

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...