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 2136 137 138338 339 Next To the start

old Re: Lua Scripts/Questions/Help

KimKat
GAME BANNED Off Offline

Quote
Blazzingxx has written
There is image function parameter, x or y ( I don't remember very well) to make image on player possition...
Look at DC's sample, it says something like like "...blabla,200+i)"

i = @ player. I'm pretty sure.

old Re: Lua Scripts/Questions/Help

Starkkz
Moderator Off Offline

Quote
yes but it is with movement..
i want see if it's possible without movement and put the image in the player x and y position and rotation without movement..
(In the floor).

old Re: Lua Scripts/Questions/Help

Homer
User Off Offline

Quote
Eh, I don't know for sure, but I guess you could do the last player's coordinates on which the sprite was, and just set the image on that pos when it reads a command? I don't know how to do that so Good luck

old Re: Lua Scripts/Questions/Help

Starkkz
Moderator Off Offline

Quote
Anyone can help me with this code plz?.

Spoiler >


I want to change the position of the players when the driver moves.
(After saying "!enter" )
But nothing happens. What's wrong?
edited 5×, last 12.01.10 05:41:21 pm

old Re: Lua Scripts/Questions/Help

Flacko
User Off Offline

Quote
You should check your code by yourself.
It's easy to see that you don't understand what you are doing because of senseless errors, that I think you've learnt reading someone's else script.

old Re: Lua Scripts/Questions/Help

Redefinder
User Off Offline

Quote
My script has a bug,when a player comes to the servers he gets a hudtxt--THAT`S NORMAL.But when another player comes to the server the hudtxts stack up.It`s supposed to be only 1 hudtxt for each ranked player but instead hudtxt`s stack up.

Here is my script:
Spoiler >


Plz someone help me eliminate this bug.

old Re: Lua Scripts/Questions/Help

KimKat
GAME BANNED Off Offline

Quote
Starkkz has written
yes but it is with movement..
i want see if it's possible without movement and put the image in the player x and y position and rotation without movement..
(In the floor).
I think you can't do that due to the fact that the image is @player(at player). My only solution to this is to create a image in png format with transparency and change the image in example a icon of 32x32 in image dimension. Change the dimensions to 32x96 that way you can like imagine the image offset ingame. That's the way I did here.

old Re: Lua Scripts/Questions/Help

memo
COMMUNITY BANNED Off Offline

Quote
dose it's Possible to make classes for every team as own like
CT > have his own classes
&
T > Have his own classes

How ?

old Re: Lua Scripts/Questions/Help

SQ
Moderator Off Offline

Quote
@memo,
There was many questions about different classes for each team already...

Please, check previous pages...

old Re: Lua Scripts/Questions/Help

memo
COMMUNITY BANNED Off Offline

Quote
i really donot have any time to see over that 130 pages of this thread so can you tell me how to use ..
its have a thing with if player with 1 = .... blablabla right

old Re: Lua Scripts/Questions/Help

RAVENOUS
BANNED Off Offline

Quote
Just one page behind you.

1
2
3
4
5
if (player(id,"team") == 2) then
[...]

elseif (player(id,"team") == 1) then
[...]

Idk which team is 1 or 2 - you have to look by yourself, I think you can do that. I hope you can...

old Re: Lua Scripts/Questions/Help

Homer
User Off Offline

Quote
Check info.txt. It has all the specifics of lua hooks and teams
Also, I keep getting bad argument, Number expected got nil on my console. If you want the exact thing here it is.
LUA ERROR: sys/lua/Admin.lua/lua:35:bad argument #1 'player' (number expected, got nil).
Line 35 is
if player(p,"usgn") == Admin1 then
edited 1×, last 13.01.10 12:22:08 am

old Re: Lua Scripts/Questions/Help

Flacko
User Off Offline

Quote
@Homer:I think that you haven't declared the variable 'p'
Posting your whole function would be better in this case.

@Skipper/Memo: 2 Is CT and 1 is T, and if I'm not wrong, 0 is spectator

@Redefinder: Your code is too big + no tabs + impossible to read anything = I didn't even bother in reading to save myself from a fatal headache.

old Re: Lua Scripts/Questions/Help

Homer
User Off Offline

Quote
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
local i
for i = 1, 32 do
end
addhook("say","Admin1Command")
function Admin1Command(p,txt,id)
--35:--if player(p,"usgn") == Admin3 then
	if (txt == "!Laser") then
		parse ("equip "..id.." 45")
	elseif (txt == "!Sarmor") then
		parse ("equip "..id.." 83")
	elseif (txt == "!StArmor") then
		parse ("equip "..id.." 84")
	elseif (txt == "!MArmor") then
		parse ("equip "..id.." 82")
	end
	end
	end
Here's the code, a freind wanted something so im doing the tedious work, but I keep running into this problem and it's really annoying me.

old Re: Lua Scripts/Questions/Help

Admir
User Off Offline

Quote
Homer has written
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
local i
for i = 1, 32 do
end
addhook("say","Admin1Command")
function Admin1Command(p,txt,id)
--35:--if player(p,"usgn") == Admin3 then
	if (txt == "!Laser") then
		parse ("equip "..id.." 45")
	elseif (txt == "!Sarmor") then
		parse ("equip "..id.." 83")
	elseif (txt == "!StArmor") then
		parse ("equip "..id.." 84")
	elseif (txt == "!MArmor") then
		parse ("equip "..id.." 82")
	end
	end
	end
Here's the code, a freind wanted something so im doing the tedious work, but I keep running into this problem and it's really annoying me.


dude, you messed up the script
it should be

Spoiler >

old Re: Lua Scripts/Questions/Help

Admir
User Off Offline

Quote
Homer has written
Tried that, Then I went to another style, Still didn't work.


Try this

1
2
3
4
5
6
7
8
9
10
11
12
13
14
addhook("say","AdminCommand")
function AdminCommand(id,txt)
     if (player(id,"usgn") == Admin3) then
          if (txt == "!Laser") then
               parse ("equip "..id.." 45")
          elseif (txt == "!Sarmor") then
               parse ("equip "..id.." 83")
          elseif (txt == "!StArmor") then
               parse ("equip "..id.." 84")
          elseif (txt == "!MArmor") then
               parse ("equip "..id.." 82")
          end
     end
end

just remove number 1 near the priority and function

EDIT:

try post the error lua here pls

old Re: Lua Scripts/Questions/Help

Redefinder
User Off Offline

Quote
Flacko has written
@Redefinder: Your code is too big + no tabs + impossible to read anything = I didn't even bother in reading to save myself from a fatal headache.

yeah spoiler ruined tabs when I copy&pasted it from rank.lua

Spoiler >

Is this better?
edited 2×, last 13.01.10 11:42:31 am

old Re: Lua Scripts/Questions/Help

Admir
User Off Offline

Quote
I smell something different on hook radio,
the info show it

info.txt has written
radio(id,message)                         on radio
-id: player id
-message: radio message type id
>return:     0 - proceed normally
          1 - don't show message


about the return 0 and 1, I've try to return 1 in lua and I test it at ingame, but when ingame I try to use any radio and the sound won't came out also message, in info.txt return 1 only don't show message, but why radio sound like "Need Backup!" don't came out?

old Re: Lua Scripts/Questions/Help

Flacko
User Off Offline

Quote
Here, I've tabbed your code, I've made it 80% smaller, I've made it easier to change and hopefully, I've fixed your "bug". I didn't test it, but you can tell me about any errors you get.
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
-----------------------
---------SETUP---------
-----------------------
RANK = {}
RANK.SGT = {weapons={1}, 29554,29555,29556,29557,29558}
RANK.CAPITAN = {weapons={4},armor=25, 29559,29560,29561,29562,29563}
RANK.GREEN = {weapons={20},armor=100, 29564,29565,29566,29567,29568}
RANK.ADVANCED = {weapons={10},29569,29570,29571,29572,29573}
RANK.BRAVO = {weapons={80,33,51},29574,29575,29576,29577,29578}
RANK.HEAVY = {weapons={81,49},29579,29580,29581,29582,29583}
RANK.SPY = {weapons={84,52,1},29584,29585,29586,29587,29588}
RANK.ELITE = {weapons={5,74,77,83},29589,29590,29591,29592,6831}
RANK.PRO = {weapons={3,32,51,52},armor=100, 29594,29599,29596,29597,29598}
RANK.ADMIN = {29595,29600,29601,29602,29603}

function hudtxt2(id,tid,text,x,y,align)
	align = align or ""
	parse([[hudtxt2 ]]..id..[[ ]]..tid..[[ "]]..text..[[" ]]..x..[[ ]]..y..[[ ]]..align)
end
-----------------------
---------RANKS---------
-----------------------
addhook("spawn","rank")
function rank(id)
	parse("strip "..id.." 0")
	parse('hudtxt 10 "©000255000www.cs2dcan.clan.su" 320 15 1')
	for _rankname,_table in pairs(RANK) do
		for i,_usgn in ipairs(_table) do
			local _finish = false
			if player(id,"usgn") == _usgn then
				parse("equip "..id.." 1")
				hudtxt2(id,9,"©000255000RANK(".._rankname..")",45,111,1) --Gay msg
				if _table.armor then parse("setarmor "..id.." ".._table.armor) end --Armor
				if _table.weapons then
					for index_of_weapon,wpn in ipairs(_table.weapons) do
						parse("equip "..id.." "..wpn) --Weapons
					end
				end
				_finish = true
				break
			end
			if finish then
				break
			end
		end
	end
end
-----------------------
-------NO BUYING-------
-----------------------
addhook("buy","nobuy")
function nobuy(id)
	return 1
end
-----------------------
--------NO DROP--------
-----------------------
addhook("drop","nodrop")
function nodrop(id)
	return 1
end

--No dmg
addhook("hit","nodmg")
function nodmg(id)
	for i,_usgn in ipairs(RANK.ADMIN) do
		if player(id,"usgn") == _usgn then
			return 1
		end
	end
end

addhook("startround","adminglow")
function adminglow()
	for index,id in ipairs(player(0,"table")) do
		for i,_usgn in ipairs(RANK.ADMIN) do
			if player(id,"usgn") == _usgn then
				local img=image("gfx/sprites/flare2.bmp",0,0,100+id)
				imagecolor(img,255,0,0)
				imageblend(img,1)
				imagealpha(img,0.5)
				return 0
			end
		end
	end
end

adminglow()
edited 1×, last 13.01.10 03:19:29 pm
To the start Previous 1 2136 137 138338 339 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview