Jump to content

Function problem


mtamaster97

Recommended Posts

Hello, I'm making simple cw script and I've defined T1Score and T2Score to " " empty i mean and now I make this function which is supose to add 1 point to team wether is 1 or 2 and its always executed else statement

I mean it outputs "Arguments allowed are: 1,2" but i type this "/ap 1" in ChatBox

function addPoint(thePlayer,command,Team) 
    if (Team == 1) then 
        T1Score = T1Score + 1 
    elseif (Team == 2) then 
        T2Score = T2Score + 1 
    else 
        display("Arguments allowed are: 1,2") 
    end 
end 
addCommandHandler("ap",addPoint)  

Link to comment

I fixed it already, sry, but now I have another problem I'm making cmd for changing names of T1 T2 on cw script that are display with function dxDrawColorText and when I use command like this "/tsn1 Test" it returns "nil" , here is the code:

function teamSetName1(thePlayer,command,Name1) 
    local team1x = tostring(Name1) 
    T1Name = team1x 
end 
addCommandHandler("tsn1",teamSetName1) 

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