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 2293 294 295338 339 Next To the start

old Re: Lua Scripts/Questions/Help

FlooD
GAME BANNED Off Offline

Quote
CmDark has written
@Flood yeah I used to use that but eh.. gotta add extra stuff into table and if you wanted to do that in game..eh better to use loop.

and the second thing, I did understand, the mouse pointer uses the screen x and y, which would be something that you could try to "emulate" with hudtxt

could you explain wut extra stuff you are talking about?

btw i'm pretty sure he's not talking about a new pointer. he wants the position of the pointer... well that's how i understood him.

old Re: Lua Scripts/Questions/Help

CmDark
User Off Offline

Quote
He's not, I am.
My reasoning is: If you can create a new pointer with hudtxt, you can get the x and y of the screen with a function .. maybe when DC implements it
something like mouse("xpos"),("ypos") or something
and get position of mouse.......

So currently the answer to the question is No, you cannot.


Extra stuff=me saying it would be more complex having to insert it into a table that way.

old Re: Lua Scripts/Questions/Help

FlooD
GAME BANNED Off Offline

Quote
i dont understand what you would insert that would make it more complex than another method...

this is what i use:
1
2
3
admins={}
admins[13962]={"FlooD","080210255"}
etc...
admins[usgnid][1] is the admin's name
admins[usgnid][2] is the admin's @say color
and so on...

to change that in-game (though changed settings are not saved in a file), just do rcon lua admins[13962][1]='MyNewName'

old Re: Lua Scripts/Questions/Help

Flacko
User Off Offline

Quote
TDShuft has written
is there how to see mouse x and y ?
EDIT: NOT ROTATION THE MOUSE X AND Y ALSO NOT WHILE ATTACKING OR SHOOTING ANYTHING..

It's not possible. you can only try to guess it's position using the player's rotation.

old Re: Lua Scripts/Questions/Help

EngiN33R
Moderator Off Offline

Quote
So anyways I have a question too, how do I multiply weapon damage for a single player, and don't tell me about sethealth function, I mean multiply damage so it would kill players properly, not 'Someone died', if it's at least possible.

old Re: Lua Scripts/Questions/Help

CmDark
User Off Offline

Quote
Fine GlockPwner! I won't tell you that you could check if the damage of the multiplied damage was higher(or equal to the health) than the health of the victim and that you could set it to a customkill............. yeah that's what I didn't tell you.
Oh and sethealth is a cs2d command, not a function^*
edited 1×, last 28.10.10 09:09:48 am

old Timer

maPmaKer
User Off Offline

Quote
Does anybody know how to make a HUD with a timer in the bottom-right corner of the screen like this:

A timer with 4 hours countdown, when it reaches 0 (countdown 0) it does a round restart, or triggers an entity from the map.

Can anybody help me please with the code>??

Thanks!
maPmaKer

old Re: Lua Scripts/Questions/Help

Blacko
User Off Offline

Quote
Hellooo ! I need your help !
> I search a script for make a NPC in my server, as in RPG map ! This NPC is in a position map and when a player say to him "hi" the NPC answer "Hi, do you want to be an Admin ?" and if the player say "yes" the NPC answer "Ok, so register at *website*" ... It's similar that in the RPG map !
I don't know if it's possible but I hope !
Please help !
Thanks you a lot !

old Re: Lua Scripts/Questions/Help

sixpack
User Off Offline

Quote
iDios has written
Hellooo ! I need your help !
> I search a script for make a NPC in my server, as in RPG map ! This NPC is in a position map and when a player say to him "hi" the NPC answer "Hi, do you want to be an Admin ?" and if the player say "yes" the NPC answer "Ok, so register at *website*" ... It's similar that in the RPG map !
I don't know if it's possible but I hope !
Please help !
Thanks you a lot !


Use the following:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
tile1 = 50 --Use map editor to find TileX of the tile
tile2 = 60 --Use map editor to find TileY of the tile
addhook("say", "egw")
function egw(id, txt)
if(player(id, "tilex")==tile1) then
if(player(id, "tiley")==tile2) then
if(txt=="hi") then
msg2(id, "©255255255Do you want to be an admin?")
end
if(txt=="yes") then
msg2(id, "©000255000Then register to www.daknob.com!")
end
end
end
end
edited 1×, last 28.10.10 03:14:34 pm

old Re: Lua Scripts/Questions/Help

sixpack
User Off Offline

Quote
iDios has written
@DaKnOb
No he don't work, the NPC don't appear

This is the script to make players when they say hi in a part of the map, the system will respond.
Now you have to place the NPC using the map editor!

maPmaKer has written
Does anybody know how to make a HUD with a timer in the bottom-right corner of the screen like this:

A timer with 4 hours countdown, when it reaches 0 (countdown 0) it does a round restart, or triggers an entity from the map.

Can anybody help me please with the code>??

Thanks!
maPmaKer

Use the following:
1
2
3
4
5
6
7
8
9
10
apomenun = 239
addhook("minute", "lepto")
function lepto()
apomenun = apomenun - 1
if(apomenun==0) then
parse("restart");
parse("trigger <nameOFentity>); --Example: trigger mapmaker
parse('hudtxt "Round restart in '..apomenun..' minutes!" 1 15');
end
end

old Re: Lua Scripts/Questions/Help

HaRe
User Off Offline

Quote
Snake_Eater has written
Hi all is it possible to delet a text file with io.function?


its not possible with io.function but its possible with os.function

Read more here

os.remove (filename)
Deletes the file or directory with the given name. Directories must be empty to be removed. If this function fails, it returns nil, plus a string describing the error.

old Re: Lua Scripts/Questions/Help

EngiN33R
Moderator Off Offline

Quote
@iDios
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
function initArray(m)
	local array = {}
	for i = 1, m do
		array[i]=0
	end
	return array
end
npcstate=initArray(32)
-- change position to yours
tile1 = 1337
tile2 = 1337
addhook("say", "npctalk")
function npctalk(id,t)
if(player(id, "tilex")==tile1 and player(id, "tiley")==tile2) then
if(txt=="hi" and npcstate[id]==0) then
msg2(id, "©255255255Do you want to be an admin?")
npcstate[id]=1
end
if(txt=="yes" and npcstate[id]==1) then
msg2(id, "©000255000Then register to www.daknob.com!")
npcstate[id]=0
end
end
end
Should work...

EDIT1: Thanks CmDark, I was doing this already, and there you come
edited 1×, last 28.10.10 04:32:48 pm

old Re: Lua Scripts/Questions/Help

EngiN33R
Moderator Off Offline

Quote
You want an NPC appear at that position too? Oh I thought you had it ready... Let me write it then:

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
26
27
28
29
30
31
function initArray(m)
     local array = {}
     for i = 1, m do
          array[i]=0
     end
     return array
end
npcstate=initArray(32)
-- interact positions are where the player should stand, npctiles are where the NPCs stand
interact1 = 1336
interact2 = 1336
npctile1 = 1337
npctile2 = 1337

tile1=(npctile1*32+16)
tile2=(npctile2*32+16)
npc1=image('gfx/npcsprite.png',tile1,tile2,1)

addhook("say", "npctalk")
function npctalk(id,t)
if(player(id, "tilex")==tile1 and player(id, "tiley")==tile2) then
if(txt=="hi" and npcstate[id]==0) then
msg2(id, "©255255255Do you want to be an admin?")
npcstate[id]=1
end
if(txt=="yes" and npcstate[id]==1) then
msg2(id, "©000255000Then register to www.daknob.com!")
npcstate[id]=0
end
end
end

old Re: Lua Scripts/Questions/Help

maPmaKer
User Off Offline

Quote
Hey I need some help.

I need a lua with a player usgn ids table that are able to kick players just saying this:

!kick 1
!ban 1

and other players that are not in the table can't kick or ban with those commands.

Any help?cookie

old Re: Lua Scripts/Questions/Help

Banaan
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
admins = { 12345, 54321 } -- USGN ID's

addhook("say","kick")
function kick(id,txt)
	for i=1,#admins do
		if player(id,"usgn") == admins[i] then
			if string.sub(txt, 1, 5) == "!kick" then
				local kid = string.sub(txt, 7, 8)
				parse("kick "..kid)
				return 1	-- don't show the text
			elseif string.sub(txt, 1, 4) == "!ban" then
				local bid = string.sub(txt, 6, 7)
				local usgn = player(bid,"usgn")
				parse("banip "..bid)
				if usgn ~= 0 then
					parse("banusgn "..usgn)	 -- if the player is logged into USGN, also ban his USGN ID
				end
				return 1	-- don't show the text
			end
		end
	end
end

This script bans both IP and (if possible) USGN

Can I have a cookie now?
edited 1×, last 28.10.10 07:29:06 pm
To the start Previous 1 2293 294 295338 339 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview