Forum

> > CS2D > Scripts > Lua Scripts/Questions/Help
Forums overviewCS2D overview Scripts overviewLog in to reply

English Lua Scripts/Questions/Help

6,770 replies
Page
To the start Previous 1 245 46 47338 339 Next To the start

old Re: Lua Scripts/Questions/Help

BetaM
User Off Offline

Quote
I need help with this:
1
2
3
4
5
6
addhook("projectile","mine")
function mine(id,weapon,x,y)
	if weapon==49 then
		parse ("spawnobject 20 (x*32) (y*32) 0 0 0 "..id.."")
	end
end
It creates a mine on 1 x, 1 y. How to make that it creates a mine after shooting a grenade from the grenade launcher (the *32 part won't work)

old Re: Lua Scripts/Questions/Help

Szpaku
User Off Offline

Quote
I need help with my classes mod. I want to make hero which doesnt need to reload. But every my try to make noreload script is not good. I need noreload for only one class, it adds it for everyone. Please help.

EDIT: Ok, I got it No need for help

________________________________________________
Sorry for my bad english, I still learn it
edited 1×, last 28.08.09 07:09:36 pm

old Re: Lua Scripts/Questions/Help

KaiserWilhelm
User Off Offline

Quote
Whatever happened to that WW2 d-day map that was going around when LUA first appeared? the one with the unbelievable amount of classses and all kinds of tweaks. I'm looking to figure out how he/she did the turrets, those would be really cool on part of a future map. Anyone happen to have a copy of the map and source i could borrow?

old Re: Lua Scripts/Questions/Help

Lee
Moderator Off Offline

Quote
KaiserWilhelm has written
Whatever happened to that WW2 d-day map that was going around when LUA first appeared? the one with the unbelievable amount of classses and all kinds of tweaks. I'm looking to figure out how he/she did the turrets, those would be really cool on part of a future map. Anyone happen to have a copy of the map and source i could borrow?


I believe that it was created by Wenn running on top of AMX2D. Contact clan [LaG] for more information regarding this mod.

old Re: Lua Scripts/Questions/Help

playa slaya
COMMUNITY BANNED Off Offline

Quote
I need help I dont have any idea how to do this.I have a class menu but i need the first option to be random from
9 different classes.the reason is mostly because bots
always choose the first option and are always the same thing,also because it be kinda fun.
edited 1×, last 29.08.09 12:14:54 am

old Re: Lua Scripts/Questions/Help

LilCoder
BANNED Off Offline

Quote
you probably have something like...

addhook("menu", "my_menu")
function my_menu(id, title, sel)
player[id] = sel
end


But you can also do like...

player[id] = math.random(1,5)

which picks a random number from 1 to 5...

old Re: Lua Scripts/Questions/Help

Flacko
User Off Offline

Quote
Bots don't select the first one, they close the menu (with 0).
So you can do
1
2
3
if(sel==0)then
	player[id]=math.random(1,9)
end

I'm not 100% sure, but that's the way I did it the other time...

old Re: Lua Scripts/Questions/Help

playa slaya
COMMUNITY BANNED Off Offline

Quote
this is what i have tried recently(its the entire script and iits not the same as the one i uploaded)DONT STEAL IT:


if playaslaya==nil then playaslaya={} end
playaslaya.classes={}

parse("mp_building_limit Turret 3")
parse("mp_building_limit Supply 2")
parse("mp_building_limit Dispenser 3")
parse("mp_building_price Turret 2000")
parse("mp_building_price Supply 800")
parse("mp_building_price Dispenser 500")


-----------------------
-- INITIAL SETUP --
-----------------------
function initArray(m)
     local array = {}
     for i = 1, m do
          array[i]=0
     end
     return array
end
playaslaya.classes.class=initArray(32)
function playaslaya.classes.classmenu(id)
     menu(id,"Select your Class,Soldier|Armor,Spy|Stealth,Engineer|Wrench,Heavy|Explosives,Pyro|Flamethrower,Scout|Speed,Sniper|Scout,Medic|Claw Heals,Future Soldier|Laser")     
end


-----------------------
-- CLASS SELECTION --
-----------------------
addhook("team","playaslaya.classes.team")
function playaslaya.classes.team(id,team)
     if (team>0) then
          playaslaya.classes.classmenu(id)
     end
end


-----------------------
-- SERVERACTION --
-----------------------
addhook("serveraction","playaslaya.classes.serveraction")
function playaslaya.classes.serveraction(id)
     playaslaya.classes.classmenu(id)
end


-----------------------
-- CLASS SELECTION --
-----------------------
addhook("menu","playaslaya.classes.menu")
function playaslaya.classes.menu(id,menu,sel)
     if (menu=="Select your Class") then
          if (sel>=0 and sel<=9) then
               playaslaya.classes.class[id]=sel
               if (player(id,"health")>0) then
                    parse("killplayer "..id)
               end
          end
     end
end


-----------------------
-- SPAWN --
-----------------------
addhook("spawn","playaslaya.classes.spawn")
function playaslaya.classes.spawn(id)
     -- SOLDIER
     if (playaslaya.classes.class[id]<=1) then
          parse ("setmaxhealth "..id.." 125")
          parse ("setarmor "..id.." 150")
          parse ("speedmod "..id.." -5")
          return "47,30,51,52";
     end
     -- SPY
     if (playaslaya.classes.class[id]==2) then
          parse ("setmaxhealth "..id.." 110")
          parse ("speedmod "..id.." 3")
          return "21,1,53,84";
end
-- ENGINEER
     if (playaslaya.classes.class[id]==3) then
          parse ("setmaxhealth "..id.." 100")
          parse ("setarmor "..id.." 50")
          return "10,2,74";
end
-- Heavy
if (playaslaya.classes.class[id]==4) then
parse ("setmaxhealth "..id.." 120")
parse ("setarmor "..id.." 100")
parse ("speedmod "..id.." -9")
return "48,49,51,77,76,40";
     end
     -- PYRO
     if (playaslaya.classes.class[id]==5) then
          parse ("setmaxhealth "..id.." 125")
          parse ("setarmor "..id.." 75")
          return "46,6,73,72";
     end
     -- SCOUT
     if (playaslaya.classes.class[id]==6) then
          parse ("setmaxhealth "..id.." 80")
          parse ("setarmor "..id.." 25")
          parse ("speedmod "..id.." 6")
          return "5,69,54,76,77,51,32";
     end
     -- SNIPER
     if (playaslaya.classes.class[id]==7) then
          parse ("setmaxhealth "..id.." 75")
          parse ("setarmor "..id.." 50")
          return "34,3,53,59";
end
-- MEDIC
if (playaslaya.classes.class[id]==8) then
parse ("setmaxhealth "..id.." 90")
parse ("speedmod "..id.." -1")
return "78,64,4,82";
end
-- Future Soldier
if (playaslaya.classes.class[id]==9) then
parse ("setmaxhealth "..id.." 175")
parse ("setarmor "..id.." 160")
parse ("speedmod "..id.." -7")
return "45,59,51,52,87"
end
if(sel==0)then
player[id]=math.random(1,9)
end
end


-----------------------
-- NO BUYING --
-----------------------
addhook("buy","playaslaya.classes.buy")
function playaslaya.classes.buy()
     return 1
end


-----------------------
-- NO PICKUP --
-----------------------
addhook("walkover","playaslaya.classes.walkover")
function playaslaya.classes.walkover(id,iid,type)
     if (type>=61 and type<=68) then
          return 0
     end
     return 1
end


-----------------------
-- NO DROPPING --
-----------------------
addhook("drop","playaslaya.classes.drop")
function playaslaya.classes.drop()
     return 1
end


-----------------------
-- NO DEAD DROPPING --
-----------------------
addhook("die","playaslaya.classes.die")
function playaslaya.classes.die()
     return 1
end


-----------------------
-- Medic Heal --
-----------------------
addhook("hit","Claw_heal")
function Claw_heal(id,source,weapon,hpdmg,apdmg)
if(weapon == 78) then
parse ("sethealth "..id.." "..player(id,"health")+15)
return 1
end
end
edited 1×, last 29.08.09 01:56:18 am

old Re: Lua Scripts/Questions/Help

playa slaya
COMMUNITY BANNED Off Offline

Quote
well,i uploaded it so maybe its mine.or maybe its his but
i swear i did not know if he made one.so its exactly
nothing is different except wat you said its completely the same?

old Re: Lua Scripts/Questions/Help

BetaM
User Off Offline

Quote
Well this is his script:
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
--------------------------------------------------
-- Team Fortress 2 Script by Banana Phone       --
--------------------------------------------------

if sample==nil then sample={} end
sample.classes={}
--is--
function initArray(m)
	local array = {}
	for i = 1, m do
		array[i]=0
	end
	return array
end
sample.classes.class=initArray(32)
function sample.classes.classmenu(id)
	menu(id,"Select your Class,HWGuy|Armor+MG,Spy|Stealth,Engineer|Wrench,Pyro|Flamethrower,Scout|Speed,Sniper|AWP,Demoman|Grenades,Medic|Medic-armor,Soldier|Rocket-launcher")	
end
-- t->c--
addhook("team","sample.classes.team")
function sample.classes.team(id,team)
	if (team>0) then
		sample.classes.classmenu(id)
	end
end
--sa--
addhook("serveraction","sample.classes.serveraction")
function sample.classes.serveraction(id)
	sample.classes.classmenu(id)
end
--cs--
addhook("menu","sample.classes.menu")
function sample.classes.menu(id,menu,sel)
	if (menu=="Select your Class") then
		if (sel>=0 and sel<=9) then
			sample.classes.class[id]=sel
			if (player(id,"health")>0) then
				parse("killplayer "..id)
			end
		end
	end
end
--s--
addhook("spawn","sample.classes.spawn")
function sample.classes.spawn(id)
	-- hwg
	if (sample.classes.class[id]<=1) then
		parse ("setmaxhealth "..id.." 200")
		parse ("setarmor "..id.." 0")
		parse ("speedmod "..id.." -5")
		return "40,4,51";
	end
	-- spy
	if (sample.classes.class[id]==2) then
		parse ("setmaxhealth "..id.." 125")
		parse ("setarmor "..id.." 206")
		parse ("speedmod "..id.." -5")
		return "21,1,52,72,69,53";
	end
	-- nginer
	if (sample.classes.class[id]==3) then
		parse ("setmaxhealth "..id.." 125")
		parse ("setarmor "..id.." 0")
		return "10,2,74,51";
	end
	-- pyro
	if (sample.classes.class[id]==4) then
		parse ("setmaxhealth "..id.." 175")
		parse ("setarmor "..id.." 0")
		parse ("speedmod "..id.." 5")
		return "46,6,73,51,85";
	end
	-- scout
	if (sample.classes.class[id]==5) then
		parse ("setmaxhealth "..id.." 125")
		parse ("setarmor "..id.." 0")
		parse ("speedmod "..id.." 15")
		return "10,5,54,51";
	end
	-- sniper
	if (sample.classes.class[id]==6) then
		parse ("setmaxhealth "..id.." 125")
		parse ("setarmor "..id.." 0")
		parse ("speedmod "..id.." 5")
		return "35,3,53,51,";
	end
	-- demo
	if (sample.classes.class[id]==7) then
		parse ("setmaxhealth "..id.." 175")
		parse ("setarmor "..id.." 0")
		parse ("speedmod "..id.." 0")
		return "5,49,51,76";
	end
	-- +
	if (sample.classes.class[id]==8) then
		parse ("setmaxhealth "..id.." 50")
		parse ("setarmor "..id.." 204")
		return "3,24,52,51";
	end
	-- soldier
	if (sample.classes.class[id]==9) then
		parse ("setmaxhealth "..id.." 150")
		parse ("setarmor "..id.." 0")
		parse ("speedmod "..id.." 5")
		return "3,47,51,87";
	end
end
--nb--
addhook("buy","sample.classes.buy")
function sample.classes.buy()
	return 1
end
if sample==nil then sample={} end
sample.ads={}

old Re: Lua Scripts/Questions/Help

Banana-Phone
User Off Offline

Quote
Oh, sorry. I didnt know you have a teamfortress mod...
Sorry, but my script now is better than the last post.

This is my script now:


--------------------------------------------------
-- Team Fortress 2 Script by Banana Phone --
--------------------------------------------------

if sample==nil then sample={} end
sample.classes={}
--is--
function initArray(m)
     local array = {}
     for i = 1, m do
          array[i]=0
     end
     return array
end
sample.classes.class=initArray(32)
function sample.classes.classmenu(id)
     menu(id,"Select your Class,HWGuy|Armor+MG,Spy|Stealth,Engineer|Wrench,Pyro|Flamethrower,Scout|Speed,Sniper|AWP,Demoman|Grenades,Medic|Medic-armor,Soldier|Rocket-launcher")     
end
-- t->c--
addhook("team","sample.classes.team")
function sample.classes.team(id,team)
     if (team>0) then
          sample.classes.classmenu(id)
     end
end
addhook("serveraction","sample.classes.serveraction")
function sample.classes.serveraction(id,action)
     if(action == 1) then
          sample.classes.classmenu(id)
     end
end
--cs--
addhook("menu","sample.classes.menu")
function sample.classes.menu(id,menu,sel)
     if (menu=="Select your Class") then
          if (sel>=0 and sel<=9) then
               sample.classes.class[id]=sel
               if (player(id,"health")>0) then
                    parse("killplayer "..id)
               end
          end
     end
end
--s--
addhook("spawn","sample.classes.spawn")
function sample.classes.spawn(id)
     -- hwg
     if (sample.classes.class[id]<=1) then
          parse ("setmaxhealth "..id.." 200")
          parse ("setarmor "..id.." 0")
          parse ("mp_wpndmg TMP 3")
          parse ("speedmod "..id.." -5")
          msg2(id,"©255255255Warning! When you are shooting with MG you speed decrease@C")
          return "40,21,4,51,50";
     end
     -- spy
     if (sample.classes.class[id]==2) then
          parse ("setmaxhealth "..id.." 125")
          parse ("setarmor "..id.." 0")
          parse ("speedmod "..id.." 0")
          parse ("mp_wpndmg USP 3")
          parse ("mp_wpndmg TMP 3")
          msg2(id,"©255255255E key to activate the stealth and use F3 to desactivate, the USP is a confusion gun@C")
          return "21,1,52,72,69,53";
     end
     -- nginer
     if (sample.classes.class[id]==3) then
          parse ("setmaxhealth "..id.." 125")
          parse ("setarmor "..id.." 0")
          parse ("mp_wpndmg TMP 3")
          return "10,21,2,74,51";
     end
     -- pyro
     if (sample.classes.class[id]==4) then
          parse ("setmaxhealth "..id.." 175")
          parse ("setarmor "..id.." 0")
          parse ("speedmod "..id.." 5")
          parse ("mp_wpndmg TMP 3")
          return "46,21,6,73,51,85";
     end
     -- scout
     if (sample.classes.class[id]==5) then
          parse ("setmaxhealth "..id.." 125")
          parse ("setarmor "..id.." 0")
          parse ("mp_wpndmg TMP 3")
          parse ("speedmod "..id.." 15")
          return "10,5,21,54,51";
     end
     -- sniper
     if (sample.classes.class[id]==6) then
          parse ("setmaxhealth "..id.." 125")
          parse ("setarmor "..id.." 0")
          parse ("mp_wpndmg TMP 3")
          parse ("speedmod "..id.." 5")
          return "35,5,21,53,51,34";
     end
     -- demo
     if (sample.classes.class[id]==7) then
          parse ("setmaxhealth "..id.." 175")
          parse ("setarmor "..id.." 0")
          parse ("mp_wpndmg TMP 3")
          parse ("speedmod "..id.." 0")
          return "5,49,21,51,76";
     end
     -- +
     if (sample.classes.class[id]==8) then
          parse ("setmaxhealth "..id.." 150")
          parse ("setarmor "..id.." 0")
          parse ("mp_wpndmg TMP 3")
          parse("mp_wpndmg Deagle 0")
          msg2(id,"©255255255Use Deagle to heals your teammate health!@C")
          return "3,24,21,52,51";
     end
     -- soldier
     if (sample.classes.class[id]==9) then
          parse ("setmaxhealth "..id.." 150")
          parse ("setarmor "..id.." 0")
          parse ("mp_wpndmg TMP 3")
          parse ("speedmod "..id.." -5")
          parse ("mp_wpndmg RPG Launcher 10")
          return "5,47,21,51,87";
     end
end
addhook("use","sample.classes.use")
function sample.classes.use(id,event,data,x,y)
     if (sample.classes.class[id]==2) then
          parse ("setarmor "..id.." 206")
          parse ("speedmod "..id.." -10")
     end
end
addhook("serveraction","my_serveraction")
function my_serveraction(id,action)
     if(sample.classes.class[id]==2) then
          if (action == 2) then
               parse ("setarmor "..id.." 0")
               parse ("speedmod "..id.." 0")
          end
     end
end
addhook("attack","my_attack")
function my_attack(id)
     if (sample.classes.class[id]==1) then
          parse("speedmod "..id.." -14")
     end
     if (sample.classes.class[id]==2) then
          parse("setarmor "..id.." 0")
          parse("speedmod "..id.." 0")
     end
end
addhook("move","my_move")
function my_move(id,x,y,walk)
     if (sample.classes.class[id]==1) then
          parse("speedmod "..id.." 0")
     end
end
--nb--
addhook("buy","sample.classes.buy")
function sample.classes.buy()
     return 1
end
addhook("hit","Deagle_heal")
function Deagle_heal(id,source,weapon,hpdmg,apdmg)
if(weapon == 3) then
parse ("sethealth "..id.." "..player(id,"health")+18)
return 1
end
end
addhook("hit","usp_hit")
function usp_hit(id,source,weapon,hpdmg,apdmg)
     if(weapon == 1) then
          parse ("speedmod "..id.." -20")
          msg2(id,"©255255255You are confused!! Mum, give me my sandwich!@C")
          return 1
     end
end
addhook("second","medic")
function medic(id,health)
     for i=1,32 do
          if (player(i,"exists")) then
               if sample.classes.class[i]==8 then
                    parse("sethealth "..i.." "..player(i,"health")+2)
               end
          end
     end
end
addhook("hit","Ump45")
function Ump45(id,source,weapon,hpdmg,apdmg)
     if(weapon == 24) then
          parse ("sethealth "..source.." "..player          (source,"health")+2)
          return 0
     end
end
if sample==nil then sample={} end
sample.ads={}
--am--
addhook("minute","sample.ads.minute")
function sample.ads.minute()
     msg("Team Fortress 2 mod 3.0")
     msg("Map scripted by Banana Phone---http://bananasclan.mforos.com")
end
--mj--
addhook("join","sample.ads.join")
function sample.ads.join(p)
     msg2(p,"Map scripted by Banana Phone "..player(p,"name").."!")
end
if sample==nil then sample={} end
sample.ut={}
--is--
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
--ptf--
addhook("startround","sample.ut.startround")
function sample.ut.startround()
     parse("sv_sound \"fun/prepare.wav\"")
     sample.ut.fblood=0
end
--ks+msgs--
addhook("kill","sample.ut.kill")
function sample.ut.kill(killer,victim,weapon)
     if (os.clock()-sample.ut.timer[killer])>3 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()
     --fb--
     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
     --h-- (KNIFEKILL)
     if (weapon==50) then
          -- HUMILIATION!
          parse("sv_sound \"fun/humiliation.wav\"");
          msg (player(killer,"name").." humiliated "..player(victim,"name").."!")
     else
          --rk--
          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/monsterkill.wav\"")
               msg (player(killer,"name").." made a MO-O-O-O-ONSTERKILL-ILL-ILL!")
          else
               parse("sv_sound \"fun/unstoppable.wav\"")
               msg (player(killer,"name").." is UNSTOPPABLE! "..level.." KILLS!")
          end
     end
end

old Re: Lua Scripts/Questions/Help

younes
COMMUNITY BANNED Off Offline

Quote
i have a idea: auto-by!!(test)
1
2
3
4
addhook(donno what to wright here)
   if("..player..","..id..") a(button pres donno)
      parse squip(chosen guns shich u want)('45''56')
end
i need help, i know it wont work(up) so need somone to correct my mistakes(i know there are more than 45)so that it works(i think im close to make it working

old Re: Lua Scripts/Questions/Help

Banana-Phone
User Off Offline

Quote
younes has written
i have a idea: auto-by!!(test)
1
2
3
4
addhook(donno what to wright here)
   if("..player..","..id..") a(button pres donno)
      parse squip(chosen guns shich u want)('45''56')
end
i need help, i know it wont work(up) so need somone to correct my mistakes(i know there are more than 45)so that it works(i think im close to make it working


addhook("serveraction","ima_cheater")
function ima_cheater(id,action)
          if(action == 1) then     --pressing F2:
               parse("equip "..id.." 45,83,32443")     --items you want
          end
     end
end

old Re: Lua Scripts/Questions/Help

SQ
Moderator Off Offline

Quote
Banana-Phone has written
parse("equip "..id.." 45,83,32443")

I dont think you can multip parameters.

old Re: Lua Scripts/Questions/Help

younes
COMMUNITY BANNED Off Offline

Quote
i donno what it means but wtf :
1
cheater
but any ways ill try and thx allot
o ya i forgot is it possiblt to take off money(likke if you bought weapon??

old Re: Lua Scripts/Questions/Help

playa slaya
COMMUNITY BANNED Off Offline

Quote
mat5b has written
Wait, Banana Phone made exactly the same script but instead of playaslaya there is sample.classes .


i looked its different i used the sample. i think he did to

old Re: Lua Scripts/Questions/Help

doom15
BANNED Off Offline

Quote
Request for a lua script , for Prison maps

Let say :

Cts : 1.Can chose Cops - M4a1 , Deagle ,
kevlar+help 150 hp + flare
2.Dirty Cop : - M4a1 , Elite , He , , Machete
etc
etc
etc

Tero`s can chose : Prisoner : 200 hp


And randomly one of Ts will get a Glock / Machete , (with some delays) like this round no one have , next round -x- Have machetter and try to escape..
To the start Previous 1 245 46 47338 339 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview