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 263 64 65338 339 Next To the start

old Re: Lua Scripts/Questions/Help

SQ
Moderator Off Offline

Quote
You want to make message on spray action which would say
"player put spray on x,y" ?

It should be posible with spray hook, but its not work.

old ...

Toa Hero 92
User Off Offline

Quote
you said that already...pls help me

old Re: Lua Scripts/Questions/Help

SQ
Moderator Off Offline

Quote
Toa Hero 92 has written
you said that already...pls help me

Yes, I said it already.
I cant help you! No one cant, spray hook not works.

So it means that Lua cant know when you are spraying.

old Great...

Toa Hero 92
User Off Offline

Quote
Is there no other way to get the position of a player displayed on demand?

I need this because On my server my maps are Huge! and i need a way to find player quick so i can set my pos to their pos, and for other reason that would make this script very useful... so pls help me! ANYONE!


I just had and idea... can it tell when someone pushes "t" or some other button that I can define(like alt)?

Because if so then could you show me how to implement it to work like this?

1
2
3
4
5
6
-- addhook("spray","spraytxty")
-- function spraytxty(id)

-- parse("sv_msg ©017213149 "..player(id,"name").." put a spray at "..player(id,"tilex").." "..player(id,"tiley").." !")

-- end
edited 2×, last 07.10.09 07:44:10 pm

old Re: Lua Scripts/Questions/Help

Heartless Soldier
User Off Offline

Quote
N-B-K has written
I have a little question :P.

Can u change an entity settings with a lua script? for example i want to change the X offset of an image, is it possible?

tank u if u answer me :D.



sorry for my english im from Argentina xD.

good luck for all!



somebody can help me?

old Re: Lua Scripts/Questions/Help

SQ
Moderator Off Offline

Quote
@Toa Hero
Try this (press f2 ,1st serveration to see message):

1
2
3
4
5
6
addhook("serveraction","serv")
function serv(p,a)
	if (a == 1) then
		msg2(p,'Your position: x = '..player(p,"tilex")..', y = '..player(p,"tiley"))
	end
end

old My Continuing Problems

Toa Hero 92
User Off Offline

Quote
Blazzingxx has written
@Toa Hero
Try this (press f2 ,1st serveration to see message):

1
2
3
4
5
6
addhook("serveraction","serv")
function serv(p,a)
     if (a == 1) then
          msg2(p,'Your position: x = '..player(p,"tilex")..', y = '..player(p,"tiley"))
     end
end


Ok, I will try that. But first I have now made these

1
2
3
4
5
6
7
--Tile Position
	if (txt=="my tile position") then
	parse("sv_msg ©224027036 "..player(id,"name").." is at tile "..player(id,"tilex").." for X & at tile "..player(id,"tiley").." for Y @C"); end
	
	          --Pixel Position
	if (txt=="my pixel position") then
	parse("sv_msg ©224027036 "..player(id,"name").." is at pixel "..player(id,"x").." for X & at pixel "..player(id,"y").." for Y @C"); end

but I got this message when I tried to implement it

LUA ERROR: sys/lua/samples/sayfunctions.lua:36: bad argument #1 to 'player' (number expected, got nil)

Now, remember that I put most of my scripts in the sayfunctions script.

I put those inside the original sayfunction script function block.

So, what did I do wrong?

and your thing works

old Re: Lua Scripts/Questions/Help

SQ
Moderator Off Offline

Quote
@Toa Hero 92
1
2
3
4
5
6
7
8
9
addhook("say","says")
function says(id,txt)
	if (txt=="tile") then
		parse("sv_msg ©224027036 "..player(id,"name").." is at tile "..player(id,"tilex").." for X & at tile "..player(id,"tiley").." for Y @C")
	end
	if (txt=="pixel") then
		parse("sv_msg ©224027036 "..player(id,"name").." is at pixel "..player(id,"x").." for X & at pixel "..player(id,"y").." for Y @C")
	end
end

Use words:
tile, pixel
Note: Do not use caps lock when writing command!

Btw, I suggest to restart CS2D when you often changing hooks

old Re: Lua Scripts/Questions/Help

Heartless Soldier
User Off Offline

Quote
N-B-K has written
N-B-K has written
I have a little question :P.

Can u change an entity settings with a lua script? for example i want to change the X offset of an image, is it possible?

tank u if u answer me :D.



sorry for my english im from Argentina xD.

good luck for all!


i really need help, if it isnt possible just tell me

old Re: Lua Scripts/Questions/Help

Flacko
User Off Offline

Quote
N-B-K has written
N-B-K has written
N-B-K has written
I have a little question :P.

Can u change an entity settings with a lua script? for example i want to change the X offset of an image, is it possible?

tank u if u answer me :D.



sorry for my english im from Argentina xD.

good luck for all!


i really need help, if it isnt possible just tell me


Nope

old Re: Lua Scripts/Questions/Help

saladface27
User Off Offline

Quote
In my mod there are two spawning areas - defending and attacking.

in both spawn areas there are info_t and info_ct.

the spawn points are called t_atk,ct_atk (in the attacking area) and t_def and ct_def in the defending area.

my lua script triggers the spawn points so that there is only one in each area (eg. terrorists spawn in the defending area and cts in the attacking), but the cts still spawn in the terrorist area, and vice versa.

is there any way to fix this?

old Re: Lua Scripts/Questions/Help

playa slaya
COMMUNITY BANNED Off Offline

Quote
how can i make a console command with parses
Example:
setmaxhealth <id> <ammount>


that is only example

also isn't there a hook for team kills i looked in info.txt but did not see it

old Re: Lua Scripts/Questions/Help

Admir
User Off Offline

Quote
how do I make that player change team and auto revive
in last place where his press select menu.

for example:

1
2
3
4
5
6
7
addhook("menu",test.menu")
function test.menu(id,menu,sel)
	if sel==1 then
		parse("makect "..id)
		parse("spawnplayer "..id.." '..x..' '..y..'")
	end
end

old Re: Lua Scripts/Questions/Help

Vibhor
User Off Offline

Quote
NO they cant
can linux guys fast building script make dispensers next to each other?
can his fast building script create tripple turrets at once?

old Re: Lua Scripts/Questions/Help

SQ
Moderator Off Offline

Quote
Vibhor has written
NO they cant
can linux guys fast building script make dispensers next to each other?
can his fast building script create tripple turrets at once?

LOL, thats stu*id...
Becouse its almost same script.

Different build command ids are different turret levels.
And yeah, his build script alows to build dispencers close each other.

old Re: Lua Scripts/Questions/Help

Flacko
User Off Offline

Quote
playa slaya has written
how can i make a console command with parses
Example:
setmaxhealth <id> <ammount>


that is only example

also isn't there a hook for team kills i looked in info.txt but did not see it


1- Use addhook("parse","your_function"), and parse it
2- Use your brain.
1
2
3
4
5
6
addhook("kill","killteammate")
function killteammate(killer,victim)
	if(player(killer,"team") == player(victim,"team")) then
		parse("sv_msg OMFG, "..player(killer,"name")..", how could you kill "..player(victim,"name").."? He was your teammate!!")
	end
end

Vibhor has written
NO they cant
can linux guys fast building script make dispensers next to each other?
can his fast building script create tripple turrets at once?


I couldn't read the script because download is not possible, all that I'm going to say is what I guess:
My imagination has written
That script uses a different hook, that bugs like hell, I did a script like that and fixed it when I noticed bugs (I guess).

You shouldn't deprecate linuxguy's script, specially because he could make that thing if he wished so. And I think that instant triple turrets are gay, just like instant shitloads of turrets...

Edit:
Quote
uhm hi is there a way to make people to join a team quickly after he joins the server ? ( i mean in milliseconds)

Uhh, try this:
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
function playersonteam(team)
	local count
	for i=1,32 do
		if(player(i,"team")==team) then
			count = count + 1
		end
	end
	return count
end

addhook("join","autoteamchose")
function autoteamchose(id)
	if(playersonteam(1)>playersonteam(2)) then
		parse("maket "..id)
	elseif(playersonteam(2)>playersonteam(1)) then
		parse("makect "..id)
	else
		local newteam = math.rand(1,2)
		if(newteam==1) then
			parse("maket "..id)
		else
			parse("makect "..id)
		end
	end
end
edited 2×, last 09.10.09 09:33:41 pm
To the start Previous 1 263 64 65338 339 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview