![Very Happy :D](./images/smilies/icon_biggrin.gif)
I guess I am trying to make this so those people that have windows servers and cant install etadmin mod can have some sense of the fun stuff.
Thx again everyone
![Very Happy :D](./images/smilies/icon_biggrin.gif)
Moderators: Forum moderators, developers
Yes, you have to do something with leveltime after you grab it.Clutch152 wrote: If I were to use et_RunFrame then wouldn't the leveltime always be changing?
Code: Select all
multikill=0
function et_Obituary( victim, killer, meansOfDeath )
local kill1=""
local kill2=""
multikill=multikill+1
if (multikill==1) then
kill1=et_RunFrame( levelTime )
elseif (multikill==2) then
kill2=et_RunFrame( levelTime )
if ((kill2-kill1)<=3000) then
blah blah blah doublekill!
else
multikill=0
end
end
end
Code: Select all
function et_Obituary( victim, killer, meansOfDeath )
lastkilltime[killer] = 300 --set the time im milisecs until its kills will nolonger count as multykill
end
function et_RunFrame(leveltime)
for client=0,64,1 do
if lastkilltime[client] then --if it isnt 0
lastkilltime[client] = lastkilltime[cleint] - 1 --decrease it whit 1
else --if it is 0 thne his timer ran out
et.G_Print("Client killed .. ppl")
end
end
end
Code: Select all
function et_Obituary( victim, killer, meansOfDeath )
currenttime = et.trap_Milliseconds() --set the time at witch his
last kill happent
if (currenttime - lastkilltime[killer]) < 3000 then --if the kill happent whitin 3000 milisecs
lastkilltime[killer] = currenttime --reset his killig time
--count the kill for the multikill
else
et.G_Print("Client ".. killer .."has killed .. ppl")
--his timer expired so count the current kills and print out the mesage and start counting at 1 again
end
end
Thats exactly what I did for the killingsprees, deathsprees, flak monkeys, and now multikills. I got it working at about 4:30 this morning lol using this code:Deus wrote:not the way its intended to.
you need one multikill-counters per player.
Code: Select all
killingspree0=0
flakkillse0=0
multikill0=0
deathspree0=0
local kill1=""
local kill2=""
local kill3=""
local kill4=""
local kill5=""
local kill6=""
killingspreesound="sound/misc/killingspree.wav"
rampagesound="sound/misc/rampage.wav"
dominatingsound="sound/misc/dominating.wav"
unstopablesound="sound/misc/unstoppable.wav"
godlikesound="sound/misc/godlike.wav"
wickedsicksound="sound/misc/wickedsick.wav"
pottersound="sound/misc/potter.wav"
flakmonkeysound="sound/misc/flakmonkey.wav"
deathspreesound1="sound/misc/humiliation.wav"
deathspreesound2="sound/misc/you_suck.wav"
deathspreesound3="sound/misc/ae821.wav"
doublekillsound="sound/misc/doublekill.wav"
multikillsound="sound/misc/multikill.wav"
ultrakillsound="sound/misc/ultrakill.wav"
monsterkillsound="sound/misc/monsterkill.wav"
ludicrouskillsound="sound/misc/ludicrouskill.wav"
function et_Obituary( victim, killer, meansOfDeath )
if (killer==0) then
killse0(victim, killer, meansOfDeath)
end
if (victim==0) then
deathe0(victim, killer, meansOfdeath)
end
end
function killse0(victim, killer, meansOfDeath)
local killername=et.Info_ValueForKey( et.trap_GetUserinfo( killer ), "name" )
local victimteam = tonumber(et.gentity_get(victim, "sess.sessionTeam"))
local killerteam = tonumber(et.gentity_get(killer, "sess.sessionTeam"))
if (killer~=victim) then
deathspree0=0
else
end
if (killer~=victim or victimteam~=killerteam) then
multikill0=multikill0+1
if (multikill0==1) then
kill1=mtime
elseif (multikill0==2) then
kill2=mtime
--50000 = 5 seconds. there is a random 0 tacked on the end of the levelTime
if ((kill2-kill1)<=50000) then
et.trap_SendServerCommand( killer,"bp "^1DOUBLEKILL!"\n")
et.G_globalSound(doublekillsound)
else
multikill0=0
end
elseif (multikill0==3) then
kill3=tonumber(mtime)
if ((kill3-kill2)<=50000) then
et.trap_SendServerCommand( killer,"bp "^1MULTIKILL!"\n")
et.G_globalSound(multikillsound)
else
multikill0=0
end
elseif (multikill0==4) then
kill4=tonumber(mtime)
if ((kill4-kill3)<=50000) then
et.trap_SendServerCommand( killer,"bp "^1ULTRAKILL!"\n")
et.G_globalSound(ultrakillsound)
else
multikill0=0
end
elseif (multikill0==5) then
kill5=tonumber(mtime)
if ((kill5-kill4)<=50000) then
et.trap_SendServerCommand( killer,"bp "^1MONSTERKILL!"\n")
et.G_globalSound(monsterkillsound)
else
multikill0=0
end
elseif (multikill0==6) then
kill6=tonumber(mtime)
if ((kill6-kill5)<=50000) then
et.trap_SendServerCommand( killer,"bp "^1LUDICROUSKILL!"\n")
et.G_globalSound(ludicrouskillsound)
else
multikill0=0
end
end
else
multikill0=0
end
if (killer~=victim or victimteam~=killerteam) then
killingspree0=killingspree0+1
if (killingspree0==5) then
et.trap_SendServerCommand( killer,"cp "^1KILLINGSPREE!"\n")
et.trap_SendConsoleCommand( et.EXEC_APPEND, "bp ^7" ..killername.. " ^1is on a killingspree!\n" )
et.G_globalSound(killingspreesound)
elseif (killingspree0==10) then
et.trap_SendServerCommand( killer,"cp "^1RAMPAGE!"\n")
et.trap_SendConsoleCommand( et.EXEC_APPEND, "bp ^7" ..killername.. " ^1is on a rampage!\n" )
et.G_globalSound(rampagesound)
elseif (killingspree0==15) then
et.trap_SendServerCommand( killer,"cp "^1DOMINATION!"\n")
et.trap_SendConsoleCommand( et.EXEC_APPEND, "bp ^7" ..killername.. " ^1is dominating!\n" )
et.G_globalSound(dominatingsound)
elseif (killingspree0==20) then
et.trap_SendServerCommand( killer,"cp "^1UNSTOPABLE!"\n")
et.trap_SendConsoleCommand( et.EXEC_APPEND, "bp ^7" ..killername.. " ^1is unstopable!\n" )
et.G_globalSound(unstopablesound)
elseif (killingspree0==25) then
et.trap_SendServerCommand( killer,"cp "^1GODLIKE!"\n")
et.trap_SendConsoleCommand( et.EXEC_APPEND, "bp ^7" ..killername.. " ^1is godlike!\n" )
et.G_globalSound(godlikesound)
elseif (killingspree0==30) then
et.trap_SendServerCommand( killer,"cp "^1WICKED SICK!"\n")
et.trap_SendConsoleCommand( et.EXEC_APPEND, "bp ^7" ..killername.. " ^1is wicked sick!\n" )
et.G_globalSound(wickedsicksound)
elseif (killingspree0==35) then
et.trap_SendServerCommand( killer,"cp "^1POTTER!"\n")
et.trap_SendConsoleCommand( et.EXEC_APPEND, "bp ^7" ..killername.. " ^1is a god amongst men!\n" )
et.G_globalSound(pottersound)
end
else
killingspree0=0
end
if (meansOfDeath==17 or meansOfDeath==43 or meansOfDeath==44) then
if (killer~=victim or victimteam~=killerteam) then
flakkillse0=flakkillse0+1
if (flakkillse0==3) then
et.trap_SendServerCommand( killer,"cp "^1FLAKMONKEY!"\n")
et.trap_SendConsoleCommand( et.EXEC_APPEND, "bp ^7" ..killername.. " ^1got a flakmonkey!\n" )
et.G_globalSound(flakmonkeysound)
flakkillse0=0
end
else
flakkillse0=0
end
else
flakkillse0=0
end
end
function deathe0(victim, killer, meansOfDeath)
local killername=et.Info_ValueForKey( et.trap_GetUserinfo( killer ), "name" )
local victimteam = tonumber(et.gentity_get(victim, "sess.sessionTeam"))
local killerteam = tonumber(et.gentity_get(killer, "sess.sessionTeam"))
local killedname=et.Info_ValueForKey( et.trap_GetUserinfo( victim ), "name" )
deathspree0=deathspree0+1
if (killingspree0>=5) then
et.trap_SendConsoleCommand( et.EXEC_APPEND, "bp ^7" ..killername.. " ^1ended ^7" ..killedname.. "^1's Killingspree! ^2(^7" ..killingspree0.. "^2)\n" )
killingspree0=0
else
killingspree0=0
end
if (deathspree0==10) then
et.trap_SendConsoleCommand( et.EXEC_APPEND, "bp ^7" ..killedname.. " ^7seems to be having a bad day!\n" )
et.G_globalSound(deathspreesound1)
elseif (deathspree0==15) then
et.trap_SendConsoleCommand( et.EXEC_APPEND, "bp ^7" ..killedname.. " ^7is on the way to getting ^3victim^7 of the day!\n" )
et.G_globalSound(deathspreesound2)
elseif (deathspree0==20) then
et.trap_SendConsoleCommand( et.EXEC_APPEND, "bp ^7" ..killedname.. " ^7is getting his ass kicked!\n" )
et.G_globalSound(deathspreesound3)
end
if (flakkillse0>=1) then
flakkillse0=0
end
end
Code: Select all
mkillcount=0
mkilltime=0
killspree=0
deathspree=0
killingspreesound="sound/misc/killingspree.wav"
rampagesound="sound/misc/rampage.wav"
dominatingsound="sound/misc/dominating.wav"
unstopablesound="sound/misc/unstoppable.wav"
godlikesound="sound/misc/godlike.wav"
wickedsicksound="sound/misc/wickedsick.wav"
pottersound="sound/misc/potter.wav"
flakmonkeysound="sound/misc/flakmonkey.wav"
deathspreesound1="sound/misc/humiliation.wav"
deathspreesound2="sound/misc/you_suck.wav"
deathspreesound3="sound/misc/ae821.wav"
doublekillsound="sound/misc/doublekill.wav"
multikillsound="sound/misc/multikill.wav"
ultrakillsound="sound/misc/ultrakill.wav"
monsterkillsound="sound/misc/monsterkill.wav"
ludicrouskillsound="sound/misc/ludicrouskill.wav"
function et_Obituary( victim, killer, meansOfDeath )
killse(victim, killer, meansOfDeath)
deathe(victim, killer, meansOfdeath)
end
function killse(victim, killer, meansOfDeath)
local killername=et.Info_ValueForKey( et.trap_GetUserinfo( killer ), "name" )
local victimteam = tonumber(et.gentity_get(victim, "sess.sessionTeam"))
local killerteam = tonumber(et.gentity_get(killer, "sess.sessionTeam"))
if (killer~=victim or victimteam~=killerteam) then
-- player kills an opponent
deathspree[killer]=0
-- multikills
if (mtime-mkilltime[killer]<50000) then
-- it's a multikill
mkilltime = mtime
mkillcount[killer] = mkillcount + 1
if (mkillcount[killer]==2) then
et.trap_SendServerCommand( killer,"bp \"^1DOUBLEKILL!\"\n")
et.G_globalSound(doublekillsound)
elseif (mkillcount[killer]==3) then
et.trap_SendServerCommand( killer,"bp \"^1MULTIKILL!\"\n")
et.G_globalSound(multikillsound)
elseif (mkillcount[killer]==4) then
et.trap_SendServerCommand( killer,"bp \"^1ULTRAKILL!\"\n")
et.G_globalSound(ultrakillsound)
elseif (mkillcount[killer]==5) then
et.trap_SendServerCommand( killer,"bp \"^1MONSTERKILL!\"\n")
et.G_globalSound(monsterkillsound)
elseif (mkillcount[killer]==6) then
et.trap_SendServerCommand( killer,"bp \"^1LUDICROUSKILL!\"\n")
et.G_globalSound(ludicrouskillsound)
end
else
-- no more multikill
mkillcount[killer] = 0
end
-- killing sprees
killspree[killer] = killspree +1
if (killspree[killer]==5) then
et.trap_SendServerCommand( killer,"cp \"^1KILLINGSPREE!\"\n")
et.trap_SendConsoleCommand( et.EXEC_APPEND, "bp ^7" ..killername.. " ^1is on a killingspree!\n" )
et.G_globalSound(killingspreesound)
elseif (killspree[killer]==10) then
et.trap_SendServerCommand( killer,"cp \"^1RAMPAGE!\"\n")
et.trap_SendConsoleCommand( et.EXEC_APPEND, "bp ^7" ..killername.. " ^1is on a rampage!\n" )
et.G_globalSound(rampagesound)
elseif (killspree[killer]==15) then
et.trap_SendServerCommand( killer,"cp \"^1DOMINATION!\"\n")
et.trap_SendConsoleCommand( et.EXEC_APPEND, "bp ^7" ..killername.. " ^1is dominating!\n" )
et.G_globalSound(dominatingsound)
elseif (killspree[killer]==20) then
et.trap_SendServerCommand( killer,"cp \"^1UNSTOPABLE!\"\n")
et.trap_SendConsoleCommand( et.EXEC_APPEND, "bp ^7" ..killername.. " ^1is unstopable!\n" )
et.G_globalSound(unstopablesound)
elseif (killspree[killer]==25) then
et.trap_SendServerCommand( killer,"cp \"^1GODLIKE!\"\n")
et.trap_SendConsoleCommand( et.EXEC_APPEND, "bp ^7" ..killername.. " ^1is godlike!\n" )
et.G_globalSound(godlikesound)
elseif (killspree[killer]==30) then
et.trap_SendServerCommand( killer,"cp \"^1WICKED SICK!\"\n")
et.trap_SendConsoleCommand( et.EXEC_APPEND, "bp ^7" ..killername.. " ^1is wicked sick!\n" )
et.G_globalSound(wickedsicksound)
elseif (killspree[killer]==35) then
et.trap_SendServerCommand( killer,"cp \"^1POTTER!\"\n")
et.trap_SendConsoleCommand( et.EXEC_APPEND, "bp ^7" ..killername.. " ^1is a god amongst men!\n" )
et.G_globalSound(pottersound)
end
end
end
function deathe(victim, killer, meansOfDeath)
local killername = et.Info_ValueForKey( et.trap_GetUserinfo( killer ), "name" )
local killedname = et.Info_ValueForKey( et.trap_GetUserinfo( victim ), "name" )
local victimteam = tonumber(et.gentity_get(victim, "sess.sessionTeam"))
local killerteam = tonumber(et.gentity_get(killer, "sess.sessionTeam"))
if (killspree[victim]>=5) then
et.trap_SendConsoleCommand( et.EXEC_APPEND, "bp ^7" ..killername.. " ^1ended ^7" ..killedname.. "^1's Killingspree! ^2(^7" ..killspree[victim].. "^2)\n" )
end
killspree[victim] = 0
deathspree[victim] = deathspree[victim] + 1
-- announce death sprees
if (deathspree[victim] == 10) then
et.trap_SendConsoleCommand( et.EXEC_APPEND, "bp ^7" ..killedname.. " ^7seems to be having a bad day!\n" )
et.G_globalSound(deathspreesound1)
elseif (deathspree[victim] == 15) then
et.trap_SendConsoleCommand( et.EXEC_APPEND, "bp ^7" ..killedname.. " ^7is on the way to getting ^3victim^7 of the day!\n" )
et.G_globalSound(deathspreesound2)
elseif (deathspree[victim] == 20) then
et.trap_SendConsoleCommand( et.EXEC_APPEND, "bp ^7" ..killedname.. " ^7is getting his ass kicked!\n" )
et.G_globalSound(deathspreesound3)
end
end
To do what you want to do, you need to understand tables and loops. Doing it any other way is insane, and no one will want to help you with the resulting code. There are lots of people here willing to help you, but very few who will just do the project for you.Clutch152 wrote: That's a little rude. Like I said, I only started like 2 days ago.
You only have to worry about upvalues if you are defining functions inside of functions, which you most certainly do not want to be doing at this point.Now I read that when you have a local variable outside a function and then the variable is used in the function its called a upvalue. Does this mean that the value that is used in the function not valid outside the function?