mremin Posted January 9, 2011 Share Posted January 9, 2011 function stats(psource,cname,tplayer) if not getPlayerFromName(tplayer) then tplayer = psource else tplayer = getPlayerFromName(tplayer) end achUnlockedNumber(tplayer) local serial = getPlayerSerial(tplayer) local RaceAttempts = executeSQLSelect ( "RaceAttempts", "RaceAttempts","serial = '" .. serial .. "'") local DDAttempts = executeSQLSelect ("DDDM","DDAttempts","serial = '" .. serial .. "'") local DDWins =executeSQLSelect ( "DDDM", "DDWins","serial = '" .. serial .. "'") local Wins1 = executeSQLSelect ( "RaceWins", "RaceWins","serial = '" .. serial .. "'") local Money = executeSQLSelect ( "MoneyB", "Money","serial = '" .. serial .. "'") local MoneyB = executeSQLSelect ( "MoneyB", "B","serial = '" .. serial .. "'") if tonumber(RaceAttempts[1]['RaceAttempts']) == 0 then ratio = 0 else ratio = (tonumber(Wins1[1]['RaceWins'])/tonumber(RaceAttempts[1]['RaceAttempts']))*100 end if tonumber(DDAttempts[1]['DDAttempts']) == 0 then rratio = 0 else rratio = (tonumber(DDWins[1]['DDWins'])/tonumber(DDAttempts[1]['DDAttempts']))*100 end outputChatBox(getPlayerName(tplayer).."'s Stats: Attempted: "..RaceAttempts[1]['RaceAttempts'].." races, "..DDAttempts[1]['DDAttempts'] .." DDs. Won: "..Wins1[1]['RaceWins'].." races("..ratio.."%), "..DDWins[1]['DDWins'].." DDs("..rratio.."%). Cash: $"..Money[1]['Money'].. " Unlocked "..getElementData(tplayer,"data.Achnum").."/9 Achievements("..MoneyB[1]['B'].."B)",root,173,218,068) end addCommandHandler("stats",stats) addCommandHandler("st",stats) I see only own stats.How can I do /stats name command. I'm sorry English is bad Link to comment
mremin Posted January 9, 2011 Author Share Posted January 9, 2011 WARNING: race_starter_pack\server.lua:145: Bad argument @ 'getPlayerFromName' 145 if not getPlayerFromName(tplayer) then tplayer = psource else tplayer = getPlayerFromName(tplayer) end Link to comment
TheGhost Posted January 10, 2011 Share Posted January 10, 2011 Im pretty sure u should not have "else tplayer = getPlayerFromName(tplayer)" because it will cause confusion. Maybe change tplayer to "else thisplayer = getPlayerFromName(tplayer)" or some other variable other than tplayer then it wouldnt get confused/errored 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