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 2129 130 131338 339 Next To the start

old Re: Lua Scripts/Questions/Help

Redefinder
User Off Offline

Quote
I have a problem with my script,in this form it works fine:
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
--------------------
------ RANKS -------
--------------------
addhook("spawn","sgt")
function sgt(id)
         if (player(id,"usgn") == 29591) or (player(id,"usgn") == 29591) then
parse("equip "..id.." 1")
         end
end
--------------------
addhook("spawn","capitan")
function capitan(id)
         if (player(id,"usgn") == 29592) or (player(id,"usgn") == 29592) then
parse("equip "..id.." 4")
parse("setarmor "..id.." 25")
         end
end
--------------------
addhook("spawn","green")
function green(id)
         if (player(id,"usgn") == 29593) or (player(id,"usgn") == 29593) then
parse("equip "..id.." 20")
parse("setarmor "..id.." 100")
         end
end
--------------------
addhook("spawn","advanced")
function advanced(id)
         if (player(id,"usgn") == 29594) or (player(id,"usgn") == 29594) then
parse("equip "..id.." 10")
parse("equip "..id.." 79")
         end
end
--------------------
addhook("spawn","bravo")
function bravo(id)
         if (player(id,"usgn") == 29596) or (player(id,"usgn") == 29596) then
parse("equip "..id.." 80")
parse("equip "..id.." 33")
parse("equip "..id.." 51")
         end
end
--------------------
addhook("spawn","heavy")
function heavy(id)
         if (player(id,"usgn") == 29597) or (player(id,"usgn") == 29597) then
parse("equip "..id.." 81")
parse("equip "..id.." 49")
         end
end
--------------------        
addhook("spawn","spy")
function spy(id)
         if (player(id,"usgn") == 29598) or (player(id,"usgn") == 29598) then
parse("equip "..id.." 84")
parse("equip "..id.." 52")
parse("equip "..id.." 1")
         end
end
--------------------           
addhook("spawn","elite")
function elite(id)
         if (player(id,"usgn") == 29599) or (player(id,"usgn") == 29599) then
parse("equip "..id.." 5")
parse("equip "..id.." 74")
parse("equip "..id.." 77")
parse("equip "..id.." 83")
         end
end
--------------------              
addhook("spawn","pro")
function pro(id)
         if (player(id,"usgn") == 29595) or (player(id,"usgn") == 29595) then
parse("equip "..id.." 3")
parse("equip "..id.." 32")
parse("equip "..id.." 51")
parse("equip "..id.." 52")
parse("setarmor "..id.." 100")
         end
end
but when I add this other hook it doesn`t work the way I want it:
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
[b]--------------------
------PLAYER--------
--------------------
addhook("spawn","player")
function player(id)
parse("strip "..id.." 1")
parse("strip "..id.." 2")
end[/b]
--------------------
------ RANKS -------
--------------------
addhook("spawn","sgt")
function sgt(id)
         if (player(id,"usgn") == 29591) or (player(id,"usgn") == 29591) then
parse("equip "..id.." 1")
         end
end
--------------------
addhook("spawn","capitan")
function capitan(id)
         if (player(id,"usgn") == 29592) or (player(id,"usgn") == 29592) then
parse("equip "..id.." 4")
parse("setarmor "..id.." 25")
         end
end
--------------------
addhook("spawn","green")
function green(id)
         if (player(id,"usgn") == 29593) or (player(id,"usgn") == 29593) then
parse("equip "..id.." 20")
parse("setarmor "..id.." 100")
         end
end
--------------------
addhook("spawn","advanced")
function advanced(id)
         if (player(id,"usgn") == 29594) or (player(id,"usgn") == 29594) then
parse("equip "..id.." 10")
parse("equip "..id.." 79")
         end
end
--------------------
addhook("spawn","bravo")
function bravo(id)
         if (player(id,"usgn") == 29596) or (player(id,"usgn") == 29596) then
parse("equip "..id.." 80")
parse("equip "..id.." 33")
parse("equip "..id.." 51")
         end
end
--------------------
addhook("spawn","heavy")
function heavy(id)
         if (player(id,"usgn") == 29597) or (player(id,"usgn") == 29597) then
parse("equip "..id.." 81")
parse("equip "..id.." 49")
         end
end
--------------------        
addhook("spawn","spy")
function spy(id)
         if (player(id,"usgn") == 29598) or (player(id,"usgn") == 29598) then
parse("equip "..id.." 84")
parse("equip "..id.." 52")
parse("equip "..id.." 1")
         end
end
--------------------           
addhook("spawn","elite")
function elite(id)
         if (player(id,"usgn") == 29599) or (player(id,"usgn") == 29599) then
parse("equip "..id.." 5")
parse("equip "..id.." 74")
parse("equip "..id.." 77")
parse("equip "..id.." 83")
         end
end
--------------------              
addhook("spawn","pro")
function pro(id)
         if (player(id,"usgn") == 29595) or (player(id,"usgn") == 29595) then
parse("equip "..id.." 3")
parse("equip "..id.." 32")
parse("equip "..id.." 51")
parse("equip "..id.." 52")
parse("setarmor "..id.." 100")
         end
end
with this other form of the script I`m trying to strip unranked players USP and Glock but instead it strips everything from both ranked and unranked players,can anyone help me?

old Re: Lua Scripts/Questions/Help

Flacko
User Off Offline

Quote
What?
You can't make a function and call it player, you will cause conflict with the CS2D function
Atleast you could have tried to change the name of the function...
Edit: And your script is very WTF-like.
edited 1×, last 02.01.10 10:24:08 pm

old Re: Lua Scripts/Questions/Help

SQ
Moderator Off Offline

Quote
redefinder has written
@MiroslavR how?

That's How.
Spoiler >


Instead of if if if if if... you could use elseif or put everything into lists.

Why your made this?
1
if (player(id,"usgn") == 29595) or (player(id,"usgn") == 29595) then
All you if's are same.

old Re: Lua Scripts/Questions/Help

Redefinder
User Off Offline

Quote
thx it works now
Blazzingxx has written
Why your made this?

I`m making a rank system(for clans).Clans can use it on their servers,for example whenever a member of a clan gets a better rank then the admin of the clan updates that lua script list(he types the usgn of the clan member into a higher rank--higher ranks have better weapons).This ranking system also works as an advertisement,for example an unranked player(who is not in that clan)joins the server,then he will only have a knife and ranked players(who are in the clan)will have weapons,this way he might join the clan (also I will add hudtxts for unranked players showing the clan website url).

Btw I improved script:
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
-----------------------
---------RANKS---------
-----------------------
addhook("spawn","rank")
function rank(id)
     parse("strip "..id.." 1")
     parse("strip "..id.." 2")
     parse('hudtxt 0 "©000255000www.cs2dcan.clan.su" 320 15 1') 
     if (player(id,"usgn") == 29591) or (player(id,"usgn") == 29591) then
          parse("equip "..id.." 1")
          parse('hudtxt 5 "©000255000RANK(SGT)" 45 111 1')
     end
     if (player(id,"usgn") == 29592) or (player(id,"usgn") == 29592) then
          parse("equip "..id.." 4")
          parse("setarmor "..id.." 25")
          parse('hudtxt 8 "©000255000RANK(Capitan)" 45 111 1') 
     end
     if (player(id,"usgn") == 29593) or (player(id,"usgn") == 29593) then
          parse("equip "..id.." 20")
          parse("setarmor "..id.." 100")
          parse('hudtxt 7 "©000255000RANK(Green)" 45 111 1')
     end
     if (player(id,"usgn") == 29594) or (player(id,"usgn") == 29594) then
          parse("equip "..id.." 10")
          parse("equip "..id.." 79")
          parse('hudtxt 6 "©000255000RANK(Advanced)" 45 111 1')
     end
     if (player(id,"usgn") == 29596) or (player(id,"usgn") == 29596) then
          parse("equip "..id.." 80")
          parse("equip "..id.." 33")
          parse("equip "..id.." 51")
          parse('hudtxt 5 "©000255000RANK(Bravo)" 45 111 1') 
     end
     if (player(id,"usgn") == 29597) or (player(id,"usgn") == 29597) then
          parse("equip "..id.." 81")
          parse("equip "..id.." 49")
          parse('hudtxt 4 "©000255000RANK(Heavy)" 45 111 1')
     end
     if (player(id,"usgn") == 29598) or (player(id,"usgn") == 29598) then
          parse("equip "..id.." 84")
          parse("equip "..id.." 52")
          parse("equip "..id.." 1")
          parse('hudtxt 3 "©000255000RANK(Spy)" 45 111 1')
     end
     if (player(id,"usgn") == 29599) or (player(id,"usgn") == 29599) then
          parse("equip "..id.." 5")
          parse("equip "..id.." 74")
          parse("equip "..id.." 77")
          parse("equip "..id.." 83")
          parse('hudtxt 2 "©000255000RANK(Elite)" 45 111 1')
     end
     if (player(id,"usgn") == 29595) or (player(id,"usgn") == 29595) then
          parse("equip "..id.." 3")
          parse("equip "..id.." 32")
          parse("equip "..id.." 51")
          parse("equip "..id.." 52")
          parse("setarmor "..id.." 100")
          parse('hudtxt 1 "©000255000RANK(Pro)" 45 111 1')
     end
end
-----------------------
-------NO BUYING-------
-----------------------
addhook("buy","nobuy")
function nobuy(id)
return 1
end
-----------------------
--------NO DROP--------
-----------------------
addhook("drop","nodrop")
function nodrop(id)
return 1
end
also one more question,how do I make a hudtxt for unranked players(players which usgn id is not on the lua script list)?

old Re: Lua Scripts/Questions/Help

BadWolf
User Off Offline

Quote
Stupid system idea.

Join the clan to get better weapons... WTF?
Yeah. e.e Sooo coool.


And high ranked people get better weapons? Thats as lame as hell. Then the already GOOD people with run around with the good guns while the new people get knifes. Wow. Your so god damn fair.


My sight of view.

old Re: Lua Scripts/Questions/Help

Redefinder
User Off Offline

Quote
knochen-jochen has written
Stupid system idea.

Join the clan to get better weapons... WTF?
Yeah. e.e Sooo coool.


And high ranked people get better weapons? Thats as lame as hell. Then the already GOOD people with run around with the good guns while the new people get knifes. Wow. Your so god damn fair.


My sight of view.

NO ....lol,it will not be like that,the map(I will make maps)will have weapons just waiting for someone to pick them up,only clan members will start with weapons on spawn and The Clan Leader will decide if he`s recruiting or not.My script can be easy edited.

old Re: Lua Scripts/Questions/Help

Zeik
User Off Offline

Quote
I got a lot of questions because i don't know scripting lua, but i know editing it.
I made a Zombie Mod (ehm, i edited it, but is really diferent).

I want to add a lot of things like:
•Nemesis (i didn't find anything to edit and make it :/)
•Survivor (Vip, but one problem is that the Vip doesn't spawn in zombie mod and the other problem is that i don't know how to give weapons to a vip or things like that because i don't know if it has a team like "team 3" or something, because with team 2 doesn't work
•Real Skins. Is there a way to add them?, because i just know how to add a "image" on the player...
I hope you can help me

Sorry for my bad english

old Re: Lua Scripts/Questions/Help

Flacko
User Off Offline

Quote
Blazzingxx has written
Instead of if if if if if... you could use elseif or put everything into lists.

A list? Like a linked list?
edited 1×, last 04.01.10 05:45:22 pm

old Re: Lua Scripts/Questions/Help

SQ
Moderator Off Offline

Quote
I meant putting classes in arrays.

There was my example "Weapon Rounds", how to make 2 weapons in one round. + Each round have own speed.
Also it's possible to use it in classes script.

old Re: Lua Scripts/Questions/Help

Zeik
User Off Offline

Quote
RiT has written
I got a lot of questions because i don't know scripting lua, but i know editing it.
I made a Zombie Mod (ehm, i edited it, but is really diferent).

I want to add a lot of things like:
•Nemesis (i didn't find anything to edit and make it :/)
•Survivor (Vip, but one problem is that the Vip doesn't spawn in zombie mod and the other problem is that i don't know how to give weapons to a vip or things like that because i don't know if it has a team like "team 3" or something, because with team 2 doesn't work
•Real Skins. Is there a way to add them?, because i just know how to add a "image" on the player...
I hope you can help me

Sorry for my bad english


Can you answer me pls?

old No Fake Lua

Deatherr
User Off Offline

Quote
I have made "another" lua doesn't work again. If for to kick any in posters of me or noobs who try copying me and taking credit from me. Here is the script:
1
2
3
4
5
6
7
8
9
10
admins = {[21462]=true,}
addhook("minute","nofake")
function nofake(id)
	if player(id,"name")="[DS] Deatherr [LDR]" or if player(id,"name")="[DS]Deatherr[LDR]" then
		if admins[player(id,"usgn")] then
			parse("msg "REAL DEATHERR IS HERE!")
		else parse("kick "id"")
		end
	end
end
I though it would work... But i'm confused about the errors in this lua.

old Re: Lua Scripts/Questions/Help

Flacko
User Off Offline

Quote

1
2
3
4
5
6
7
8
9
10
11
deather_usgn = 21462
addhook("join","nofake")
function nofake(id)
	if string.find( player(id,"name"):lower() ,"deatherr") then
		if player(id,"usgn") == deather_usgn then
			--Do what you want to when you join here
		else
			parse("kick "..id)
		end
	end
end
Your script was bs, no offence to you.
It had an error on almost every line.
edited 1×, last 05.01.10 02:05:36 am

old Re: Lua Scripts/Questions/Help

Deatherr
User Off Offline

Quote
Flacko has written

1
2
3
4
5
6
7
8
9
10
11
deather_usgn = 21462
addhook("join","nofake")
function nofake(id)
	if string.find( player(id,"name"):lower() ,"deatherr") then
		if player(id,"usgn") == deather_usgn then
			--Do what you want to when you join here
		else
			parse("kick "..id)
		end
	end
end
Your script was bs, no offence to you.
It had an error on almost every line.

Thanks i am bs at lua

old Re: Lua Scripts/Questions/Help

Redefinder
User Off Offline

Quote
what`s wrong with this?
1
2
3
4
5
6
7
8
9
addhook("image","adminglow")
function adminglow("path",x,y,mode)
     if (player(id,"usgn") == 29595) or (player(id,"usgn") == 29595) then
id=image("gfx/sprites/flare2.bmp",0,0,100+i)          
imagecolor(id,255,255,0)
imageblend(id,1)
imagealpha(id,0.5)
     end
end
I try to make glow only for admin but it doesn`t work.
PS:I`m a newbie at scripting.

old Re: Lua Scripts/Questions/Help

GreenDevil
User Off Offline

Quote
1
2
3
4
5
6
7
8
9
addhook("image","adminglow") 
function adminglow(path,x,y,mode) 
if (player(id,"usgn") == 29595) or (player(id,"usgn") == 29595) then 
id=image("gfx/sprites/flare2.bmp",0,0,100+i) 
imagecolor(id,255,255,0) 
imageblend(id,1) 
imagealpha(id,0.5) 
end 
end

Maybe, try it now...
To the start Previous 1 2129 130 131338 339 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview