English Lua Scripts/Questions/Help

6,770 replies
Goto Page
To the start Previous 1 2 ... 274 275 276 ... 338 339 Next To the start
07.10.10 06:09:15 pm
Up
FiiD
User
Offline Off
Hhehehehhe...coool your help is really usefull Hyh2...
07.10.10 06:38:35 pm
Up
Tajifun
User
Offline Off
...
Tajifun yay.
07.10.10 06:52:34 pm
Up
Snake_Eater
User
Offline Off
Hi all again I need a function which sorts a table alphabetically....

like in ...
Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
function pairsByKeys (t, f)
local a = {}
for n in pairs(t) do table.insert(a, n) end
table.sort(a, f)
local i = 0 -- iterator variable
local iter = function () -- iterator function
i = i + 1
if a[i] == nil then return nil
else return a[i], t[a[i]]
end
end
return iter
end

(http://www.lua.org/pil/19.3.html)

But this script only works if the table looks like..

Code:
1
table = {A = 78476,B = 64,C = 1} --sample


But I want that the function sorts tables like this....
Code:
1
table = {"Peter","John","Abba"}


help pls
[Death Note]
07.10.10 07:31:14 pm
Up
head600
BANNED
Offline Off
addhook("minute","minutes")
function minutes(id)
if level[id] >= 7 then
ms.money[id]=ms.money[id]+5
end
end



whats wrong???
07.10.10 07:32:43 pm
Up
Vectarrio
User
Offline Off
@head60
Is that all script? And if not, show ALL script
07.10.10 07:48:15 pm
Up
head600
BANNED
Offline Off
error = 345: attemp to compare number with nil
07.10.10 08:21:43 pm
Up
Sudden Death
User
Offline Off
Hey somebody can help me? i have problem with class.lua (i editet them for youreft but i make too more classes and its don't show them all plis help me : )
Sniffin'Man "If it cannot be done with lua, it must be you mama, coz she's too fat"
07.10.10 09:43:32 pm
Up
Tajifun
User
Offline Off
maybe you should show us your script?
Tajifun yay.
07.10.10 10:07:14 pm
Up
Sudden Death
User
Offline Off
ok here is it
Code:
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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
if sample==nil then sample={} end
sample.classes={}

-----------------------
-- INITIAL SETUP     --
-----------------------
function initArray(m)
     local array = {}
     for i = 1, m do
          array[i]=0
     end
     return array
end
sample.classes.class=initArray(32)
function sample.classes.classmenu(id)
     menu(id,"Select your Class,Terror|,Killer|,Pro|,Avast|,Nuke|,Fast NuKE|,Avast|premium,Virus|,Spam|,Hamster|,Scisors|")     
end


-----------------------
-- TEAM -> CLASS     --
-----------------------
addhook("team","sample.classes.team")
function sample.classes.team(id,team)
     if (team>0) then
          sample.classes.classmenu(id)
     end
end


-----------------------
-- SERVERACTION      --
-----------------------
addhook("serveraction","sample.classes.serveraction")
function sample.classes.serveraction(id)
     sample.classes.classmenu(id)
end


-----------------------
-- CLASS SELECTION   --
-----------------------
addhook("menu","sample.classes.menu")
function sample.classes.menu(id,menu,sel)
     if (menu=="Select your Class") then
          if (sel>=0 and sel<=11) then
               sample.classes.class[id]=sel
               if (player(id,"health")>0) then
                    parse("killplayer "..id)
               end
          end
     end
end


-----------------------
-- SPAWN             --
-----------------------
addhook("spawn","sample.classes.spawn")
function sample.classes.spawn(id)
     -- SOLDIER
     if (sample.classes.class[id]<=1) then
          parse ("setmaxhealth "..id.." 200")
          parse ("setarmor "..id.." 30")
          parse ("speedmod "..id.." 10")
          return "23,1";
     end
     -- SPY
     if (sample.classes.class[id]==2) then
          parse ("setmaxhealth "..id.." 150")
          parse ("setarmor "..id.." 206")
          parse ("speedmod "..id.." 3")
          return "38,3";
     end
     -- ENGINEER
     if (sample.classes.class[id]==3) then
          parse ("setmaxhealth "..id.." 120")
          parse ("setarmor "..id.." 200")
          return "41,85,30";
     end
     -- PYRO
     if (sample.classes.class[id]==4) then
          parse ("setmaxhealth "..id.." 100")
          parse ("setarmor "..id.." 205")
          parse ("speedmod "..id.." -20")
          return "40";
     end
     -- SCOUT
     if (sample.classes.class[id]==5) then
          parse ("setmaxhealth "..id.." 75")
          parse ("setarmor "..id.." 110")
          parse ("speedmod "..id.." 25")
          return "5,85,51";
     end
     -- SNIPER
     if (sample.classes.class[id]==6) then
          parse ("setmaxhealth "..id.." 50")
          parse ("setarmor "..id.." 50")
          parse ("speedmod "..id.." 30")
          return "22,41,85";
     end
     -- avast2
     if (sample.classes.class[id]==7) then
          parse ("setmaxhealth "..id.." 50")
          parse ("setarmor "..id.." 205")
          parse ("speedmod "..id.." -10")
          return "40";
     end
     -- Virus
     if (sample.classes.class[id]==8) then
          parse ("setmaxhealth "..id.." 250")
          parse ("setarmor "..id.." 30")
          parse ("speedmod "..id.." 10")
          return "32";
     end
     -- Spamer
     if (sample.classes.class[id]==9) then
          parse ("setmaxhealth "..id.." 10")
          parse ("setarmor "..id.." 205")
          parse ("speedmod "..id.." 80")
          return "41,2";
     end
     -- Chomik
     if (sample.classes.class[id]==10) then
          parse ("setmaxhealth "..id.." 100")
          parse ("setarmor "..id.." 205")
          parse ("speedmod "..id.." -15")
          return "41,3,30,32,40";
     end
     -- nozyczki
     if (sample.classes.class[id]==11) then
          parse ("setmaxhealth "..id.." 25")
          parse ("setarmor "..id.." 205")
          parse ("speedmod "..id.." -25")
          return "41,85,30";
     end
end


-----------------------
-- NO BUYING         --
-----------------------
addhook("buy","sample.classes.buy")
function sample.classes.buy()
     return 1
end


-----------------------
-- NO COLLECTING     --
-----------------------
addhook("walkover","sample.classes.walkover")
function sample.classes.walkover(id,iid,type)
     if (type>=61 and type<=68) then
          return 0
     end
     return 1
end


-----------------------
-- NO DROPPING       --
-----------------------
addhook("drop","sample.classes.drop")
function sample.classes.drop()
     return 1
end


-----------------------
-- NO DEAD DROPPING  --
-----------------------
addhook("die","sample.classes.die")
function sample.classes.die()
     return 1
end
Sniffin'Man "If it cannot be done with lua, it must be you mama, coz she's too fat"
08.10.10 03:39:40 am
Up
TDShuft
User
Offline Off
here :
Code:
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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
if sample==nil then sample={} end
sample.classes={}

-----------------------
-- INITIAL SETUP --
-----------------------
function initArray(m)
     local array = {}
     for i = 1, m do
          array[i]=0
     end
     return array
end
sample.classes.class=initArray(32)
function sample.classes.classmenu(id)
     menu(id,"Select your Class,Terror|,Killer|,Pro|,Avast|,Nuke|,Fast NuKE|,Avast|premium,Virus|,Next Page|Page 2")  --,Spam|,Hamster|,Scisors|   
end
function sample.classes.classmenu2(id)
     menu(id,"Page 2,Spam|,Hamster|,Scisors|,Previous Page|Page 1")  --,Spam|,Hamster|,Scisors|   
end

-----------------------
-- TEAM -> CLASS --
-----------------------
addhook("team","sample.classes.team")
function sample.classes.team(id,team)
     if (team>0) then
          sample.classes.classmenu(id)
     end
end


-----------------------
-- SERVERACTION --
-----------------------
addhook("serveraction","sample.classes.serveraction")
function sample.classes.serveraction(id,action)
     sample.classes.classmenu(id)
end


-----------------------
-- CLASS SELECTION --
-----------------------
addhook("menu","sample.classes.menu")
function sample.classes.menu(id,menu,sel)
     if (menu=="Select your Class") then
          if (sel>=0 and sel<=8) then
               sample.classes.class[id]=sel
               if (player(id,"health")>0) then
                    parse("killplayer "..id)
               end
               elseif sel== 9 then
                    sample.classes.classmenu2(id)
          end
          if (menu=="Page 2") then
               if (player(id,"health")>0) then
                     parse("killplayer "..id)
              end
                    if sel == 1 then
                         sample.classes.class[id]=9
                    elseif sel == 2 then
                         sample.classes.class[id]=10
                    elseif sel == 3 then
                         sample.classes.class[id]=11
                    elseif sel == 4 then
                         sample.classes.classmenu(id)
                    end
               end
     end
end


-----------------------
-- SPAWN --
-----------------------
addhook("spawn","sample.classes.spawn")
function sample.classes.spawn(id)
     -- SOLDIER
     if (sample.classes.class[id]<=1) then
          parse ("setmaxhealth "..id.." 200")
          parse ("setarmor "..id.." 30")
          parse ("speedmod "..id.." 10")
          return "23,1";
     end
     -- SPY
     if (sample.classes.class[id]==2) then
          parse ("setmaxhealth "..id.." 150")
          parse ("setarmor "..id.." 206")
          parse ("speedmod "..id.." 3")
          return "38,3";
     end
     -- ENGINEER
     if (sample.classes.class[id]==3) then
          parse ("setmaxhealth "..id.." 120")
          parse ("setarmor "..id.." 200")
          return "41,85,30";
     end
     -- PYRO
     if (sample.classes.class[id]==4) then
          parse ("setmaxhealth "..id.." 100")
          parse ("setarmor "..id.." 205")
          parse ("speedmod "..id.." -20")
          return "40";
     end
     -- SCOUT
     if (sample.classes.class[id]==5) then
          parse ("setmaxhealth "..id.." 75")
          parse ("setarmor "..id.." 110")
          parse ("speedmod "..id.." 25")
          return "5,85,51";
     end
     -- SNIPER
     if (sample.classes.class[id]==6) then
          parse ("setmaxhealth "..id.." 50")
          parse ("setarmor "..id.." 50")
          parse ("speedmod "..id.." 30")
          return "22,41,85";
     end
     -- avast2
     if (sample.classes.class[id]==7) then
          parse ("setmaxhealth "..id.." 50")
          parse ("setarmor "..id.." 205")
          parse ("speedmod "..id.." -10")
          return "40";
     end
     -- Virus
     if (sample.classes.class[id]==8) then
          parse ("setmaxhealth "..id.." 250")
          parse ("setarmor "..id.." 30")
          parse ("speedmod "..id.." 10")
          return "32";
     end
     -- Spamer
     if (sample.classes.class[id]==9) then
          parse ("setmaxhealth "..id.." 10")
          parse ("setarmor "..id.." 205")
          parse ("speedmod "..id.." 80")
          return "41,2";
     end
     -- Chomik
     if (sample.classes.class[id]==10) then
          parse ("setmaxhealth "..id.." 100")
          parse ("setarmor "..id.." 205")
          parse ("speedmod "..id.." -15")
          return "41,3,30,32,40";
     end
     -- nozyczki
     if (sample.classes.class[id]==11) then
          parse ("setmaxhealth "..id.." 25")
          parse ("setarmor "..id.." 205")
          parse ("speedmod "..id.." -25")
          return "41,85,30";
     end
end


-----------------------
-- NO BUYING --
-----------------------
addhook("buy","sample.classes.buy")
function sample.classes.buy()
     return 1
end


-----------------------
-- NO COLLECTING --
-----------------------
addhook("walkover","sample.classes.walkover")
function sample.classes.walkover(id,iid,type)
     if (type>=61 and type<=68) then
          return 0
     else
          return 1
     end
end


-----------------------
-- NO DROPPING --
-----------------------
addhook("drop","sample.classes.drop")
function sample.classes.drop()
     return 1
end


-----------------------
-- NO DEAD DROPPING --
-----------------------
addhook("die","sample.classes.die")
function sample.classes.die()
     return 1
end
Sorry , I can't be Perfect !
08.10.10 08:08:21 am
Up
Sudden Death
User
Offline Off
Heh. second page don't work and its don't show bugs, but i know where are bugs and i try to fix that
edit: plis help me
Sniffin'Man "If it cannot be done with lua, it must be you mama, coz she's too fat"
08.10.10 10:48:32 am
Up
Unknown Killer
User
Offline Off
i want a script that if player or admins say !(command) will not show to all player

can anyone please help me with this . thanks
08.10.10 12:53:30 pm
Up
Time
User
Offline Off
Quote:
Quote:
head600 has written:

how to print on screen?

i want show on screen writing?

how to make??


hyh2 has written:

This is how:

Take printer, and put it to your Computer screen.

Thats it! "How to print on screen".

How to make what? Screen?
You need glass, and plastic etc.

Hope i helped.


That's why I don't agree with kids joining our forums.
IMG:https://sc-cdn.scaleengine.net/i/3a137042de3c79a4d3c69b1f036866e92.jpg
08.10.10 01:56:20 pm
Up
Rainoth
Moderator
Offline Off
Unknown Killer has written:
i want a script that if player or admins say !(command) will not show to all player

can anyone please help me with this . thanks


All you have to do is just to write "return 1" and message wont be displayed.

Example :

Code:
1
2
3
4
5
6
7
addhook("say","nomessage")
function nomessage
if txt== "!command" then
parse ("sv_msg2 I like Pie...")
          return 1
     end
end


Dont know if this work but it should
08.10.10 03:25:09 pm
Up
KenVo
User
Offline Off
what i need to add to make the stun - explosion lua script?
like when it hit someone then that person speed will be -100 in 3 second

Code:
1
2
3
4
5
6
addhook("say","saya")
function saya(id,t)
     if t=="!a" then
          parse("explosion "..x.." "..y.." 10 0 "..id)
     return 1
end
08.10.10 03:32:07 pm
Up
Yasday
User
Offline Off
KenVo has written:
what i need to add to make the stun - explosion lua script?
like when it hit someone then that person speed will be -100 in 3 second

Code:
1
2
3
4
5
6
addhook("say","saya")
function saya(id,t)
     if t=="!a" then
          parse("explosion "..x.." "..y.." 10 0 "..id)
     return 1
end


like this i think
Code:
1
2
3
4
5
6
7
addhook("say","saya")
function saya(id,t)
     if t=="!a" then
          parse("explosion "..x.." "..y.." 10 0 "..id)
       parse("speedmod "..id.." -100")
     return 1
end
08.10.10 04:28:09 pm
Up
Unknown Killer
User
Offline Off
batlaizys has written:
All you have to do is just to write "return 1" and message wont be displayed.

Example :

Code:
addhook("say","nomessage")
function nomessage
if txt== "!command" then
parse ("sv_msg2 I like Pie...")
return 1
end
end


Dont know if this work but it should


i try it didnt work. im doing a script for admin levels

example if admin lvl 5 he can execute commands of lvl 5 admin .

the commands works fine but it show witch command he use. this weird because if u r the host or the high level the commands will wont show
08.10.10 08:26:51 pm
Up
head600
BANNED
Offline Off
addhook ("attack","noreload")
function noreload(p,id)
w = player(p,"weapontype")
if (w~=0) and level[id] >= 12 then
parse("equip "..p.." "..w) end
end

LUA ERROR: sys/lua/xx.lua:139: attemp to compare nunber with nil

pls help me
08.10.10 09:41:35 pm
Up
Flacko
User
Offline Off
Use level[p] instead of level[id]
08.10.10 11:41:57 pm
Up
Yasday
User
Offline Off
I have a question:
Is it possible to edit the name of an entity with lua?
To the start Previous 1 2 ... 274 275 276 ... 338 339 Next To the start