English Lua Scripts/Questions/Help

6,770 replies
Goto Page
To the start Previous 1 2 ... 191 192 193 ... 338 339 Next To the start
19.04.10 04:21:57 am
Up
Flacko
User
Offline Off
Yes, the timer system is very bugged.
This has been reported and DC fixed it.
Your code may work for the next version.
19.04.10 05:19:27 am
Up
Sleepin
User
Offline Off
But when I look at info.txt it clearly stated there is a spary hook?!
IMG:http://www.avatarsdb.com/avatars/gatling_gun.gif
Gattling Gun
19.04.10 10:26:21 am
Up
Anti
User
Offline Off
BureX,

you use it?

Code:
1
2
if sample==nil then sample={} end
sample.sayfuncs={}
--- Its NO WORK

OR

Code:
1
2
3
if sample==nil then sample={} end
sample.sayfuncs={}
sample.classes={}
--- Its work

Or use it:
Code:
1
2
3
4
5
6
7
8
9
10
11
addhook("say","sample.classes.say")
function sample.classes.say(id,txt)
     if(txt=="!lm") then
     if (player(id,"money")>799) then
     parse("equip "..id.." 87")
     parse("setmoney "..id.." "..player(id,"money")-800)
     else
     msg2(id,"©255000000You don't have enough of money (need 800 money)")
     end
end
end


Here change: (sample.funcs == sample.classes)
addhook("say","sample.CLASSES.say") -- it no code
function sample.CLASSES.say(id,txt) -- It no code

Sorry for my bad english!
19.04.10 04:43:39 pm
Up
lol93
User
Offline Off
hi i am kinda new and i have troble whit my script
plz dont say things like omg thats very stupid.

Script

Code:
1
2
3
4
5
6
7
8
addhook ("minute")
function tutorialadvertise()
   for player(i = 1, 60, 1) do
      if (player(i, "exists")) then
         equip("player "..player(id, "84")
      end
   end
end


I wanne have:
if a player gots a gut bomb, and after he used it he will get a new gut bomb in 60 sec.
STRANDED II MP!!!
19.04.10 05:03:12 pm
Up
SkullFace
User
Offline Off
Anti, yes but Patassuss maked me the working one

so Here is the script I wanted to make

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
parse("sv_gm 5")
addhook("spawn", "ghostmode")
function ghostmode(id)
if player(id,"team") == 1 then
parse("setmaxhealth "..id.." 30")
parse("speedmod "..id.." 10")
parse("equip "..id.." 84")
parse("equip "..id.." 55")
parse("mp_wpndmg claw 100")
elseif player(id,"team") == 2 then
parse("equip "..id.." 87")
parse("mp_wpndmg awp 100")
parse("mp_wpndmg_z1 awp 150")
parse("mp_wpndmg_z2 awp 200")
parse("mp_wpndmg LaserMine 0")
end
end

if sample==nil then sample={} end
sample.classes={}

addhook("die","sample.classes.die")
function sample.classes.die()
     return 1
end

addhook("say","sayi")
function sayi(id,txt)
if(txt=="!lm") then
if (player(id,"money")>9999) then
parse("equip "..id.." 87")
parse("setmoney "..id.." "..(player(id,"money")-10000))
else
msg2(id,"©255000000You don't have enough of money (need 10000 money)")
end
end
end

i just changed it a little bit
this ghost mode is from one MMO game i dont remember how it is called

BTW : How could i make lua script when I press E on USE BUTTON and then appears some cr*p where i could choose stuff
edited 1×, last 19.04.10 05:41:25 pm
IMG:https://i.imgur.com/kZBVkjM.gif
P.S. - I've been extracting recently enviromental sound files from other games, if anyone is interested in them for adding them to their maps, scripts, PM me
19.04.10 06:46:11 pm
Up
SDKey
User
Offline Off
> How many health has buildings, such as Turret, Barricade, Wall I, Wall II and other?
> And How many dmg has weapons?

Thanks.
19.04.10 07:10:21 pm
Up
SkullFace
User
Offline Off
and sorry for many questions :S
IMG:https://i.imgur.com/kZBVkjM.gif
P.S. - I've been extracting recently enviromental sound files from other games, if anyone is interested in them for adding them to their maps, scripts, PM me
19.04.10 07:28:19 pm
Up
DRoNe
User
Offline Off
SDKey has written:
> How many health has buildings, such as Turret, Barricade, Wall I, Wall II and other?
> And How many dmg has weapons?

Thanks.


For building health, for example AK-47 has 50dmg
count your shots to building and * 50.

You can find weapon dmgs in BUY MENU where is price etc.
IMG:http://img39.imageshack.us/img39/567/drnatimg.png
19.04.10 11:35:16 pm
Up
siuL
User
Offline Off
More >

some 1 help i need to make it able just for admins
20.04.10 12:55:44 am
Up
Flacko
User
Offline Off
lol93 has written:
Code:
1
2
3
4
5
6
7
8
addhook ("minute")
function tutorialadvertise()
   for player(i = 1, 60, 1) do
      if (player(i, "exists")) then
         equip("player "..player(id, "84")
      end
   end
end


Hmm...
I will fix it for you but:
You should use attack hook and timers, even though the timer system is really fucked up it should work for what you are trying to do.
Also, you shouldn't use a loop, they are way too fast

Code:
1
2
3
4
5
6
7
8
9
10
_GUTBOMB_ = 0 --Insert here the id of the gutbomb
function give_gutbomb(id)
     parse("equip "..id.." ".._GUTBOMB_)
end
addhook("projectile","asd")
function asd(id,wp)
     if wp == _GUTBOMB_ then
          timer(60*1000,"give_gutbomb",tostring(id),1)
     end
end


I'll try to explain the code so you can understand it.
Quote:
_GUTBOMB_ = 0 --Insert here the id of the gutbomb

Nothing too hard, I create a variable to store the gutbomb's id.
Quote:
function give_gutbomb(id)
     parse("equip "..id.." ".._GUTBOMB_)
end

Here I created the function that should be called by the timer. This function will take the id of the player and equip him a gutbomb (id is a string)
Quote:
addhook("projectile","asd")
function asd(id,wp)
     if wp == _GUTBOMB_ then
          timer(60*1000,"give_gutbomb",tostring(id),1)
     end
end

Here I used the projectile hook (it will be called once the gutbomb collides with a wall/ the floor)
I checked if the thrown weapon was the gutbomb and made a timer that would call our previous function only once in 60000 miliseconds passing to it the id of the player as a string.

BTW: I didn't test it
20.04.10 09:00:44 am
Up
Anti
User
Offline Off
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
addhook("menu","TESTmenu")
function TESTmenu(id,menu,sel)
     if (menu=="NAME") then
          if sel==1 then

          elseif sel==2 then

          elseif sel==3 then

          elseif sel==4 then

          elseif sel==5 then
               
          elseif sel==6 then

          elseif sel==7 then

          elseif sel==8 then

          elseif sel==9 then

          end
     end

addhook("use","test_shop")
function test_shop(id)
x = player(id,"tilex")
y = player(id,"tiley")
     if (x==XXX) and (y==YYY) then TESTmenus(id);end
end

function TESTmenus(id)
if (player(id,"team")==2) then
menu(id,"NAME, name1, name2, name3, name4, name5, name6, name7, name8, name9")
end
end



--
if (menu=="NAME") then
menu(id,"NAME, name1, name2, name3, name4, name5, name6, name7, name8, name9")

and, if name = LOL then -- no lua
if (menu=="LOL") then
menu(id,"LOL, name1, name2, name3, name4, name5, name6, name7, name8, name9")
--

• IT LOW
• 100 WORK % ("I TEST IT")
• AND PLEASE!

Screen:
∗Test

By Anti..
edited 5×, last 20.04.10 12:55:08 pm
20.04.10 02:10:19 pm
Up
normix
User
Offline Off
hello, today i downloaded a lua script that has alot of voting options in it... im not that very good at scripting so i would like to ask for help... can any1 please edit this script to disable all voting options except for map voting. kick voting and round restart? prity plss!
link of script : http://www.unrealsoftware.de/files_show.php?file=134

Admin/mod comment:

I deleted the code. The download link is enough /TheKilledDeath
20.04.10 06:39:26 pm
Up
lol93
User
Offline Off
2 flacko

ty it worked and also ty for da exsplanation

But i found somting thats wrong, when i get a gut bom and use it and get one again then there are 2 timers.
One for the first gut bom and one for the second.
How to solve it?
edited 1×, last 20.04.10 06:51:03 pm
STRANDED II MP!!!
20.04.10 09:28:27 pm
Up
siuL
User
Offline Off
sum1 willl help?
21.04.10 11:49:56 am
Up
DC
Admin
Offline Off
Lee created a forum where you can ask your Lua questions. I recommend to use it because it's more comfortable than having one single thread where all questions/answers are mixed up.

check http://www.unrealsoftware.de/forum_posts.php?post=179866&start=0
and www.cs2d.org
www.UnrealSoftware.de | www.CS2D.com | www.CarnageContest.com | Use the forum & avoid PMs!
21.04.10 03:00:09 pm
Up
DRoNe
User
Offline Off
lol i have error 502 : Bad gateway
IMG:http://img39.imageshack.us/img39/567/drnatimg.png
21.04.10 04:22:34 pm
Up
Soja1997
User
Offline Off
it can be done when you are writing down! the admin is placing the model admin.bmp

footpath
gfx\player\admin.bmp
21.04.10 04:24:13 pm
Up
Sudden Death
User
Offline Off
Omfg who can change this:
Spoiler >

to free image
Sniffin'Man "If it cannot be done with lua, it must be you mama, coz she's too fat"
21.04.10 05:02:30 pm
Up
Soja1997
User
Offline Off
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
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

addhook("say","car")
function car(i,txt)
     local parses = totable(txt)
     local cmd = tostring(parses[1])
     local id = tonumber(parses[2])
     local v = tonumber(parses[3])
          if (cmd=="!ally") then
               if (id ~= nil and v ~= nil) then
                    if (player(id,"exists")) then
                         pl_ally[i]=id
                         pl_ally[id]=i
                         mm_ally[i]=v
                         mm_ally[id]=v
                    end
               end
               return 1
          end
          if (txt=="!car") then
                    if car[i]==0 then
                         carx[i]=player(i,"tilex")
                         cary[i]=player(i,"tiley")
                         car[i]=1
                    elseif car[i]==1 then
                         msg2(i,"©255000000You have already a car!@C")
                    end
               return 1
          end
          if (txt=="!eject") then
               if car[i]==1 then
                    if playerisincar[i]==1 then
                         car[i]=0
                         freeimage(i)
                         carxpos = carx[i]*32
                         carypos = cary[i]*32
                         parse("explosion "..carxpos.." "..carypos.." 300 3000 "..i)
                         carx[i]=0
                         cary[i]=0
                         parse("sv_sound \"extasy/impact.ogg\"")
                    elseif playerisincar[i]==0 then
                         freeimage(i)
                         parse("customkill "..i.." Eject "..i)
                         parse("explosion "..player(i,"x").." "..player(i,"y").." 300 3000 "..i)
                         carx[i]=0
                         cary[i]=0
                         car[i]=0
                         parse("sv_sound \"extasy/impact.ogg\"")
                    end
               elseif car[i]==0 then
                    msg2(i,"©255000000You haven't car!@C")
               end
               return 1
          end
end

carx = initArray(maxp)
cary = initArray(maxp)
car = initArray(maxp)
playerisincar = initArray(maxp)
addhook("use","car_mod_use")
function car_mod_use(id,event,data,tx,ty)
     if playerisincar[id]==1 then
          if (player(id,"tilex")==carx[id] and player(id,"tiley")==cary[id]) then
               playerisincar[id]=0
               freeimage(id)
               imag=image("gfx/extasy/car9.bmp",player(id,"x"),player(id,"y"),200+id)
               imagescale(imag,0.3,0.3)
               parse("speedmod "..id.." 50")
               parse ("sv_sound \"extasy/usecar.ogg\"")
          end
     elseif playerisincar[id]==0 then
          playerisincar[id]=1
          parse("speedmod "..id.." 0")
          carx[id]=player(id,"tilex")
          cary[id]=player(id,"tiley")
          freeimage(id)
          imag=image("gfx/extasy/ajeep.bmp",player(id,"x"),player(id,"y"),000+id)
          imagescale(imag,0.3,0.3)
          imagepos(imag,player(id,"x"),player(id,"y"),player(id,"rot"))
          parse ("sv_sound \"extasy/stop.ogg\"")
     end
end

Why does'nt Work?
To the start Previous 1 2 ... 191 192 193 ... 338 339 Next To the start