English Lua Scripts/Questions/Help

6,770 replies
Goto Page
To the start Previous 1 2 ... 216 217 218 ... 338 339 Next To the start
03.07.10 12:37:45 pm
Up
TimeQuesT
User
Offline Off
Oo you want also portal gun
to reverse the effect just write the word again

example : say laser
laser enabled -- you get a laser when you got hit by a usp

          say laser
laser disabled --you don't get any laser when you got hit.


try this :
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
lazor = 0
portal = 0

addhook ("say","sages")
function sages(id,text)
if text=="laser" and lazor ==0 then
lazor = 1
msg ("laz0r gun enabled")
elseif text=="laser" and lazor ==1 then
lazor = 0
msg ("laz0r gun disabled")
end

if text=="portal" and portal ==0 then
portal = 1
msg ("p0rtal gun enabled")
elseif text=="portal" and portal ==1 then
portal = 0
msg ("p0rtal gun disabled")
end
end

addhook ("hit","ho")
function ho(id,source,we)
if we == 1 and lazor == 1 then
parse ("equip "..id.." 45")
end
if we == 1 and portal == 1 then
parse ("equip "..id.." 88")
end
end
Muh
04.07.10 12:00:35 am
Up
archmage
User
Offline Off
Snake_Eater has written:
I have a little question

I want if somebody have used the cmd="kill"
that this player does not die.
I need it for a prison
Can anybody help me?

You could just make the player spawn there.
Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
addhook ("parse", "parse_")
lastkill = 2
spawnp = {}
addhook("die", "death")
function death (id)
     lastkill = id
end

function parse_ (cmd)
     if ( cmd:sub(1, 4) == "kill" ) then
          --parse("spawnplayer " .. lastkill .. " " .. player(lastkill, "x") .. " " .. player(lastkill, "y"))
          spawnp[lastkill] = {player(lastkill, "x"),player(lastkill, "y")}
     end
end

addhook("spawn", "spwn")
function spwn (id)
     if ( spawnp[id] ~= nil and spawnp[id][1] > -1 and spawnp[id][2] > -1 ) then
          parse("setpos " .. id .. " " .. spawnp[id][1] .. " "..spawnp[id][2])
          spawnp[id][1] = -1
          spawnp[id][2] = -1
     end
end


I have NOT tested so not sure if it works...
Edit tested it it fails Lua thinks lastkill is a f***ing boolean I wish it were a strongly typed language
Edit
try that it might work
edited 1×, last 04.07.10 12:11:47 am
We must secure the existence of our people and a future for white children. 14/88
04.07.10 11:04:01 am
Up
DC
Admin
Offline Off
this is not going to work for clients. commands entered by client are never parsed as console commands at the server (unless you put an rcon in front of them [which would kill the player who is the server in this case]).

so the parse-hook stuff will only be executed when the server itself executes the kill command.
www.UnrealSoftware.de | www.CS2D.com | www.CarnageContest.com | Use the forum & avoid PMs!
04.07.10 12:54:00 pm
Up
RAVENOUS
BANNED
Offline Off
how to proof easily the USGN of a person? I fail there somehow.. -.-
"A work of art is the unique result of a unique temperament." - Oscar Wilde
04.07.10 01:10:03 pm
Up
ohaz
User
Offline Off
if (player(id, "usgn") == 1234) then
https://ohaz.engineer - Software Engineering
04.07.10 11:06:57 pm
Up
Sudden Death
User
Offline Off
Where is drop money system in menu?.. I can't find it.
Sniffin'Man "If it cannot be done with lua, it must be you mama, coz she's too fat"
05.07.10 12:40:59 am
Up
Anders4000
User
Offline Off
@intrusion, have you downloaded it?
Or is the money drop system in menu in the samples folder? guys help me
05.07.10 02:42:14 pm
Up
Sudden Death
User
Offline Off
i download it but i have format comuter.. now i search it here
Sniffin'Man "If it cannot be done with lua, it must be you mama, coz she's too fat"
05.07.10 02:52:09 pm
Up
Ax3
User
Offline Off
Question: Why AMX doesn't works at Linux? What need to do? that instruction on cs2d.org doesn't works! its a problem while calling "newmod" at help.lua (a nil value) Please help me!
06.07.10 01:56:45 am
Up
ifrit723
User
Offline Off
lol... im lost

can u give me a tutorial on how to make a basic Lua script? (role playing ones please) i really want to make a role play script T_T
IMG:http://miniprofile.xfire.com/bg/sh/type/2/ifrit723.png
06.07.10 03:10:08 am
Up
archmage
User
Offline Off
DC's sample Gun Game has a basic leveling system.
We must secure the existence of our people and a future for white children. 14/88
06.07.10 01:34:34 pm
Up
RyceR
User
Offline Off
i want make "kill HP" command. Why it doesn't work...?
Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
addhook("parse","hp_parse")
function hp_parse(cmd)
     if(string.sub(cmd,1,6)=="kill_hp") then
          local es_dmg=string.sub(cmd,8,string.len(cmd))
          k_hp=kill_hp
          print("©255255255HP is now: "..k_hp)
          return 1
     end
end



addhook("kill","player_kill")
function player_kill(killer,victim,wpn)
     if player_health_kill > 0 then
          parse("sethealth "..killer.." "..(player(killer,"health")+kill_hp))
          msg2(killer,"©000255000Health +"..kill_hp.."@C")
     end
end
IMG:http://img704.imageshack.us/img704/4043/userbargimp.png
06.07.10 03:18:48 pm
Up
Emin3m
User
Offline Off
Cool
IMG:http://img34.imageshack.us/img34/2632/14771.gif
and IMG:http://img261.imageshack.us/img261/6214/40083.png
06.07.10 03:24:12 pm
Up
TimeQuesT
User
Offline Off
MSek has written:
i want make "kill HP" command. Why it doesn't work...?
Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
addhook("parse","hp_parse")
function hp_parse(cmd)
     if(string.sub(cmd,1,6)=="kill_hp") then
          local es_dmg=string.sub(cmd,8,string.len(cmd))
          k_hp=kill_hp
          print("©255255255HP is now: "..k_hp)
          return 1
     end
end



addhook("kill","player_kill")
function player_kill(killer,victim,wpn)
     if player_health_kill > 0 then
          parse("sethealth "..killer.." "..(player(killer,"health")+kill_hp))
          msg2(killer,"©000255000Health +"..kill_hp.."@C")
     end
end


is there any error in console?
Muh
Up
texnonikWP
User
Offline Off
Why dont working ?

[ code ]addhook("startround","sample.ut.startround")
function sample.ut.startround()
     local game=math.random(1,4)
     if game==1 then
          parse("trigger a1")
          sample.trigger="a1"
     elseif game==2 then
          parse("trigger a2")
          sample.trigger="a2"
     elseif game==3 then
          parse("trigger a3")
          sample.trigger="a3"
     elseif game==4 then
          parse("trigger a4")
          sample.trigger="a4"
          end
     end
end[ /code ]
06.07.10 03:56:57 pm
Up
RyceR
User
Offline Off
Schinken has written:
is there any error in console?


yeah, if i say command: kill_hp and number (kill_hp 20 or 30)
IMG:http://img704.imageshack.us/img704/4043/userbargimp.png
06.07.10 04:28:02 pm
Up
Refresh
User
Offline Off
guys I need a script what write where are you. like:

Position:
8066 628
06.07.10 04:52:27 pm
Up
RyceR
User
Offline Off
Search the "Mypos, command and hud" mod in lua scripts.
next if you say !mypos or !pos is text:

X Tiles: Y Tiles:
X Pixels: Y Pisels:
IMG:http://img704.imageshack.us/img704/4043/userbargimp.png
06.07.10 05:14:54 pm
Up
Refresh
User
Offline Off
okay now I am a n00b but how to SEARCH at file archive?
06.07.10 05:25:04 pm
Up
ohaz
User
Offline Off
you're not a noob, there just isn't a search function. DC hasn't implemented it yet
https://ohaz.engineer - Software Engineering
To the start Previous 1 2 ... 216 217 218 ... 338 339 Next To the start