English Lua Scripts/Questions/Help

6,770 replies
Goto Page
To the start Previous 1 2 ... 338 339 Next To the start
27.12.10 11:15:46 pm
Up
J4x
User
Offline Off
no, just nothing happens..
27.12.10 11:19:21 pm
Up
Yasday
User
Offline Off
lawl just wrote player wrong.
Code:
1
2
3
4
5
6
addhook([[hit]],[[hitteer]])
function hitteer(id,src,wpn,hpd,apd)
     if wpn == 30 then
          parse([[explosion ]]..player(id,"x")..[[ ]]..player(id,"y")..[[ 1 1000 ]]..src)
     end
end

it does just work with AK-47 = ID 30
27.12.10 11:52:09 pm
Up
J4x
User
Offline Off
thx for the answer
28.12.10 01:11:00 am
Up
SkullFace
User
Offline Off
can somebody help me ? my friend isnt answering my pm so im asking here

BureX has written:
okay... i setted the barricade (window location for nazi zombies) location
can u show me how to make them attack it with lua ?
heres the code :
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
function ai_gotot(id,x,y) 
  if player(id,"bot") then 
  if player(id,"team") == 1 then 
  local c=math.random(1,13) 
  if c==1 then 
  ai_goto(id,12,6) 
  elseif c==2 then 
  ai_goto(id,8,16) 
  elseif c==3 then 
  ai_goto(id,18,20) 
  elseif c==4 then 
  ai_goto(id,25,19) 
  elseif c==5 then 
  ai_goto(id,21,6) 
  elseif c==6 then 
  ai_goto(id,35,6) 
  elseif c==7 then 
  ai_goto(id,51,19) 
  elseif c==8 then 
  ai_goto(id,46,31) 
  elseif c==9 then 
  ai_goto(id,35,21) 
  elseif c==10 then 
  ai_goto(id,30,19) 
  elseif c==11 then 
  ai_goto(id,30,20) 
  elseif c==12 then 
  ai_goto(id,30,21) 
  elseif c==13 then 
  ai_goto(id,25,11) 
  end 
  end 
  end 
end
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
28.12.10 01:23:25 am
Up
Yasday
User
Offline Off
Use
Code:
1
2
3
ai_aim(id,x,y)--x and y in pixels
ai_attack(id)--primitive attack
ai_iattack(id)--intelligent attack
28.12.10 01:57:47 am
Up
3RROR
User
Offline Off
Yasday has written:
Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
function sv_sound3(x,y,sound)
     for i,id in pairs(player(0,"table")) do
          if math.sqrt((x - player(id,"x"))^2 + (y- player(id,"y"))^2) < 300 then
               parse([[sv_sound2 ]]..id..[[ ]]..sound)
          end
     end
end

addhook([[attack]],[[attacker]])
function attacker(id)
     local wpn = player(id,"weapontype")
     if wpn == 1 then --USP?
          sv_sound3(player(id,"x"),player(id,"y"),"sfx/thesound.ogg")
     end
end

idk if it works, did it from scratch.
for "sfx/thesound.ogg" insert the path of your sound file

Ty Yasday works perfectly and if i want a greater x place? I only need to edit "300" to a X one?
IMG:http://gamerswins.com/images/ins/logo.png
28.12.10 02:01:35 am
Up
Yasday
User
Offline Off
If you want more people around to hear it, just increase 300.
edited 1×, last 28.12.10 02:55:02 am
28.12.10 03:37:18 am
Up
ULtiMa
User
Offline Off
@DaKnOb OK here is the script!But this is not the complete version.
Spoiler >
28.12.10 05:10:26 am
Up
MasterAsp
User
Offline Off
@F1r3z Well, I think you just wanted to know how to do it, not just have your script fixed. Well, the most common way is to write to a text file, and then call that file again. However, this is not the case that you MUST do this, as weiwen shows a very good example of another way, but the most preferable way is to do the latter, so I'll give you a way to do it.
You can use the file:write method which writes a certain amount of text to a file.
Code:
1
2
3
4
5
6
7
8
9
10
function fileWrite(path,data)
     local file = io.open(path,"a")
     if type(data) == "table" then
          for i,v in ipairs(data) do
            file:write(v) end
     else
          file:write(data)
     end
     file:close()
end

So this handy dandy little script will write what you put in as parameters into a specific text file. So create a text file in sys/lua then say simply fileWrite("sys/lua/text.txt",player(id,"usgn").." "..datatostore)
once that's done, you can call that using the file read methods provided by the lua library.
Code:
1
2
for lines in io.lines("sys/lua/text.txt") do
     --manipulate data here

And there you go, that's how you read and write to files, to inevitably save data permanently.
28.12.10 12:40:48 pm
Up
SkullFace
User
Offline Off
Yasday has written:
Use
Code:
1
2
3
ai_aim(id,x,y)--x and y in pixels
ai_attack(id)--primitive attack
ai_iattack(id)--intelligent attack


it works but they dont stand to the window and destroy it

Picture :
Spoiler >

Script :
Spoiler >
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
28.12.10 05:12:39 pm
Up
DC
Admin
Offline Off
CLOSED


we now have SUBFORUMS and there is an extra forum for all Lua questions! feel free to create new threads there:
http://www.unrealsoftware.de/forum_threads.php?forum=105&sub=2
www.UnrealSoftware.de | www.CS2D.com | www.CarnageContest.com | Use the forum & avoid PMs!
To the start Previous 1 2 ... 338 339 Next To the start