Forum

> > CS2D > Scripts > Lua Scripts/Questions/Help
ForenübersichtCS2D-Übersicht Scripts-ÜbersichtEinloggen, um zu antworten

Englisch Lua Scripts/Questions/Help

6.770 Antworten
Seite
Zum Anfang Vorherige 1 2179 180 181338 339 Nächste Zum Anfang

alt Re: Lua Scripts/Questions/Help

Flacko
User Off Offline

Zitieren
Decks hat geschrieben
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.

alt Re: Lua Scripts/Questions/Help

Flacko
User Off Offline

Zitieren
Here
info.txt hat geschrieben
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?

alt Re: Lua Scripts/Questions/Help

Flacko
User Off Offline

Zitieren
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.
1× editiert, zuletzt 23.03.10 23:11:03

alt Re: Lua Scripts/Questions/Help

archmage
User Off Offline

Zitieren
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

alt Re: Lua Scripts/Questions/Help

Flacko
User Off Offline

Zitieren
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
1× editiert, zuletzt 25.03.10 05:18:06

alt Re: Lua Scripts/Questions/Help

Patasuss
User Off Offline

Zitieren
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

alt Re: Lua Scripts/Questions/Help

Cure Pikachu
User Off Offline

Zitieren
Patasuss hat geschrieben
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.

alt Re: Lua Scripts/Questions/Help

Szkieletor
User Off Offline

Zitieren
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?

alt Re: Lua Scripts/Questions/Help

Patasuss
User Off Offline

Zitieren
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.

alt Re: Lua Scripts/Questions/Help

siuL
User Off Offline

Zitieren
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 ...

alt Re: Lua Scripts/Questions/Help

0ito
User Off Offline

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

alt Re: Lua Scripts/Questions/Help

Fehu
User Off Offline

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

alt Re: Lua Scripts/Questions/Help

Flacko
User Off Offline

Zitieren
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"

alt Re: Lua Scripts/Questions/Help

Fehu
User Off Offline

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

/Edit/

Omg help Me!!! o.o
1× editiert, zuletzt 27.03.10 19:11:38

alt Re: Lua Scripts/Questions/Help

Flacko
User Off Offline

Zitieren
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

alt Re: Lua Scripts/Questions/Help

Fehu
User Off Offline

Zitieren
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")
Zum Anfang Vorherige 1 2179 180 181338 339 Nächste Zum Anfang
Einloggen, um zu antworten Scripts-ÜbersichtCS2D-ÜbersichtForenübersicht