Jump to content

Vehicle scoring problem in tdma script


Recommended Posts

Hello. I have a problem with tdma script. Me and my friends are going to play tdma on lan tommorow, but the problem is with vehicles. When a vehicle explodes with players inside it, scores don't update. I tried to add few lines, but it doesn't change anything, despite there are no errors shown. Here is the script:

function xonPlayerWasted ( ammo, attacker, weapon, bodypart ) 
    if ( xonPlayerWasted_Enabled ) then 
        local vTeamID = getElementData ( source, "tdma.teamid" ) 
        local vTeam = gameTeams[vTeamID] 
        if not ( vTeam ) then 
            setTimer ( firstSpawn, 3000, 1, source, vTeam ) 
        else 
            local a = setTimer ( respawnThePlayer, 3000, 1, source, vTeam ) 
            if not ( a ) then 
                respawnThePlayer ( source, vTeam ) 
            end  
        end 
         
        if ( attacker ) then 
            local pTeamID = getElementData ( attacker, "tdma.teamid" ) 
            local pTeam = gameTeams[pTeamID] 
            --Was it a self kill? 
            if ( source ~= attacker and vTeamID ~= pTeamID  ) then 
                if ( pTeam ) then 
                    updateKills ( attacker, pTeam ) 
                end 
            end 
        end 
         
----THIS IS THE PART I ADDED----- 
        if ( weapon == 63 ) then 
            local TeamOne = gameTeams[1] 
            local TeamTwo = gameTeams[2] 
            outputChatBox ( "#FF0000First #FF0000part #FF0000works", getRootElement(), 255, 255, 255, true ) 
            if ( vTeamID == TeamOne ) then 
                updateKills ( teamTwo ) 
                outputChatBox ( "#FF0000Second #FF0000part #FF0000works", getRootElement(), 255, 255, 255, true ) 
            end 
            if ( vTeamID == TeamTwo ) then 
                updateKills ( teamOne ) 
                outputChatBox ( "#FF0000Second #FF0000part #FF0000works", getRootElement(), 255, 255, 255, true ) 
            end 
        end 
    end 
end 
addEventHandler ( "onPlayerWasted", root, xonPlayerWasted ) 

(I added these chat boxes just to test to see if it works)

Link to comment

Ok, so I tried and it doesn't work.I think the problem is somewhere with ( vTeamID == TeamOne) etc. I believe something else should be written. When I test it, I get the message in chat "First part works", but not "Second part works". I assume that means that everything works until the part with (vTeam == TeamOne) then...

Link to comment

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