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 2330 331 332338 339 Next To the start

old Re: Lua Scripts/Questions/Help

8balldandy
User Off Offline

Quote
what about that the admins can only be ct and t only users(non-admin) and how to make admin entering with pgun but not ever droping it
and how to make admin certain people and where to put it?

old Re: Lua Scripts/Questions/Help

Blacko
User Off Offline

Quote
Hi, I search a script for my consruction map. When a player choose to build a turret, he can choose Simple Turret, Dual Turret or Triple Turret. Thanks you !

old Re: Lua Scripts/Questions/Help

Yasday
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
23
24
addhook([[build]],[[builder]])
function builder(id,type,x,y,mode,objectid)
	if type == 8 then
		menu(id,[[Turret,Normal Turret,Double Turret,Tripple Turret]])
		return 1
	end
end

addhook([[menu]],[[menuer]])
function menuer(id,men,sel)
	if men == [[Turret]] then
		local rot = player(id,"rot")
		local team = player(id,"team")
		local x = player(id,"tilex")
		local y = player(id,"tiley")
		if sel == 1 then
			parse([[spawnobject 8 ]]..x..[[ ]]..y..[[ ]]..rot..[[ 0 ]]..team..[[ ]]..id)
		elseif sel == 2 then
			parse([[spawnobject 11 ]]..x..[[ ]]..y..[[ ]]..rot..[[ 0 ]]..team..[[ ]]..id)
		elseif sel == 3 then
			parse([[spawnobject 12 ]]..x..[[ ]]..y..[[ ]]..rot..[[ 0 ]]..team..[[ ]]..id)
		end
	end
end

try this ...

old Re: Lua Scripts/Questions/Help

Blacko
User Off Offline

Quote
Oh, the menu appear, the turret choosen (simple, dual, triple) appear but when I choose "Turret" (simple button) a simple turret appear so two turrets appear

old Re: Lua Scripts/Questions/Help

Casper-
User Off Offline

Quote
will this work in bot ai lua file? (the "Standard AI.lua" file ?)

1
2
3
4
5
6
7
8
9
10
addhook("ai_goto","zmgo")
function zmgo(id,x,y)
[and i should write here other stuff (which i dont know)]
end

or

addhook("ai_goto","zmgo")
function zmgo(id,32,64)
end

old Re: Lua Scripts/Questions/Help

RyceR
User Off Offline

Quote
@Blazzing but how to sat no only big letters (no any1 like: RyceR [ADMIN]: Hi) and no only small...
like when i use:
NewMember(15101,"orange","ViP")
when i say anything it will be like that:
RyceR [ViP]: Hi
plz help, here is your script but edited...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
-- Script By Blazzingxx
Colors = { grey = "195195195", orange = "255090000", green = "105255000", purple = "190000190" }
AdminTable = { }

addhook("say","AdminSay")

function NewMember(USGN,COLOR,RANK)
     AdminTable[USGN] = { C = COLOR, R = RANK}
     local A = AdminTable[USGN]
end

function AdminSay(P,T)
     local A = AdminTable[player(P,"usgn")]
     if A then
          msg("©"..Colors[string.lower( A.C )]..player(P,"name").." ["..string.upper( A.R ).."]: "..T)
          return(1)
     end
     return(0)
end

NewMember(15101,"orange","Admin")

old Re: Lua Scripts/Questions/Help

DannyDeth
User Off Offline

Quote
What you need to do ( using the script above ) is too call the function "NewMember" with the correct parameters. So say you wanted to add a guy with the USGN id of "15933", his rank VIP and his colour grey, you would put this in there:

1
NewMember("15933",Color[grey],"VIP")

old Re: Lua Scripts/Questions/Help

DannyDeth
User Off Offline

Quote
1
2
3
FILE = io.open (filename , "r+")
O_FILE = io.output(FILE)
O_FILE:write("YOUR_CODE_GOES_HERE")

That should do the job correctly, I think. Didn't test it though.

old Re: Lua Scripts/Questions/Help

Casper-
User Off Offline

Quote
BureX has written
1
2
3
4
5
6
7
8
9
10
addhook("ai_goto","zmgo")
function zmgo(id,x,y)
[and i should write here other stuff (which i dont know)]
end

or

addhook("ai_goto","zmgo")
function zmgo(id,32,64)
end


Can i make "ai_goto" more of them ? like every random bot goes to random "ai_goto" and starts to attack when destination is reached ? (nvm i forgot to copy paste)
edited 2×, last 23.12.10 12:18:38 pm

old Re: Lua Scripts/Questions/Help

TDShuft
User Off Offline

Quote
@Yasday and @DennyDeth
does it make "new line"
like if the script has 10 lines
it makes one more line but writed with the script that i want

old Re: Lua Scripts/Questions/Help

DannyDeth
User Off Offline

Quote
@Burex:
We aren't ignoring u neccisarily
And yes, the code should work, since there isn't much to make bugs anyway.

@TDShuft:
It's DannyDeth
And what will happen is this:
File before writing:
1
2
3
4
5
------------------
-- TEST            --
------------------

msg "B4 Writing to file"
And then I wrote
1
msg "Now it is after :P"
to the file.

The file should look like this:
1
2
3
4
5
6
------------------
-- TEST            --
------------------

msg "B4 Writing to file"
msg "Now it's after :P"
If you had pressed enter after the first msg call. If you hadn't done that you would get this:
1
2
3
4
5
------------------
-- TEST            --
------------------

msg "B4 Writing to file"msg "Now it's after :P"

So when you are writing to the file it is best to put a "\n" before the rest of your code to be sure

old Re: Lua Scripts/Questions/Help

TDShuft
User Off Offline

Quote
what do you mean with /n ? where do i put it ?
like this > ?
1
2
3
FILE = io.open (filename , "/n")
O_FILE = io.output(FILE)
O_FILE:write("YOUR_CODE_GOES_HERE")

old Re: Lua Scripts/Questions/Help

DannyDeth
User Off Offline

Quote
No, what I meant is you put the \n beore the part whre it says YOUR_CODE_GOES_HERE, becasue \n is a newline character, it will make sure you do not end up writing onto one line and messsing up your code.
I will show you a working example.
1
2
3
FILE = io.open("THE_FILENAME.lua", "THE_MODE ( I reccomend "a" or "r+" )")
FILE:write('\n msg "the \ n thing makes a newline before your code "')
FILE:close()

old Re: Lua Scripts/Questions/Help

TDShuft
User Off Offline

Quote
oh another thing i want to edit a table on the server like i have a admin script it is like
admins={"1,2,3,4,5"} and like that (obvious ill puted not 1-5 usgns lol)
how can i edit to put ,6 and is there any how ?

old Re: Lua Scripts/Questions/Help

DannyDeth
User Off Offline

Quote
This code by BlazzingEyed fits the bill perfectly normally, maybe you want to check it out:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
-- Script By Blazzingxx
Colors = { grey = "195195195", orange = "255090000", green = "105255000", purple = "190000190" }
AdminTable = { }

addhook("say","AdminSay")

function NewMember(USGN,COLOR,RANK)
	AdminTable[USGN] = { C = COLOR, R = RANK}
	local A = AdminTable[USGN]
end

function AdminSay(P,T)
	local A = AdminTable[player(P,"usgn")]
	if A then
		msg("©"..Colors[string.lower(A.C )]..player(P,"name").." ["..string.upper( A.R ).."]: "..T)
	return(1)
	end
	return(0)
end

NewMember(15101,"orange","Admin")
You simply call the function AddMember("THEIR USGN",Color[THEIR COLOR], "THEIR RANK")
To the start Previous 1 2330 331 332338 339 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview