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 254 55 56338 339 Next To the start

old Re: Lua Scripts/Questions/Help

phihung940
User Off Offline

Quote
Can you help me make this script:

Name: Ghost Mode
Author: your nick name
Update: Day/Morth/Year

Server setting:
Gamemode: Standard (Plant C4)
FoW: no
Friendly Fire: no
USGN: No
Offline: No
Time per round: 5 min
Round limit: 13 round
Win limit: 13 round
Spawn money: 2000$

Server acction:
F2 = Special menu:
1) GR special weapon: (for CT only)
-a) Defeuse kit 7000$
-b)Kevlar + Helm 3500$
-c) Molotov Cocktail 5000$
-d) Laser Mine 5000$
-e) Flame thrower 14500$
-f) close
2) BL special weapon: (for T only)
-a) Flashbang 5000$
-b) Gasgrenade 13000$
-c) Mine 10000$
-d) Night Vision 3000$
-e) close
3) Close menu

TEAM INFOR:
CT: Can buy weapon in my menu weapon edit (not Classic menu)
-Primary weapons in menu 1: (use the $)
1) M4A1
2) AK-47
3) M249
4) Scout
5) AWP
6) SG550
7) XM1014
M3
9) MP5
10) P90
11) Close
Next chose secondary weapons in menu 2: (Free)
=ALL Secondary weapon=
-> chose weapon done ! all players will have 4 grenade (1 HE,2 Flash ,1 smoke)

T: When the game started , all player will have a Stealth suit.
-Change character info to be:
+Hearth: 200
+Speed: 130%
+Armor: None
-T can buy weapons in menu : (Melee weapons only)
1) Machete: 5000 $
2) Wrench: 2000 $ (i want damage of this weapon more of Knife)
3) Chainsaw: 12000 $
ANOTHER of Terrorists:
-When T DEAD , nothing droped (C4 Drop only !)
-T canot pick any weapons. (can pick C4 only)
-T canot drop the Melee weapon. (can drop special weapon)

So ! that it , can you help me. Please i really really really..... Need this script :(( Thank you so so so so so so so.................................. muchhh !
edited 1×, last 14.09.09 10:27:59 am

old Re: Lua Scripts/Questions/Help

ohaz
User Off Offline

Quote
syntaku has written
ok i have a request(hope this is were to post it)
Well im making a bomberman server and i cant learn lua (so... complicated.... ) what i need is a script so that
•uses money as time

•unlimited grenades

•when you "throw" a grenade it stays at your feet and detonates after 3 seconds

> is it possible?
It's not really complicated to learn lua. Just try this one. it helped some people here
unlimited grenades is possible.
"throwing" grenades like this... don't know.
uses money as time -> ???

old Re: Lua Scripts/Questions/Help

4erteg
User Off Offline

Quote
addhook("say","sample.sayfuncs.say")
function sample.sayfuncs.say(id, text)
if(text=="!lvl") then
msg ("You have " ..sample.gg.level[id].. " lvl!")
end
end
end

that place of script to lvls

but when i say "!lvl" in console print

PANIC: unprotected error in call to Lua API (attempt to index a nil value)
help please
edited 1×, last 14.09.09 05:13:27 pm

old Re: Lua Scripts/Questions/Help

ohaz
User Off Offline

Quote
1
2
3
4
5
6
7
addhook("say","[b]player_say[/b]")
function player_say[b](id, txt)[/b]
     if [b] txt = "!lvl"[/b] then
        msg[b]2[/b]([b]id,[/b]"You lvl is "..sample.gg.level[id].." now!")
     end
end
end
addhook and function must have the same name

old Re: Lua Scripts/Questions/Help

4erteg
User Off Offline

Quote
TheKilledDeath has written
1
2
3
4
5
6
7
addhook("say","[b]player_say[/b]")
function player_say[b](id, txt)[/b]
     if [b] txt = '!lvl[/b] then
        msg[b]2[/b]([b]id,[/b]"You lvl is " sample.gg.level[id] " now!")
     end
end
end
addhook and function must have the same name

big thanks but i do this

addhook("say","sample.sayfuncs.say")
function sample.sayfuncs.say(id, text)
if(text=="!lvl") then
msg ("You have " ..sample.gg.level[id].. " lvl!")
end
end
end

but when i say "!lvl" in console print


PANIC: unprotected error in call to Lua API (attempt to index a nil value)
help please


and whit you variant too =(

old Re: Lua Scripts/Questions/Help

Flacko
User Off Offline

Quote
4erteg, you haven't declared the table that you are using
1
sample.gg.level[id]

Try this:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
function initArray(s,v)
	local buff = {}
	for i=1,s do
		buff[i]=v
	end
	return buff
end

sample.gg.level(32,0)

addhook("say","player_say")
function player_say(id, txt)
	if txt = "!lvl" then
		parse("sv_msg2 "..id.." Your lvl is "..sample.gg.level[id].." now!"
	end
end

old Re: Lua Scripts/Questions/Help

4erteg
User Off Offline

Quote
Flacko has written
4erteg, you haven't declared the table that you are using
1
sample.gg.level[id]

Try this:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
function initArray(s,v)
	local buff = {}
	for i=1,s do
		buff[i]=v
	end
	return buff
end

sample.gg.level(32,0)

addhook("say","player_say")
function player_say(id, txt)
	if txt = "!lvl" then
		parse("sv_msg2 "..id.." Your lvl is "..sample.gg.level[id].." now!"
	end
end


its wrie me

LUA ERROR: sys/lua/samples/mlvls.lua:19: attempt to index field 'gg' (a nil value)

that my code please corect if can....
Spoiler >

old Re: Lua Scripts/Questions/Help

playa slaya
COMMUNITY BANNED Off Offline

Quote
hey, is it possible to type somthing like !speed or !health
then type 100 and your health\speed to 100?Iwas working on a script and i was going to type

parse("sethealth "..id.." 1")
parse(speedmod "..id.." 1")

and add the nunbers until 100

--Im writing from computer class while teach is gone lol

old Re: Lua Scripts/Questions/Help

Admir
User Off Offline

Quote
1
2
3
4
5
6
7
8
function say(id,message)
	if (message=="!speed") then
		parse("speedmod "..id.." 100")
	end
	if (message=="!health") then
		parse("sethealth "..id.." 100")
	end
end

this is only work for who typing on it.

old Re: Lua Scripts/Questions/Help

playa slaya
COMMUNITY BANNED Off Offline

Quote
i know that but i want to type !speed #
and the # is the number of speed if you type !speed 1 then speed is one if type !speed 2 then speed is 2 if !speed 3 then speed is 3 and so forth
example player types !speed 3 then his speed is 3
but i want without having very long script to do so

old closed Bots Help

dre187killz
User Off Offline

Quote
K Well when i test my server i play with bots
and i made my own map and all the bots do
is walk around in a circle how do i make them walk around the map?? pls and ty

old Re: Lua Scripts/Questions/Help

sonnenschein
User Off Offline

Quote
playa slaya has written
i know that but i want to type !speed #
and the # is the number of speed if you type !speed 1 then speed is one if type !speed 2 then speed is 2 if !speed 3 then speed is 3 and so forth
example player types !speed 3 then his speed is 3
but i want without having very long script to do so

TheKilledDeath made that script

1
2
3
4
5
6
7
addhook("say", "speedme")
function speedme(id,txt)
	if (string.sub(txt, 1, 6) == "!speed") then
		speed = tonumber(string.sub(txt, 8, string.len(txt)))
		parse("speedmod "..id.." "..speed)
	end
end

old Re: Lua Scripts/Questions/Help

saladface27
User Off Offline

Quote
how to read a .txt file in the directory ...sys/lua/map_lua where the filename is the same as the current mapname?

also, if the first two lines of the file that im trying to read is

25
30

then how will I put those 2 numbers into variables (eg. xyz = 25, abc = 30)?

old Re: Lua Scripts/Questions/Help

4erteg
User Off Offline

Quote
how i can remove 1k money from player when he write "!rull"?

and how i can randomize?

r = math.random(0, 5)
if r == 0 then
parse("equip " ..id.. " 53")
parse("setmoney " ..id.. " 0")
end

when i say "!rull" every relogin he give me one to one nums

example:
5, 1, 0 ,3 .................. 3, 2 ............

and it every relogin
edited 1×, last 15.09.09 03:19:34 pm

old Waypoints

dre187killz
User Off Offline

Quote
i need a script

so when server starts
if your a CT BOT it will walk to X,Y,Z position
then goto a Next Position like a circle around the map
thx

old Re: Lua Scripts/Questions/Help

LilCoder
BANNED Off Offline

Quote
saladface27 has written
how to read a .txt file in the directory ...sys/lua/map_lua where the filename is the same as the current mapname?

also, if the first two lines of the file that im trying to read is

25
30

then how will I put those 2 numbers into variables (eg. xyz = 25, abc = 30)?


1
2
3
4
5
6
7
8
9
10
11
12
13
variable = {0,0}

function readValues()
local i = 0
local mapname = map("name")
file = io.open("sys/lua/map_lua/"..mapname)
	for line in file:lines() do
		i = i+1
		variable[i] = tonumber(line)
	end
end

readValues()

old Re: Lua Scripts/Questions/Help

Flacko
User Off Offline

Quote
LilCoder has written
1
2
3
4
5
6
7
8
9
10
11
12
13
variable = {0,0}

function readValues()
local i = 0
local mapname = map("name")
file = io.open("sys/lua/map_lua/"..mapname)
	for line in file:lines() do
		i = i+1
		variable[i] = tonumber(line)
	end
end

readValues()


I think it's a bit better this way:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
variable = {0,0}

function readValues()
local i = 0
local mapname = map("name")
file = assert(io.open("sys/lua/map_lua/"..mapname,"r"))
	for line in file:lines() do
		i = i+1
		variable[i] = tonumber(line)
	end
	file:close()
end

readValues()
To the start Previous 1 254 55 56338 339 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview