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 2259 260 261338 339 Next To the start

old Re: Lua Scripts/Questions/Help

Ultr4killer
BANNED Off Offline

Quote
i am really sorry again for wasting your time but i am learning how to script and


1
2
3
4
5
6
7
8
9
10
11
12
13
admins = {1234, 2345, 3546}
addhook("say", "adminsay")
function adminsay(id, text)
   i = 1
   while (i <= #admins) do 
      i = i + 1
      if (text == "!admin") then
         if (player(id, "usgn") == admins[i]) then
            msg("Player "..player(id, "name").." is admin!")
         end
      end
   end
end

can you explain me what does thouse numbers on the first line means.

and also can you explain the 5th line please adn what does admins[i] means


sorry for that mess in it. BUt that code **** tag dont wotk


and i = i + 1 too please

old Re: Lua Scripts/Questions/Help

PAlllUCH
User Off Offline

Quote
Hi,

I have a problem with me new script,
The script is in Polish
The problem is with the IMAGE
In ,,Wingi 1 2 RD" and ,,Wingi 3RD i Capy"
I would also like to add freeimage after death
And lest one could buy only one wing / cape for life

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
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
ms={}

----------------------
--Setup             --
----------------------
function initArray(m)
local array = {}
for i = 1, m do
 array[i]=0
end
return array
end

function totable(t,match)
    local cmd = {}
    if not match then match = "[^%s]+" end
    for word in string.gmatch(t, match) do
         table.insert(cmd, word)
    end
    return cmd
end 

ms.money=initArray(32)
ms.killf = initArray(32)
ms.t = initArray(32)

function ms.moneyshow(id)
parse('hudtxt2 '..id..' 1 "©255075000Kredyty: '..ms.money[id]..' " 13 200')
end

----------------------
-- Sklepy           --
----------------------
function ms.shopa(id)
menu(id,"Rozne,Ammo|250,Pila|500,Gas|250,Wodka|200,Klucz|500,Pistolet Leczniczy|350,Wskrzeszenie|1250")
end

function ms.shopb(id)
menu(id,"Armory i bronie,Medic Armor|500,Heavy Armor|650,Super Armor|1500,Stealth Suit|1700,Five-seven|500,Deagle|500")
end

function ms.shopc(id)
menu(id,"Mikstury,Mikstura - 25HP|50,Mikstura - 50HP|75,Mikstura - 75HP|100,Szaman - 100HP|125")
end

function ms.shopw1(id)
menu(id,"Wingi 1 2 RD,Satan Wings - Dark Knight|500,Heaven Wings - Dark Wizard|500,Mistery Wings - Summoner|500,Dragon Wings - Blade Knight|1000,Archangel Wings - Soul Master|1000,Despair Wings - Bloody Summoner|1000")
end


function ms.shopw2(id)
menu(id,"Wingi 3 RD i Copy,Storm Wings - Blade Master|1500,Vortex Wings - Grand Master|1500,Violent Wind Wings - Dimension Master|1500,Cape Of Lord - Dark Lord|800,Mantle of Lord - Lord Emperor|1800")
end

function ms.shopall(id)
menu(id,"Wszystkie,Rozne,Armory i Bronie,Mikstury,Wingi 1 2 RD,Wingi 3 RD i Copy")
end


----------------------
-- Funkcje          --
----------------------
addhook("menu","ms.buy")
function ms.buy(id,title,sel)
if title == "Rozne" then
 if sel == 1 then
  if ms.money[id] > 249 then
   parse("equip "..id.." 61")
   parse("equip "..id.." 62")
   msg2(id,"©000255000Kupiles Ammo!@C")
   ms.money[id]=ms.money[id]-250
   ms.moneyshow(id)
  else
   msg2(id,"©255000000Nie masz kasy!@C")
  end
 end
 if sel == 2 then
  if ms.money[id] > 499 then
   parse("equip "..id.." 85")
   msg2(id,"©000255000Kupiles Pile!@C")
   ms.money[id]=ms.money[id]-500
   ms.moneyshow(id)
  else
   msg2(id,"©255000000Nie masz kasy!@C")
  end
 end
 if sel == 3 then
  if ms.money[id] > 249 then
   parse("equip "..id.." 72")
   msg2(id,"©000255000Kupiles Gas!@C")
   ms.money[id]=ms.money[id]-150
   ms.moneyshow(id)
  else
   msg2(id,"©255000000Nie masz kasy!@C")
  end
 end
 if sel == 4 then
  if ms.money[id] > 249 then
   parse("equip "..id.." 73")
   msg2(id,"©000255000Kupiles Wodke!@C")
   ms.money[id]=ms.money[id]-250
   ms.moneyshow(id)
  else
   msg2(id,"©255000000Nie masz kasy!@C")
  end
 end
 if sel == 5 then
  if ms.money[id] > 499 then
   parse("equip "..id.." 74")
   msg2(id,"©000255000Kupiles klucz!@C")
   ms.money[id]=ms.money[id]-500
   ms.moneyshow(id)
  else
   msg2(id,"©255000000I sobie nie pobudujesz!@C")
  end
 end
 if sel == 6 then
  if ms.money[id] > 349 then
   parse("equip "..id.." 2")
   msg2(id,"©000255000Kupiles Pistolet Leczniczy!@C")
   ms.money[id]=ms.money[id]-350
   ms.moneyshow(id)
  else
   msg2(id,"©255000000Nie masz kasy!@C")
  end
 end
 if sel == 7 then
  if ms.money[id] > 1249 then
   if ms.killf[id] == 0 then
    msg2(id,"©000255000Kupiles wskrzeszenie gdy zostaniesz zabity!@C")
    ms.money[id]=ms.money[id]-1250
    ms.moneyshow(id)
    ms.killf[id] = 1
   else
    msg2(id,"©255000000Kupiles to juz!@C")
   end
  else
   msg2(id,"©255000000Nie masz kasy!@C")
  end
 end
end
if title == "Armory i bronie" then
 if sel == 1 then
  if ms.money[id] > 499 then
   parse("setarmor "..id.." 204")
   msg2(id,"©000255000Kupiles Medic Armor!@C")
   ms.money[id]=ms.money[id]-500
   ms.moneyshow(id)
  else
   msg2(id,"©255000000Nie masz kasy!@C")
  end
 end
 if sel == 2 then
  if ms.money[id] > 399 then
   parse("setarmor "..id.." 203")
   msg2(id,"©000255000Kupiles Heavy Armor!@C")
   ms.money[id]=ms.money[id]-400
   ms.moneyshow(id)
  else
   msg2(id,"©255000000Nie masz kasy!@C")
  end
 end
 if sel == 3 then
  if ms.money[id] > 1499 then
   parse("setarmor "..id.." 205")
   msg2(id,"©000255000Kupiles Super Armor!@C")
   ms.money[id]=ms.money[id]-1500
   ms.moneyshow(id)
  else
   msg2(id,"©255000000Nie masz kasy!@C")
  end
 end
 if sel == 4 then
  if ms.money[id] > 1699 then
   parse("setarmor "..id.." 206")
   msg2(id,"©000255000Kupiles Stealth Suit!@C")
   ms.money[id]=ms.money[id]-1700
   ms.moneyshow(id)
  else
   msg2(id,"©255000000Nie masz kasy!@C")
  end
 end
 if sel == 5 then
  if ms.money[id] > 499 then
   parse("equip "..id.." 6")
   msg2(id,"©000255000Kupiles Five-seven!@C")
   ms.money[id]=ms.money[id]-500
   ms.moneyshow(id)
  else
   msg2(id,"©255000000Nie masz kasy!@C")
  end
 end
 if sel == 6 then
  if ms.money[id] > 499 then
   parse("equip "..id.." 3")
   msg2(id,"©000255000Kupiles Deagle@C")
   ms.money[id]=ms.money[id]-500
   ms.moneyshow(id)
  else
   msg2(id,"©255000000Nie masz kasy!@C")
  end
 end
end
if title == "Mikstury" then
 if sel == 1 then
  if ms.money[id] > 49 then
   parse("sethealth "..id.." "..player(id,"health")+25)
   msg2(id,"©000255000Kupiles miksturke!@C")
   ms.money[id]=ms.money[id]-50
   ms.moneyshow(id)
  else
   msg2(id,"©255000000Nie masz kasy!@C")
  end
 end
 if sel == 2 then
  if ms.money[id] > 74 then
   parse("sethealth "..id.." "..player(id,"health")+50)
   msg2(id,"©000255000Kupiles miksturke!@C")
   ms.money[id]=ms.money[id]-75
   ms.moneyshow(id)
  else
   msg2(id,"©255000000Nie masz kasy!@C")
  end
 end
 if sel == 3 then
  if ms.money[id] > 99 then
   parse("sethealth "..id.." "..player(id,"health")+75)
   msg2(id,"©000255000Kupiles miksturke!@C")
   ms.money[id]=ms.money[id]-100
   ms.moneyshow(id)
  else
   msg2(id,"©255000000Nie masz kasy!@C")
  end
 end
 if sel == 4 then
  if ms.money[id] > 124 then
   parse("sethealth "..id.." "..player(id,"health")+100)
   msg2(id,"©000255000Szaman wyleczyl twoje rany!!@C")
   ms.money[id]=ms.money[id]-125
   ms.moneyshow(id)
  else
   msg2(id,"©255000000Szaman nie wyleczy twoich ran!@C")
  end
 end
end
if title == "Wingi 1 2 RD" then
 if sel == 1 then
  if ms.money[id] > 499 then
   parse("setmaxhealth "..id.." "..player(id,"maxhealth")+35)
   parse("speedmod "..id.." "..5)
   ms.image[ id] = image( "gfx/wings/diabel.bmp", 1, -1, id +100)
   msg2(id,"©000255000Kupiles skrzydla!@C")
   ms.money[id]=ms.money[id]-500
   ms.moneyshow(id)
  else
   msg2(id,"©255000000Nie masz kasy!@C")
  end
 end
 if sel == 2 then
  if ms.money[id] > 499 then
   parse("setmaxhealth "..id.." "..player(id,"maxhealth")+15)
   parse("speedmod "..id.." "..10)
   ms.image[ id] = image( "gfx/wings/aniol.bmp", 1, -1, id+100)
   msg2(id,"©000255000Kupiles skrzydla!@C")
   ms.money[id]=ms.money[id]-500
   ms.moneyshow(id)
  else
   msg2(id,"©255000000Nie masz kasy!@C")
  end
 end
 if sel == 3 then
  if ms.money[id] > 499 then
   parse("setmaxhealth "..id.." "..player(id,"maxhealth")+20)
   parse("speedmod "..id.." "..8)
   ms.image[ id] = image( "gfx/wings/sum.bmp", 1, -1, id+100)
   msg2(id,"©000255000Kupiles skrzydla!@C")
   ms.money[id]=ms.money[id]-500
   ms.moneyshow(id)
  else
   msg2(id,"©255000000Nie masz kasy!@C")
  end
 end
 if sel == 4 then
  if ms.money[id] > 999 then
   parse("setmaxhealth "..id.." "..player(id,"maxhealth")+50)
   parse("speedmod "..id.." "..15)
   ms.image[ id] = image( "gfx/wings/diabel2.bmp", 1, -1, id+100)
   msg2(id,"©000255000Kupiles skrzydla!@C")
   ms.money[id]=ms.money[id]-1000
   ms.moneyshow(id)
  else
   msg2(id,"©255000000Nie masz kasy!@C")
  end
 end
 if sel == 5 then
  if ms.money[id] > 999 then
   parse("sethealth "..id.." "..player(id,"maxhealth")+30)
   parse("speedmod "..id.." "..20)
   ms.image[ id] = image( "gfx/wings/aniol2.bmp", 1, -1, id+100)
   msg2(id,"©000255000Kupiles skrzydla!@C")
   ms.money[id]=ms.money[id]-1000
   ms.moneyshow(id)
  else
   msg2(id,"©255000000Nie masz kasy!@C")
  end
 end
 if sel == 6 then
  if ms.money[id] > 999 then
   parse("sethealth "..id.." "..player(id,"maxhealth")+40)
   parse("speedmod "..id.." "..25)
   ms.image[ id] = image( "gfx/wings/sum2.bmp", 1, -1, id+100)
   msg2(id,"©000255000Kupiles skrzydla!@C")
   ms.money[id]=ms.money[id]-1000
   ms.moneyshow(id)
  else
   msg2(id,"©255000000Nie masz kasy!@C")
  end
 end
end
if title == "Wingi 3 RD i Copy" then
 if sel == 1 then
  if ms.money[id] > 1499 then
   parse("sethealth "..id.." "..player(id,"maxhealth")+60)
   parse("speedmod "..id.." "..25)
   ms.image[ id] = image( "gfx/wings/diabel3.bmp", 1, -1, id+100)
   msg2(id,"©000255000Kupiles skrzydla!@C")
   ms.money[id]=ms.money[id]-1500
   ms.moneyshow(id)
  else
   msg2(id,"©255000000Nie masz kasy!@C")
  end
 end
 if sel == 2 then
  if ms.money[id] > 1499 then
   parse("sethealth "..id.." "..player(id,"maxhealth")+40)
   parse("speedmod "..id.." "..30)
   ms.image[ id] = image( "gfx/wings/aniol3.bmp", 1, -1, id+100)
   msg2(id,"©000255000Kupiles skrzydla!@C")
   ms.money[id]=ms.money[id]-1500
   ms.moneyshow(id)
  else
   msg2(id,"©255000000Nie masz kasy!@C")
  end
 end
 if sel == 3 then
  if ms.money[id] > 1499 then
   parse("sethealth "..id.." "..player(id,"maxhealth")+50)
   parse("speedmod "..id.." "..35)
   ms.image[ id] = image( "gfx/wings/sum3.bmp", 1, -1, id+100)
   msg2(id,"©000255000Kupiles skrzydla!@C")
   ms.money[id]=ms.money[id]-1500
   ms.moneyshow(id)
  else
   msg2(id,"©255000000Nie masz kasy!@C")
  end
 end
 if sel == 4 then
  if ms.money[id] > 799 then
   parse("setmaxhealth "..id.." "..player(id,"maxhealth")+60)
   parse("speedmod "..id.." "..15)
   ms.image[ id] = image( "gfx/wings/cape.bmp", 1, -1, id+100)
   msg2(id,"©000255000Kupiles Cape!@C")
   ms.money[id]=ms.money[id]-800
   ms.moneyshow(id)
  else
   msg2(id,"©255000000Nie masz kasy!@C")
  end
 end
 if sel == 5 then
  if ms.money[id] > 1799 then
   parse("setmaxhealth "..id.." "..player(id,"maxhealth")+120)
   parse("speedmod "..id.." "..25)
   ms.image[ id] = image( "gfx/wings/cape2.bmp", 1, -1, id+100)
   msg2(id,"©000255000Kupiles Cape!@C")
   ms.money[id]=ms.money[id]-1800
   ms.moneyshow(id)
  else
   msg2(id,"©255000000Nie masz kasy!@C")
  end
 end
end
if title == "Wszystkie" then
 if sel == 1 then
  ms.shopa(id)
 elseif sel == 2 then
  ms.shopb(id)
 elseif sel == 3 then
  ms.shopc(id)
 elseif sel == 4 then
  ms.shopw1(id)
 elseif sel == 5 then
  ms.shopw2(id)
 end
end
end

addhook("serveraction","ms.action")
function ms.action(id,action)
if action == 2 then
 ms.shopall(id)
end
end

addhook("spawn","ms.spawn")
function ms.spawn(id)
ms.moneyshow(id)
end

addhook("kill","ms.kill")
function ms.kill(id,victim)
if player(id,"team") == 2 then
 if player(victim,"team") == 1 then
  ms.money[id]=ms.money[id]+25
  ms.moneyshow(id)
 else
  ms.money[id]=ms.money[id]-5
 end
elseif player(id,"team") == 1 then
 if player(victim,"team") == 2 then 
  ms.money[id]=ms.money[id]+100
  ms.moneyshow(id)
 else
  ms.money[id]=ms.money[id]-5
 end
end
end

addhook("join","ms.join")
function ms.join(id)
ms.killf[id]=0
ms.money[id]=500
end

addhook("parse","ms.parse")
function ms.parse(t)
txt = totable(t)
if txt[1] == "daj_kredyty" then
 if txt[2] ~= nil then
  if txt[3] ~= nil then
   ms.money[tonumber(txt[2])]=ms.money[tonumber(txt[2])]+tonumber(txt[3])
   msg2(tonumber(txt[2]),"©255000255Admin dal ci kredyty :P")
   ms.moneyshow(tonumber(txt[2]))
   return 1
  else
   print("©255000000Zapomniales o ilosci !")
   return 1
  end
 else
  print("©255000000Zapomniales o id !")
  return 1
 end
elseif txt[1] == "daj_kredyty_wszystkim" then
 if txt[2] ~= nil then
  for id = 1,32 do
   if player(id,"exists") then
    ms.money[id]=ms.money[id]+tonumber(txt[2])
    ms.moneyshow(id)
    msg("©255000255Admin dal kredyty wszystkim :P")
    return 1
   end
  end
 else
  print("©255000000Zapomniales o ilosci !")
  return 1
 end
end
end

addhook("die","ms.die")
function ms.die(id)
if player(id,"team") == 2 then
 if ms.killf[id]==1 then
  ms.money[id]=ms.money[id]-100
  ms.moneyshow(id)
  ms.killf[id]=0
  local px,py
  px = player(id,"x")
  py = player(id,"y")
  parse('spawnplayer '..id..' '..px..' '..py) 
end
end
end

addhook("hit","ms.heal") 
function ms.heal(id,src,weapon) 
if (weapon == 2) then 
 parse("sethealth "..id.." "..player(id,"health")+20) 
 return 1 
end 
end

addhook("say","spawn2") 
function spawn2(id,txt,p) 
    if(txt=="!reset") then
      parse("speedmod "..id.." 0")
          parse("setmaxhealth "..id.." 100")
          freeimage(id) 
          id1=image("gfx/sprites/flare2.bmp",0,0,100+id) 
          imagescale(id1,1,1) 
          imageblend(id1,1) 
          imagealpha(id1,0.7) 
          if (player(id,"team") == 2) then 
               imagecolor(id1,0,0,0) 
                
          elseif (player(id,"team") == 1) then 
               imagecolor(id1,0,0,0) 
          end 
    end
end

old .YeaH.

FiiD
User Off Offline

Quote
Thank you really much HaRe...so and I wanna do it now how you said it me...I wanna read and learn from every new script that comes to CS2D forum...I learn much from the RPG Tibia script...and thanks that you google for me some script tuttorials...you have a golden Heart!!!

Question:So I tried to make a simple script but it dont works...

1
2
3
4
5
6
7
8
9
addhook("break","join")
function break()
break(x,y)						
-x: breakable x (12)
-y: breakable y (7) then
	msg("Good Job@c")	
      end
   end
end

I know that I can do this all in the Editor...but this was just a test...and it always say I need a loop by Break(Line 3)...I tried all loops and queries on every place but no chance...id dont works...so please HaRe I need your help...can you say me why it dont works and writte me this script right...
edited 1×, last 15.09.10 01:27:35 am

old Re: Lua Scripts/Questions/Help

J4x
User Off Offline

Quote
Hi everyone im making a lua so i need help to mnake a script that when players die a sprite appear! thx for ur help

old Re: Lua Scripts/Questions/Help

Deatherr
User Off Offline

Quote
I need on help on a script that makes a chain saw heal instead of kill


1
2
3
4
5
6
7
addhook("hit","heal2") 
function heal2(id,source,weapon,hpdmg,apdmg) 
if(weapon == 85) then 
parse ("sethealth "..id.." "..player(id,"health") +2) 
return 1 
end 
end

It don't say any error in the console but it has no effect
edited 2×, last 15.09.10 05:25:57 am

old Re: Lua Scripts/Questions/Help

Ultr4killer
BANNED Off Offline

Quote
Deatherr has written
I need on help on a script that makes a chain saw heal instead of kill


1
2
3
4
5
6
7
addhook("hit","heal2") 
function heal2(id,source,weapon,hpdmg,apdmg) 
if(weapon == 85) then 
parse ("sethealth "..id.." "..player(id,"health") +2) 
return 1 
end 
end

It don't say any error in the console but it has no effect



lol you dont even need script for this. just type in console


mp_wpdmg chainsaw -100

so now it is heals 100 hp

old Re: Lua Scripts/Questions/Help

murilog
User Off Offline

Quote
Code:
addhook("leave","RPsave")
function RPsave(id)
if (player(id,"usgn") > 0) then
f = assert(io.open('sys/lua/saved/'..player(id,"usgn")..'.txt','w'))
f:write(rp_cr[id])
f:close()
msg2(id,"©000255000Jogo salvo com sucesso!@C")
else
msg2(id,"©000255000Falha ao salvar o jogo!@C")
end
rp_cr[id] = 0
end

addhook("join","RPload")
function RPload(id)
if (player(id,"usgn") > 0) then
msg2(id,'Seu U.S.G.N. ID é : '..player(id,"usgn")..'@C')
f = io.open('sys/lua/saved/'..player(id,"usgn")..'.txt','r')
if (f ~= nil) then
RPTransition(id,f)
f:close()
else
msg2(id,'Falha ao carregar seu Save!@C')
end
else
msg2(id,'Falha ao carregar seu Save!@C')
end
end

addhook("say","SaySaveLoad")
function SaySaveLoad(id,txt)
if (txt=="!save") then
if (player(id,"usgn") > 0) then
msg2(id,'Salvando U.S.G.N. : '..player(id,"usgn")..'@C')
f = assert(io.open('sys/lua/saved/'..player(id,"usgn")..'.txt','w'))
f:write(rp_cr[id])
f:close()
msg2(id,"©000255000Jogo salvo com sucesso!@C")
else
msg2(id,"©000255000Falha ao salvar o jogo!@C")
end
end
if (txt=="!load") then
if (player(id,"usgn") > 0) then
msg2(id,'Carregando U.S.G.N. : '..player(id,"usgn")..'@C')
f = io.open('sys/lua/saved/'..player(id,"usgn")..'.txt','r')
if (f ~= nil) then
RPTransition(id,f)
f:close()
else
msg2(id,'Falha ao carregar seu Save!@C')
end
else
msg2(id,'Falha ao carregar seu Save!@C')
end
end
end

function RPTransition(id,f:read("*all"))
rp_cr[id] = f
msg2(id,'Save carregado com sucesso!@C')
parse('hudtxt2 '..id..' 3 "©000000255Dinheiro : R$ '..rp_cr[id]..'" 17 430')
end

What's wrong ?

and , can make !givemoney <id> <amount> whit this script

old Re: Lua Scripts/Questions/Help

senar
User Off Offline

Quote
@murilog: use this maybe will work i dident test it (script for !givemoney (id) (amount) )
1
2
3
4
5
6
if (_t1=="!givemoney") then
		_t2=tonumber(_msg[2])
		_t3=tonumber(_msg[3])
		parse("setmoney ".._t2.." ".._t3)
		print('©000255000'..player(id,"name")..' - Used Command : '.._t1..' '..tostring(_t2)..' '..tostring(_t3)..'')
	end
edited 4×, last 15.09.10 12:24:06 pm

old Re: Lua Scripts/Questions/Help

Ultr4killer
BANNED Off Offline

Quote
admins = {1234, 2345, 3546}
addhook("say", "adminsay")
function adminsay(id, text)
i = 1
while (i <= #admins) do
i = i + 1
if (text == "!admin") then
if (player(id, "usgn") == admins[i]) then
msg("Player "..player(id, "name").." is admin!")
end
end
end
end


can you explain me what does thouse numbers on the first line means.

and also can you explain the 5th line please adn what does admins[i] means

and i = i + 1 too please



HEY guys and what about helping me over here!

old Re: Lua Scripts/Questions/Help

HaRe
User Off Offline

Quote
FiiD has written
Thank you really much HaRe...so and I wanna do it now how you said it me...I wanna read and learn from every new script that comes to CS2D forum...I learn much from the RPG Tibia script...and thanks that you google for me some script tuttorials...you have a golden Heart!!!

Question:So I tried to make a simple script but it dont works...

1
2
3
4
5
6
7
8
9
addhook("break","join")
function break()
break(x,y)						
-x: breakable x (12)
-y: breakable y (7) then
	msg("Good Job@c")	
      end
   end
end

I know that I can do this all in the Editor...but this was just a test...and it always say I need a loop by Break(Line 3)...I tried all loops and queries on every place but no chance...id dont works...so please HaRe I need your help...can you say me why it dont works and writte me this script right...


first look at my script and look at urs

1
2
3
4
5
6
addhook("break","breakt")
function breakt(x,y)                        
	if x==2 and y==2 then
    		msg("Good Job@c")     
	end
end

Well if u dont see the differnents ill tell you

first i start with the addhook and function

1
2
addhook("break","breakt") -- As you see the break is the HOOK we've used and the breakt is the name of the addhook
function breakt(x,y) -- To use the breakt youve gotta write breakt on the function too or else it wont load

and now to the basic youve used 3 ends instead of 2, Im not so good at explaining the ends but ull figure it out later but ill show u

1
2
if x==2 and y==2 then
    		msg("Good Job@c")
See that theres 2 lines? Well when you like use if then you can have what evah you want after it like

1
2
3
4
if x==2 and y==2 then
    		msg("Good Job@c")    
    		msg("Good Josb@c")    
    		msg("Good Jobd@c")
but theres still 2 ends in it since its an if and functions

i hope that helped u enough
/edit

and also u see theres if x==2 and y==2 then

If stands for "WHEN" or like

"if (player(id,"health") == 2) then"
it means like

when the player has 2 hp he does this and this

old tibia

Infinite Rain
Reviewer Off Offline

Quote
i download script tibia and intall it
ifound glitch

can walk on water without wings

andenemies dont attak u

old Re: Lua Scripts/Questions/Help

Theronz
User Off Offline

Quote
Hi!
Can Somone help?
This Example From Tutorial what i read

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
addhook("serveraction", "saction")
addhook("menu", "mymenu")




function saction(id, sact)
if(sact==1) then
      menu(id, "Pick one, Kick, Kill, Trap, Kamikaze")
end
end

if (title=="Pick one") then
if(button==1) then
parse ("setmaxhealth "..id.." 150")
end
if(button==2) then
parse ("setmaxhealth "..id.." 150")
end
if(button==3) then
parse ("setmaxhealth "..id.." 150")
end
if(button==4) then
parse ("speedmod "..id.." 100")
end
end

Menu working But Speedmod and other dosen't Work

Who can fix this : I want do clothes for players only admin can give -This second problem If who can ... plz clothes script do too :"' Sorry my bad english - im poland

old tibia

Infinite Rain
Reviewer Off Offline

Quote
i download script and install it
and i found gliches

canu help me

on water can walk without wings
and enemie no attack just follow u

can somebody help me with script?

old THANKS

FiiD
User Off Offline

Quote
WoooW You are genial HaRe...I thank you really really much for that and I copy your script so that I always have it by me when Im scripting...you are a great teacher...thanks...I know now much more about scripting... √ I try to make some new scripts...

old Re: Lua Scripts/Questions/Help

Deatherr
User Off Offline

Quote
Ultr4killer has written
Deatherr has written
I need on help on a script that makes a chain saw heal instead of kill


1
2
3
4
5
6
7
addhook("hit","heal2") 
function heal2(id,source,weapon,hpdmg,apdmg) 
if(weapon == 85) then 
parse ("sethealth "..id.." "..player(id,"health") +2) 
return 1 
end 
end

It don't say any error in the console but it has no effect



lol you dont even need script for this. just type in console


mp_wpdmg chainsaw -100

so now it is heals 100 hp


No you can't put negative number when your using mp_wpndmg

old .YeaH.

FiiD
User Off Offline

Quote
You can put just -X for the env_Hurt...so than heal it...

HaRe...I maked a new script!!!
Its simple but its my first script so it needs to be simple...:

1
2
3
4
5
6
addhook("die","death")
function death(x,y)				
if death then
	msg("Good Job@C")
     end
end

I never could make it without you HaRe...thanks...and I have maked a more simple script from yours...

1
2
3
4
5
6
addhook("break","breakt")
function breakt(x,y) 
     if x==x and y==y then
          msg("Good Job@C") 
     end
end

this is the script from you and now comes my script:

1
2
3
4
5
6
addhook("break","breaked")
function breaked(x,y)
	if 12+7 then
		msg("Good Job@C")	
        end
end

So see...I just set 12+7 or just set x+y for all breakable entities that it shows the message...

old Re: Lua Scripts/Questions/Help

Rainoth
Moderator Off Offline

Quote
@deatherr.

Try this :

Spoiler >


Think looks same as yours ? Find the mistake
To the start Previous 1 2259 260 261338 339 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview