Thread: stats
View Single Post
Old 10-25-2010   #3
[TTH]BiZkiT
Registered User
 
Join Date: Sep 2010
Posts: 11
[TTH]BiZkiT is on a distinguished road[TTH]BiZkiT is on a distinguished road
been playing with this but there must be something wrong im doing.
this is what i tried can you tell me what i do wrong? server crashes on connect

local Kills = {}
local Deaths = {}
vaddCallback("onPlayerConnect", "onPlayerConnect_stats")
function onPlayerConnect_stats(PlayerID)
-- callback
IonPlayerConnect(PlayerID)
givePlayerCash(PlayerID,5000)
Kills[strval(PlayerID)] = 0
Deaths[strval(PlayerID)] = 0

-- Random colors upon connection
setPlayerColor(PlayerID,math.random(0,255),math.ra ndom(0,255),math.random(0,255))

-- Connect messages
outputChatBox(PlayerID,"BE SURE TO TYPE "/cmds" TO VIEW THE SERVER'S COMMANDS!",257,23,13,255)
outputChatBox(PlayerID,"BE SURE TO TYPE "/teles" TO VIEW THE TELEPORT COMMANDS!",252,209,22,255)
outputChatBox(PlayerID,"This server has custom maps running!",252,209,22,255)
end

vaddCallback("onPlayerDeath", "onPlayerDeath_stats")
function onPlayerDeath_stats(PlayerID,KillerID,WeaponID)
-- callback
IonPlayerDeath(PlayerID,KillerID,WeaponID)
Deaths[PlayerID] = Deaths[PlayerID] + 1

-- Case for self-kill
if strval(KillerID) == 255 then
if WeaponID == 255 then
outputChatBox(getPlayerName(strval(PlayerID)) .. " died.",255,255,0,255)
else
outputChatBox(getPlayerName(strval(PlayerID)) .. " died. (" .. getWeaponName(strval(WeaponID)) .. ")",255,255,0,255)
end
return
end
[TTH]BiZkiT is offline   Reply With Quote