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 2179 180 181338 339 Next To the start

old Re: Lua Scripts/Questions/Help

Flacko
User Off Offline

Quote
Decks has written
but that scrypt can be very helpful in matches

Make it by yourself and claim the infinite honour (and therefore, print your name in the humanity's history) for making a useful script for CS2D.

old Re: Lua Scripts/Questions/Help

Flacko
User Off Offline

Quote
Here
info.txt has written
build(id,type,x,y,mode,objectid)               on (effective) build
-id: player id
-type: building type
-x: building x (tiles)
-y: building y (tiles)
-mode: building mode
-objectid: id of new building object
>return:     0 - proceed normally
          1 - don't build


However, I don't know how would you get the id of a building you have created through parsing/command line.
Edit:
Maybe
1
2
3
--parse(make some building)
local asd = object(0,"table")
local building_id = asd[#asd] --The last item should be the newest building, right?

old Re: Lua Scripts/Questions/Help

Flacko
User Off Offline

Quote
building_id will store the last dynamic object(asd[#asd]) in the dynamic objects table, so if you call it in the build hook, you will be calling it inmediatly and therefore, before any other building gets built.
edited 1×, last 23.03.10 11:11:03 pm

old Re: Lua Scripts/Questions/Help

archmage
User Off Offline

Quote
Well, I made some functions. I do not know if anyone will be able to use them, but here they are.
Spoiler >

I am not sure if anyone needs them but you might beable to use io.copy for quickly backing up data
use them as you please but at least have the dignity to give me credit

old Re: Lua Scripts/Questions/Help

Flacko
User Off Offline

Quote
You could improve your io.copy by reading all the file at once and writing it. Instead of reading line per line, concatenating and then writing.
Like this:
1
2
3
4
5
6
7
8
9
10
11
12
function io.copy(old,new)
	old = assert(io.open(old,"r"),"FILE NOT FOUND")
	new = io.open(new,"r")
	if not new then
		new=io.open(new,"w")
	else
		error("FILE ALREADY EXISTS")
	end
	new:write(old:read("*a"))
	old:close()
	new:close()
end
edited 1×, last 25.03.10 05:18:06 am

old Re: Lua Scripts/Questions/Help

Patasuss
User Off Offline

Quote
I want to spawn a player with a M4A1 .
But i don't want that he has full ammo.
Can I strip ammo in Lua?

The Code:
1
2
3
4
5
addhook("spawn","mspawn")
function mspawn(id)
	parse("equip "..id.." 42")
	--How to strip ammo?
end

old Re: Lua Scripts/Questions/Help

Cure Pikachu
User Off Offline

Quote
Patasuss has written
I want to spawn a player with a M4A1 .
But i don't want that he has full ammo.
Can I strip ammo in Lua?

The Code:
1
2
3
4
5
addhook("spawn","mspawn")
function mspawn(id)
	parse("equip "..id.." 42")
	--How to strip ammo?
end

Ugh, you can't strip ammo (I am not sure how). And 42 isn't M4A1. It's 32.

old Re: Lua Scripts/Questions/Help

Szkieletor
User Off Offline

Quote
I'd like a script with another money container, so I can have more than 16,000$ at a time. Like the script in [CC]RolePlay server. I've searched the forums for it, but couldn't find one. Can someone help me please?

old Re: Lua Scripts/Questions/Help

Patasuss
User Off Offline

Quote
Here you can have my script (i know that it's buggy)
It also haves a weapon store.
Spoiler >

You are allowed to edit it.
But please do not claim as your own and if you
modify this script and give it to another person please give credits and do not cut out the information at the top of the file.

old Re: Lua Scripts/Questions/Help

siuL
User Off Offline

Quote
where i can download the cc rp script theres alot of ppl with it , i did enter on alot of servers with it

but isnt the same have less things but i want to have it ...

old Re: Lua Scripts/Questions/Help

0ito
User Off Offline

Quote
someone help me for sound environmental and shopping menu with infection bomb, rage zombie , antidote , armors and weapons?
please help-me FAST!

old Re: Lua Scripts/Questions/Help

Fehu
User Off Offline

Quote
Need help.How to make 1 times use button ? here is my script:
Spoiler >

old Re: Lua Scripts/Questions/Help

Flacko
User Off Offline

Quote
You could make a check if the player has already used that button (use a table for each player) when he presses it, if the value is false, make something and change the value to true, if the value is true, give a msg to the player saying sth like "You can use this only once"

old Re: Lua Scripts/Questions/Help

Fehu
User Off Offline

Quote
Yes, but i can make only menu in lua ... and more noobs items ...

/Edit/

Omg help Me!!! o.o
edited 1×, last 27.03.10 07:11:38 pm

old Re: Lua Scripts/Questions/Help

Flacko
User Off Offline

Quote
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
asked_for_help_in_us = {}
for i=1,32 do asked_for_help_in_us[i] = false end
addhook("say","_say_")
function _say_(id,t)
	if t=="helpmewithmyluascript" then
		menu(id,"Chose where will you ask for help:, Google.com|Fast and easy, Common Sense|Not widely used but very effective,Unrealsoftware.de|Maybe the guys know what the hell is wrong")
	end
end

addhook("menu","_menu_")
function _menu_(id,t,b)
	if t == "Chose where will you ask for help:" then
		if b == 3 then
			if asked_for_help_in_us[id] == false then
				print("Posting in Lua Scripts/Questions/Help")
				asked_for_help_in_us[id] = true
			else
				parse('sv_msg2 '..id..' "You have already asked for help, don't spam the forums" ')
			end
		end
	end
end

old Re: Lua Scripts/Questions/Help

Fehu
User Off Offline

Quote
Nice , but:
1
parse('sv_msg2 '..id..' "You have already asked for help, don't spam the forums" ')
is bad..

true is:
1
msg2(id,"You have already asked for help, don't spam the forums")
To the start Previous 1 2179 180 181338 339 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview