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 2228 229 230338 339 Next To the start

old Re: Lua Scripts/Questions/Help

CmDark
User Off Offline

Quote
I'm really suspicious on whether this would work.. but

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
tspawns={}
ctspawns={}

addhook('startround','test_startround')

function test_startround()
for x=1,map("xsize") do
	for y=1,map("ysize") do
		if tile(x,y,"spawn_t") then
			t='"{x="'..x..'",y="'..y..'"}"'
			table.insert(tspawns,(#tspawns+1),t)
		elseif tile(x,y,"spawn_ct") then
			ct='"{x="'..x..'",y="'..y..'"}"'
			table.insert(ctspawns,(#ctspawns+1),ct)
		end
	end
end
end

tspawn=math.random(0,#tspawns)
ctspawn=math.random(0,#ctspawns)

addhook('say','test_say')

function test_say(p, t)
if t=='!revive' then
	if player(p,"money") > 7999 then
		if player(p,"team")==1 then
		parse('spawnplayer '..p..' '..(tspawns[tspawn].x)..' '..(tspawns[tspawn].y))
		parse('setmoney '..p..' '..(player(p,'money')-8000))
		elseif player(p,"team")==2 then
		parse('spawnplayer '..p..' '..(ctspawns[ctspawn].x)..' '..(ctspawns[ctspawn].y))
		parse('setmoney '..p..' '..(player(p,'money')-8000))
		elseif player(p,"team")==3 then
			msg2(p,"You are a spectator, you cannot be revived.")
		end
	else
		msg2(p,"You do not have enough money, you need $8000 to be revived.")
	end
end
end

yeah.. Someone revise it

old Warcraraft 3

texnonikWP
User Off Offline

Quote
Need war 3 ft ( warcraraft 3 ) Lua Script .
Undead , Human , Orc , ... .
My skype : dawbawBK
edited 2×, last 01.08.10 03:16:12 pm

old Re: Lua Scripts/Questions/Help

YellowBanana
BANNED Off Offline

Quote
vesa-omar has written
I need a script to check if theres no Players in Terrorist Team, it does
1
parse("trigger predwin")


1
2
3
4
5
6
7
8
9
10
addhook("startround","check_players")
function check_players()
	for i,v in ipairs(player(0,"table")) do
		if player(i,"team")==1 then -- He is a terrorist
			parse("trigger predwin")
		end
	end
end

TEAMS = { 'Terrorist' , 'Counter-Terrorist'}

old Re: Lua Scripts/Questions/Help

RyceR
User Off Offline

Quote
how to make it:
if i spawn i have not knife, i have claw...
and if is startround random people in terro and ct is survivor(has M4A1, HE, Deagle, 150 armor)

sorry for bad english

old Re: Lua Scripts/Questions/Help

HaRe
User Off Offline

Quote
MSek has written
how to make it:
if i spawn i have not knife, i have claw...
and if is startround random people in terro and ct is survivor(has M4A1, HE, Deagle, 150 armor)

sorry for bad english


this is for the knife
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
function array(m)
local array = {}
for i = 1, m do
array[i] = 0
end
return array
end

dropknf=array(32)

addhook("drop","claw_drop")
function claw_drop(id,iid,type,ain,a,mode,x,y)
	if type==78 then -- idk if 78 is claw but anyways
		return 1
	end
end

addhook("drop","knf_drop")
function knf_drop(id,iid,type,ain,a,mode,x,y)
		dropknf[id]=1
	end
end

addhook("ms100","ms100_drop")
function ms100_drop()
	for id = 1,32 do 
		if (player(id,"exists")) then
			if dropknf[id]==1 then
				parse("setweapon "..id.." 78")
				parse("strip "..id.." 50")
				dropknf[id]=0
			end
		end
	end
end

old How do you do this in lua.

Stormtrooper595
User Off Offline

Quote
Hey guys I have like still hardly any lua scripting knowledge but i need a start for this roleplay script i want to try to do.
ok so what I'm wanting to do is make it where admins are to be sent to the ct side and have their text in white if they on a list of usgn id's in a txt file (so like rp_admins.txt in lua folder). I also need it where it stops players from Changing from T to CT or CT to T if not supposed to. Thanks! Sorry I just am bad at lua and I don't really know where to start.

old Re: Lua Scripts/Questions/Help

mysteriousdude
User Off Offline

Quote
Can somebody make me a script that when u say the coommand

@800

the start money is 800 and increases by 800 every round

and @16000 whree the start money is 16000 and increases by 16000 everyround

and can u make it work when u put it in amx2d..

tnx

old Re: Lua Scripts/Questions/Help

HaRe
User Off Offline

Quote
@mysteriousdude

Do you want it for admins or??
Heres the one for admins

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
800=0
16000=0

addhook("say","moneysay")
function moneysay(id,txt)
	if (player(id,"usgn") == ID) then -- Put your usgn id
		if txt=="!800" then
			800=1
			16000=0
			msg("Money start is setted to 800@C")
			parse("mp_startmoney 800")
			return 1
		elseif txt=="!16000" then
			800=0
			16000=1
			msg("Money start is setted to 16000@C")
			parse("mp_startmoney 16000")
			return 1
		end
	end
end

addhook("startround","moneystart")
function moneystart()
	for id = 1,32 do
		if 800==1 then
			parse("setmoney "..id.." "..player(id,"money") + 800)
		elseif 16000==0 then
			parse("setmoney "..id.." "..player(id,"money") + 16000)
		end
	end
end

old Re: Lua Scripts/Questions/Help

Flacko
User Off Offline

Quote
@vesa-omar: Did you know you can't label variables as numbers?
800 = 0 is invalid.
Rename it to something like eighthundred.

old Re: Lua Scripts/Questions/Help

Cure Pikachu
User Off Offline

Quote
@mysteriousdude

It probably won't work. But I fixed up vesa-omar's version and here. (Fixed it up again)
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
half=0
full=0

addhook("say","moneysay")
function moneysay(id,txt)
	if (player(id,"usgn") == 14608) then -- 14608 is an example, replace it with your USGN ID
		if txt=="@800" then
               			half=1
               			full=0
               			msg("Money start is setted to 800@C")
               			parse("mp_startmoney 800")
               			return 1
		elseif txt=="@16000" then
			half=0
			full=1
			msg("Money start is setted to 16000@C")
			parse("mp_startmoney 16000")
			return 1
		end
	end
end

addhook("startround","moneystart")
function moneystart()
	for id = 1,32 do
		if half==1 then
			parse("setmoney "..id.." "..player(id,"money") + 800)
		elseif full==1 then
			parse("setmoney "..id.." "..player(id,"money") + 16000)
		end
	end
end
edited 1×, last 03.08.10 09:00:36 am

old Re: Lua Scripts/Questions/Help

Stormtrooper595
User Off Offline

Quote
Stormtrooper595 has written
Hey guys I have like still hardly any lua scripting knowledge but i need a start for this roleplay script i want to try to do.
ok so what I'm wanting to do is make it where admins are to be sent to the ct side and have their text in white if they on a list of usgn id's in a txt file (so like rp_admins.txt in lua folder). I also need it where it stops players from Changing from T to CT or CT to T if not supposed to. Thanks! Sorry I just am bad at lua and I don't really know where to start.

Can someone please help me i really dont know what to do.

old Re: Lua Scripts/Questions/Help

brk753951
BANNED Off Offline

Quote
hi all ineed menu pls help

menu

1-medikit ( 100dollar)
2-laser(16000)
3-super armor ( 16000)
4-
5-
....

and i need admin menu

pls make with usgn.

1- teleport (setpos 100 100)
2- laser
3-super armor

old Re: Lua Scripts/Questions/Help

Starkkz
Moderator Off Offline

Quote
Here's your script:
Note: You have to write admin usgn list at "admins" (table), in "player_admin" (function).

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
function player_admin(id)
	admins = {} -- Write admins usgn at Here (Separed with coma)
	for _, usgn in pairs(admins) do
		if usgn == player(id,"usgn") then
			return true
		end
	end
	return false
end

addhook("say","admsay")
function admsay(id,txt)
	if txt == "!menu" and player_admin(id) then
		menu(id,"Admin Menu,Teleport|X: 100 - Y: 100,Laser,Super Armor")
		return 1
	elseif txt == "!buymenu" then
		menu(id,"Buy Menu,Medikit|$100,Laser|$16000,Super Armor|$16000")
	end
end

addhook("menu","admmenu")
function admmenu(id,men,sel)
	if men == "Admin Menu" then
		if sel == 1 then
			parse("setpos "..id.." 100 100")
		elseif sel == 2 then
			parse("equip "..id.." 45")
		elseif sel == 3 then
			parse("equip "..id.." 83")
		end
	elseif men == "Buy Menu" then
		if sel == 1 and player(id,"money") >= 100 then
			parse("equip "..id.." 64")
			parse("setmoney "..id.." "..player(id,"money")-100)
		elseif sel == 2 and player(id,"money") >= 16000 then
			parse("equip "..id.." 45")
			parse("setmoney "..id.." 0")
		elseif sel == 3 and player(id,"money") >= 16000 then
			parse("equip "..id.." 83")
			parse("setmoney "..id.." 0")
		end
	end
end

old Re: Lua Scripts/Questions/Help

mysteriousdude
User Off Offline

Quote
Pikachu xD has written
@mysteriousdude

It probably won't work. But I fixed up vesa-omar's version and here.
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
half=0
full=0

addhook("say","moneysay")
function moneysay(id,txt)
	if (player(id,"usgn") == 14608) then -- 14608 is an example, replace it with your USGN ID
		if txt=="@800" then
               			half=1
               			full=0
               			msg("Money start is setted to 800@C")
               			parse("mp_startmoney 800")
               			return 1
		elseif txt=="@16000" then
			half=0
			full=1
			msg("Money start is setted to 16000@C")
			parse("mp_startmoney 16000")
			return 1
		end
	end
end

addhook("startround","moneystart")
function moneystart()
	for id = 1,32 do
		if half==1 then
			parse("setmoney "..id.." "..player(id,"money") + 800)
		elseif full==0 then
			parse("setmoney "..id.." "..player(id,"money") + 16000)
		end
	end
end

it works

tnx pikachu and vesa
To the start Previous 1 2228 229 230338 339 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview