mtamaster97 Posted January 20, 2015 Share Posted January 20, 2015 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
TAPL Posted January 20, 2015 Share Posted January 20, 2015 Because Team not a number but string, therefore you need to put quotation like "1" or use tonumber for Team variable. Link to comment
mtamaster97 Posted January 20, 2015 Author Share Posted January 20, 2015 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
TAPL Posted January 20, 2015 Share Posted January 20, 2015 Was this client or server? Link to comment
mtamaster97 Posted January 25, 2015 Author Share Posted January 25, 2015 Client, why? Link to comment
Blinker. Posted January 25, 2015 Share Posted January 25, 2015 function teamSetName1(command,Name1) local team1x = tostring(Name1) T1Name = team1x end addCommandHandler("tsn1",teamSetName1) 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