Likes: 0
Results 1 to 5 of 5
Thread: Players PvP Stats
-
09-06-10, 03:30 PM #1
Players PvP Stats
Register to remove this adI was experimenting with LUA tables and eventually wrote a lua script that stored stats, and displayed stats when requested.
Type #Stats
Typing that will display your kills your deaths and you K/D Ratio
This works well on PvP servers where people are curious on how well they are doing.
Code:TEST_Death = {} TEST_Kill = {} TEST_KD = {} TEST_NAME = {} local KDMessage = "#stats" function KillDeath_OnChat(event, plr, message, type, language) if (message == KDMessage) and (TEST_Death[plr:GetName()] == nil) and (TEST_Kill[plr:GetName()] == nil) then TEST_Death[plr:GetName()] = 0 TEST_Kill[plr:GetName()] = 0 end if (message == KDMessage) and (TEST_Kill[plr:GetName()] == nil) then TEST_Kill[plr:GetName()] = 0 end if (message == KDMessage) and (TEST_Death[plr:GetName()] == nil) then TEST_Death[plr:GetName()] = 0 end if (message == KDMessage) then TEST_NAME[plr:GetName()] = plr:GetName() plr:SendBroadcastMessage("|cFF0000FF Stats since last server restart") plr:SendBroadcastMessage("|cFFFF0000 "..TEST_NAME[plr:GetName()].." Stats") plr:SendBroadcastMessage("|cFFFFFF00 Kills: "..TEST_Kill[plr:GetName()].."") plr:SendBroadcastMessage("|cFFFFFF00 Deaths: "..TEST_Death[plr:GetName()].."") TEST_KD[plr:GetName()] = TEST_Kill[plr:GetName()] / TEST_Death[plr:GetName()] if (TEST_Death[plr:GetName()] == 0) and (TEST_Kill[plr:GetName()] == 0) then TEST_KD[plr:GetName()] = 0 end plr:SendBroadcastMessage("|cFFFFFF00 Kills to deaths ratio: "..TEST_KD[plr:GetName()].."") end end function TEST_Death.OnKillPlayer(event, pPlayer) TEST_Death[pPlayer:GetName()] = TEST_Death[pPlayer:GetName()] or 0 --assigns the variable to 0 if one doesn't exist TEST_Death[pPlayer:GetName()] = TEST_Death[pPlayer:GetName()] + 1 pPlayer:SendBroadcastMessage("|cFFADD8E6 You have died "..TEST_Death[pPlayer:GetName()].." times since the server restarted.") end function TEST_Kill.OnKillPlayer2(event, pPlayer, pVictim) TEST_Kill[pPlayer:GetName()] = TEST_Kill[pPlayer:GetName()] or 0 TEST_Kill[pPlayer:GetName()] = TEST_Kill[pPlayer:GetName()] + 1 pPlayer:SendBroadcastMessage("|cFFADD8E6 You have Killed "..TEST_Death[pPlayer:GetName()].." people since the server restarted.") end RegisterServerHook(6, TEST_Death.OnKillPlayer) RegisterServerHook(2, TEST_Kill.OnKillPlayer2) RegisterServerHook(16, "KillDeath_OnChat")
› See More: Players PvP StatsLast edited by shadowslayer133; 11-06-10 at 06:14 AM.
-
09-06-10, 04:17 PM #2
Thanks for sharing =)
2 bad i have no rep power left now lol, but i will give you rep when i can & gratz on contributor in 1 rep =)No touching please.
-
10-06-10, 02:27 AM #3
Nice Nice.
I will Add You, you're Last reputation so You can Earn that Contributor, hopefully you will be as nice to others as I am to you.Don't Forget to for useful releases!. It gives you good luck! Just Like Lucky charms!
-
10-06-10, 05:49 AM #4
Thanks Dimarxx
-
11-06-10, 04:53 AM #5
Register to remove this adGreat release, this could be useful when experimenting with armor stats, etc.
+ rep
Related Threads - Scroll Down after related threads if you are only interested to view replies for above post/thread
Visitors found this page by searching for:
Nobody landed on this page from a search engine, yet!
SEO Blog