Forum
CS2D Scripts Lua Scripts/Questions/Helpedited 1×, last 10.07.09 07:14:10 pm
Tehmasta has written
its quite possible, but for it to decrease at a non-integral timeframe would result in you using always hook which causes a great deal of lag and is unreliable
Here's an example of what he meant:
Use the Lua demo to run this, do not run this in CS2D since it will freeze the game for .8 seconds
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
function accelerate(v0, r) 	--[[-- 	v0 = initial velocity Magnitude 	r = rate of change for the velocity (AKA dv/dt or just a) 	we assume r is a constant 	v is the instantaneous velocity MAGNITUDE 	v = integral(r, t) + v0 	v = r*t + v0 	--]]-- 	if r > 1 then r = r/100 end 	r = r * v0 	local fn = string.format([[ 	return function(t) 		return (t*%s + %s) 	end 	]],r, v0) 	fn = loadstring(fn) 	if fn then 		return fn() 	else 		return nil 	end end instantVelocity = accelerate(10, .3) local delay = .1 -- Delay is dt t = os.clock() -- Time we'll be using. while t < .8+delay do 	if (t + delay < os.clock()) then 		print("Time: "..t, "Speed: "..instantVelocity(t)) 		t = os.clock() 	end end
And to implement it into CS2D, you would have to use
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
addhook("always", "speed") player_speed = {} function speed(p) 	for p, tab in pairs(player_speed) do 		if os.clock() < (tab.inverval + tab.t) then 			parse("speedmod "..p.." "..tab.fn(os.clock() - tab.t)) 		else 			player_speed[p] = nil 		end 	end end function add_speed(p, r, interval) 	local v0 = player(p, "speedmod") 	player_speed[p] = {fn = accelerate(v0, r), t = os.clock(), inverval = interval} end
Which if you actually try on your server, would do as Tehmasta said, cause a great deal of lag.
If you're overzealous, you can graph the data points of velocity vs time. and find the dv/dt by just looking at the graph.
edited 1×, last 29.04.09 03:05:34 pm
Zune5 has written
No.
These things AREN'T possible. It would cause flame and accused hacking as well...
These things AREN'T possible. It would cause flame and accused hacking as well...
I just asked for an RPG skill.
No1 woud think its hack when its on the "Rpgmenu"
-Deagle 2Fast has written
I just asked for an RPG skill.
No1 woud think its hack when its on the "Rpgmenu"
No1 woud think its hack when its on the "Rpgmenu"
See my previous post.
I'm wondering how to make a couple of 'classes' for only CT/T with LUA. I've examined the samples for the classes, but I don't understand any of it. If anyone is truly bored enough, please post a script for the classes I specify here... soz fo askin.
Zombie Classes
Quick [25 Claw dmg, 75 hp, 5 speedmod]
Strong [100 Claw dmg, 125 hp, -5 speedmod]
Throw [25 Claw dmg, 75 hp, Never runs out of gutbombs]
Normal [50 Claw dmg, 100 hp]
kthxbai!!!
Now, if you look at it, theirs a time that stops the sounds
Hence if u get a doublekill and wait 6 seconds, it will reset... now i know nothing about scripts but i was wondering if anyone knows how to make it So if you get an ultra kill and leave the server or somthing, when you come back and get another kill, you will get the Next lvl sound?
(i tryed putting 9999 instead of 6 and it works, but IF you die, it doesnt reset..)
Also, how do you make it so when someone gets kills, it Appears in red in the middle of the screen? (Currently this appears yellow to the very left of the screen)
--------------------------------------------------
-- UT+Quake Sounds Script by Unreal Software --
-- 22.02.2009 - www.UnrealSoftware.de --
-- Adds UT and Quake Sounds to your Server --
--------------------------------------------------
if sample==nil then sample={} end
sample.ut={}
-----------------------
-- INITIAL SETUP --
-----------------------
function initArray(m)
local array = {}
for i = 1, m do
array[i]=0
end
return array
end
sample.ut.timer=initArray(32)
sample.ut.level=initArray(32)
sample.ut.fblood=0
-----------------------
-- PREPARE TO FIGHT! --
-----------------------
addhook("startround","sample.ut.startround")
function sample.ut.startround()
parse("sv_sound \"fun/prepare.wav\"")
sample.ut.fblood=0
end
-----------------------
-- KILL SOUNDS+MSGS --
-----------------------
addhook("kill","sample.ut.kill")
function sample.ut.kill(killer,victim,weapon)
if (os.clock()-sample.ut.timer[killer])>6 then
sample.ut.level[killer]=0;
end
level=sample.ut.level[killer]
level=level+1
sample.ut.level[killer]=level
sample.ut.timer[killer]=os.clock()
-- FIRST BLOOD?
if (sample.ut.fblood==0) then
sample.ut.fblood=1
parse("sv_sound \"fun/firstblood.wav\"");
msg (player(killer,"name").." sheds FIRST BLOOD by killing "..player(victim,"name").."!")
end
-- HUMILIATION? (KNIFEKILL)
if (weapon==50) then
-- HUMILIATION!
parse("sv_sound \"fun/humiliation.wav\"");
msg (player(killer,"name").." humiliated "..player(victim,"name").."!")
else
-- REGULAR KILL
if (level==1) then
-- Single Kill! Nothing Special!
elseif (level==2) then
parse("sv_sound \"fun/doublekill.wav\"");
msg (player(killer,"name").." made a Doublekill!")
elseif (level==3) then
parse("sv_sound \"fun/multikill.wav\"")
msg (player(killer,"name").." made a Multikill!")
elseif (level==4) then
parse("sv_sound \"fun/ultrakill.wav\"")
msg (player(killer,"name").." made an ULTRAKILL!")
elseif (level==5) then
parse("sv_sound \"fun/killingspree.wav\"")
msg (player(killer,"name").." is on a Killing Spree!")
elseif (level==6) then
parse("sv_sound \"fun/rampage.wav\"")
msg (player(killer,"name").." is on a Rampage!")
elseif (level==7) then
parse("sv_sound \"fun/wickedsick.wav\"")
msg (player(killer,"name").." is Wicked Sick!")
elseif (level==8) then
parse("sv_sound \"fun/dominating.wav\"")
msg (player(killer,"name").." is Dominating!")
elseif (level==9) then
parse("sv_sound \"fun/monsterkill.wav\"")
msg (player(killer,"name").." made a MO-O-O-O-ONSTERKILL-ILL-ILL!")
elseif (level==10) then
parse("sv_sound \"fun/godlike.wav\"")
msg (player(killer,"name").." is GOD Like!")
elseif (level==11) then
parse("sv_sound \"fun/unstoppable.wav\"")
msg (player(killer,"name").." is Unstoppable!!")
else
parse("sv_sound \"fun/holyshit.wav\"")
msg (player(killer,"name").." HOLY SHIT!!!"..level.." KILLS!")
end
end
end
Now, if you look at it, theirs a time that stops the sounds
Hence if u get a doublekill and wait 5 seconds, it will reset... now i know nothing about scripts but i was wondering if anyone knows how to make it So if you get an ultra kill and leave the server or somthing, when you come back and get another kill, you will get the Next lvl sound?
(i tryed putting 9999 instead of 5 and it works, but IF you die, it doesnt reset..)
USGN["1337"] = level3
How do I change the os.clock()-sample.ut.timer[killer])
to be reseted only after the new round starts?
And if it is possible to set the seconds of the
round time by lua script, for example: 1min:45sec
TheKilledDeath has written
no way
Do you know how to take the TIme off UT sounds?! I dont want the sounds to stop on my server after 5 seconds, i want them to stop after u die...
1
sample.ut.timer=initArray(32)
and remove this:
1
2
3
2
3
if (os.clock()-sample.ut.timer[killer])>3 then 		sample.ut.level[killer]=0; 	end
from the utsfx.lua in the samples folder.
Flacko has written
remove the table sample.ut.timer.
and remove this:
from the utsfx.lua in the samples folder.
1
sample.ut.timer=initArray(32)
and remove this:
1
2
3
2
3
if (os.clock()-sample.ut.timer[killer])>3 then 		sample.ut.level[killer]=0; 	end
from the utsfx.lua in the samples folder.
i removed if (os.clock()-sample.ut.timer[killer])>0 then
sample.ut.level[killer]=0;
end
But it doesnt end if you die...
1
2
3
2
3
if (os.clock()-sample.ut.timer[killer])>3 then 		sample.ut.level[killer]=0; 	end
Change that whole block into
1
sample.ut.level[victim]=0;
How make a script,
I trigger a trigger_use with name "menu",
then come a menu with function.. how i make this? can you make a sample to this ?
youre Profi in lua :P..
edited 1×, last 03.05.09 10:27:31 pm