PicoPr0 Posted March 4, 2012 Share Posted March 4, 2012 (edited) lol Edited March 6, 2012 by Guest Link to comment
PicoPr0 Posted March 4, 2012 Author Share Posted March 4, 2012 I tested it but there was no response when I write /stats Link to comment
PicoPr0 Posted March 4, 2012 Author Share Posted March 4, 2012 Here is the meta "[GCC]Pico" type="script" name="stats system" /> Link to comment
Sparrow Posted March 4, 2012 Share Posted March 4, 2012 any errors on /debugscript 3? Link to comment
PicoPr0 Posted March 4, 2012 Author Share Posted March 4, 2012 It said statssystem/stats.lu:29 ? ^^ Link to comment
PicoPr0 Posted March 4, 2012 Author Share Posted March 4, 2012 Can someone help me How to reset stats ? Link to comment
sckatchof Posted March 4, 2012 Share Posted March 4, 2012 Server Side : addEventHandler("onPlayerLogin",getRootElement(), function () local account = getPlayerAccount(source) local kills = getAccountData(account,"kills") local deaths = getAccountData(account,"deaths") local headshots = getAccountData(account,"headshots") if not kills then setAccountData(account,"kills",0) end if not deaths then setAccountData(account,"deaths",0) end if not headshots then setAccountData(account,"headshots",0) end end) function updatePlayerStats(ammo, attacker, weapon, bodypart) local account = getPlayerAccount(attacker) if account then local kills = getAccountData(account,"kills") local headshots = getAccountData(account,"headshots") setAccountData(account,"kills",kills+1) if bodypart == 9 then setAccountData(account,"headshots",headshots+1) end end end if not attacker or attacker == source then return end local accountS = getPlayerAccount(source) if accountS then local deaths = getAccountData(accountS,"deaths") setAccountData(accountS,"deaths",deaths+1) end end addEventHandler("onPlayerWasted",getRootElement(),updatePlayerStats) function getPlayerStats(thePlayer) local account = getPlayerAccount(thePlayer) if account then local kills = getAccountData(account,"kills") or 0 local headshots = getAccountData(account,"headshots") or 0 local deaths = getAccountData(account,"deaths") or 0 local ratio = string.format("%.2f", kills / deaths) outputChatBox("[sTATS]".. getPlayerName(thePlayer) .."'s Stats: Kills: ".. tostring(kills) .." (".. tostring(headshots) .." Headshots), ".. tostring(deaths) .." Deaths, Ratio: ".. tostring(ratio).."", getRootElement(), 50, 255, 0) end end addCommandHandler("stats",getPlayerStats) addCommandHandler("st",getPlayerStats) Link to comment
PicoPr0 Posted March 4, 2012 Author Share Posted March 4, 2012 What ? Thats the same script I have. Link to comment
PicoPr0 Posted March 4, 2012 Author Share Posted March 4, 2012 Example write in chat /resetstats And U'r stats reset 0 Link to comment
PicoPr0 Posted March 4, 2012 Author Share Posted March 4, 2012 That is what I did function getPlayerStats(thePlayer) local account = getPlayerAccount(thePlayer) if account then local kills = getAccountData(account,"kills") or 0 local headshots = getAccountData(account,"headshots") or 0 local deaths = getAccountData(account,"deaths") or 0 local ratio = string.format("%.2f", kills / deaths) outputChatBox("[sTATS]".. getPlayerName(thePlayer) .."'s Stats: Kills: ".. tostring(kills) .." (".. tostring(headshots) .." Headshots), ".. tostring(deaths) .." Deaths, Ratio: ".. tostring(ratio).."", getRootElement(), 50, 255, 0) end end addCommandHandler("resetstats",getPlayerStats) Link to comment
sckatchof Posted March 4, 2012 Share Posted March 4, 2012 First don't Double Poster and what is your problem ? Link to comment
PicoPr0 Posted March 4, 2012 Author Share Posted March 4, 2012 The stats system works. Now i want when u write /cs (change stats) Your stats set to 0 - That is what I made. function getPlayerStats(thePlayer) local account = getPlayerAccount(thePlayer) if account then local kills = getAccountData(account,"kills") or 0 local headshots = getAccountData(account,"headshots") or 0 local deaths = getAccountData(account,"deaths") or 0 local ratio = string.format("%.2f", kills / deaths) outputChatBox("[sTATS]".. getPlayerName(thePlayer) .."'s Stats: Kills: ".. tostring(kills) .." (".. tostring(headshots) .." Headshots), ".. tostring(deaths) .." Deaths, Ratio: ".. tostring(ratio).."", getRootElement(), 50, 255, 0) end end addCommandHandler("cs",getPlayerStats) Link to comment
Castillo Posted March 4, 2012 Share Posted March 4, 2012 function setPlayerStats(thePlayer) local account = getPlayerAccount(thePlayer) if (account and not isGuestAccount(account)) then setAccountData(account,"kills",0) setAccountData(account,"headshots",0) setAccountData(account,"deaths",0) outputChatBox("[sTATS]".. getPlayerName(thePlayer) .."'s has resetted his/her stats to 0!", getRootElement(), 50, 255, 0) end end addCommandHandler("cs",setPlayerStats) 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