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 2249 250 251338 339 Next To the start

old Help.

waguininho100
User Off Offline

Quote
This script is not working. What's wrong with him?

Code:

!givelicense ID
!removelicense ID

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

license = initArray(32)
posy = initArray(32)
posx = initArray(32)
collect = initArray(32)

addhook("leave","license_leave")
function license_leave(id)
license[id]=0
collect[id]=0
posy[id]=0
posx[id]=0
end

addhook("serveraction","license_action")
function license_action(id,b)
if license[id]==1 and b==1 then
menu(id,"License Menu,Set Pos,Teleport,Collect")
elseif license[id]==0 and b==1 then
msg2(id,"You dont have license")
end
end

addhook("menu","license_menu")
function license_menu(id,title,button)
if title=="License Menu" then
if button==1 then
posx[id]=player(id,"x")
posy[id]=player(id,"y")
msg2(id,"Youve saved ur positon")
elseif button==2 and posy[id]==1 and posx[id]==1 then
parse ("setpos "..p.." "..posx[id].." "..posy[id])
msg2(id,"Youve teleported your self")
elseif button==2 and posy[id]==0 posx[id]==0 and
msg2(id,"You cant teleport your self, No position setted")
elseif button==3 collect[id]==0 then
msg2(id,"Collection ON")
collect[id]=1
elseif button==3 collect[id]==1 then
msg2(id,"Collection OFF")
collect[id]=0
end
end
end

addhook("collect","license_collect")
function license_collect(id)
if collect[id]==1 then
return 1
elseif collect[id]==0 then
return 0
end
end

old Re: Lua Scripts/Questions/Help

Aqua-
User Off Offline

Quote
Ruirize has written
Stop copying the CC.

Really.

Use your imaginations, don't just steal ideas.

Woot? I stealed nothing; fail.
edit: If u ment me xP

old Re: Lua Scripts/Questions/Help

murilog
User Off Offline

Quote
hi all i want one script like this : cts say !infoct <id> , and player go to jail and spawn on jail , if txt !free <id> the player is free thx , the jail Y : 100 X :100

old Re: Lua Scripts/Questions/Help

Flacko
User Off Offline

Quote
Balance has written
Im trying to make a script for my server that heals you when you hit with a gutbomb, and yeah that doesnt have a return 1 yet but I dont think thats the problem.
1
2
3
4
5
6
7
addhook("hit","ham_hit")
function ham_hit(weapon, id, source)
	if(weapon>86) then
		parse("sethealth "..source.." "..player(source,"health")+math.random(10,20))
		msg2(source,"You have eaten a hamburger!")
	end
end

Good, but you're using the bigger than operator (>), when you should use the equal operator (==), also, your parameters' order is messed up. Just replace these lines:
1
2
function ham_hit(id,source,weapon)
if weapon == 86

old Re: Lua Scripts/Questions/Help

archmage
User Off Offline

Quote
FN_Nemesis has written
hello everyone i need a script that make only weapons to use flare 3!

I can not understand you. Explain (In a way that can be understood).

old Re: Lua Scripts/Questions/Help

J4x
User Off Offline

Quote
@Darkbyte im trying to say that the weapons use flare3 like muzzleflash when u change it , it affects the ligths and every thing.
edited 1×, last 03.09.10 03:01:49 am

old Drop knife lua Q

Phenixtri
User Off Offline

Quote
Ello chaps tis DJ Pheny here & im in dire need of help.

I want to use HaRes & vesa-omars dropknife lua (already asked for permission which is pending) for NTDs half life mod but i need to 1st modify it so that when u drop the knife a knife_d model actually appears like with other weapons.

the D model knife must also be capable of being picked up like with other weapons.

heres the DL link to the lua
http://www.unrealsoftware.de/files_show.php?file=1922

Heres the actual code. Could someone plz tell me what i would have to do in order to make this lua drop a usable knife_d model?

Code:
parse("mp_wpndmg claw 0")
function initArray(m)
     local array = {}
     for i = 1, m do
          array[i]=0
     end
     return array
end
knife = initArray(32)
addhook("walkover","dropknife_walkover")
function dropknife_walkover(id,iid,type,ain,a,mode)
     if type==50 then
          parse("strip "..id.." 78")
          knife[id]=1
     end
end
addhook("drop","dropknife_drop_claw")
function dropknife_drop_claw(id,iid,type,ain,a,mode,x,y)
     if type==78 then
          return 1
     end
end
addhook("die","dropknife_die_claw")
function dropknife_die_claw(victim,killer,weapon,x,y)
     if weapon==78 then
          return 1
     end
end
addhook("die","dropknife_die")
function dropknife_die()
     knife[id]=0
end
kniferemove=0
addhook("drop","dropknife_dropcheck")
function dropknife_dropcheck(id,iid,type,ain,a,mode,x,y)
     if knife[id]==1 then
          return 0
     elseif knife[id]==0 then
          parse("setweapon "..id.." 78")
          kniferemove=0
     end
end
addhook("ms100","dropknife_second")
function dropknife_second()
     for i = 1,32 do
          kniferemove=kniferemove+1
          if kniferemove==1 then

god damit how do i get this retarded code thing working >>
edited 3×, last 03.09.10 04:14:31 am

old Re: Lua Scripts/Questions/Help

murilog
User Off Offline

Quote
hi all i want one script like this : cts say !infoct <id> , and player go to jail and spawn on jail , if txt !free <id> the player is free thx , the jail Y : 100 X :100

old Re: Lua Scripts/Questions/Help

Aqua-
User Off Offline

Quote
Flacko has written
Balance has written
Im trying to make a script for my server that heals you when you hit with a gutbomb, and yeah that doesnt have a return 1 yet but I dont think thats the problem.
1
2
3
4
5
6
7
addhook("hit","ham_hit")
function ham_hit(weapon, id, source)
	if(weapon>86) then
		parse("sethealth "..source.." "..player(source,"health")+math.random(10,20))
		msg2(source,"You have eaten a hamburger!")
	end
end

Good, but you're using the bigger than operator (>), when you should use the equal operator (==), also, your parameters' order is messed up. Just replace these lines:
1
2
function ham_hit(id,source,weapon)
if weapon == 86

heyy thanks imma try it now.
EDIT: Didnt work all it does is just throw the gutbomb..?
EDIT2: Now I just understood that you actually gotta hit yourself :/, does any know a hook like on shoot?
edited 1×, last 03.09.10 03:55:24 pm

old Re: Lua Scripts/Questions/Help

HaRe
User Off Offline

Quote
Balance has written
Flacko has written
Balance has written
Im trying to make a script for my server that heals you when you hit with a gutbomb, and yeah that doesnt have a return 1 yet but I dont think thats the problem.
1
2
3
4
5
6
7
addhook("hit","ham_hit")
function ham_hit(weapon, id, source)
	if(weapon>86) then
		parse("sethealth "..source.." "..player(source,"health")+math.random(10,20))
		msg2(source,"You have eaten a hamburger!")
	end
end

Good, but you're using the bigger than operator (>), when you should use the equal operator (==), also, your parameters' order is messed up. Just replace these lines:
1
2
function ham_hit(id,source,weapon)
if weapon == 86

heyy thanks imma try it now.
EDIT: Didnt work all it does is just throw the gutbomb..?
EDIT2: Now I just understood that you actually gotta hit yourself :/, does any know a hook like on shoot?


1
2
3
addhook("attack","whatever")
function whatever(id)
	if (player(id,"weapontype") == ID) then

old Re: Lua Scripts/Questions/Help

Aqua-
User Off Offline

Quote
1
2
3
4
5
6
7
addhook("attack","ham_eat")
function ham_eat(id)
     if (player(id,"weapontype") == 86) then
		parse("sethealth "..id.." "..player(id,"health")+math.random(10,20))
		msg2(id,"You have eaten a hamburger!")
	end
end

LUA ERROR: attempt to call a nil valve
Spoiler >

old Re: Lua Scripts/Questions/Help

FASTDIE
User Off Offline

Quote
try this
in this u will eat hamburger on collectin and u cant drop hamburger and eat this again u must throw it

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
addhook("collect","hamburger")
function hamburger(id,iid,type,ain,a,mode)
	if type==86 then
		parse("sethealth "..id.." "..player(id,"health")+math.random(10,20))
		msg2(id,"You have eaten a hamburger!")
	end
end

addhook("drop","dropham")
function dropham(id,iid,type,ain,a,mode,x,y)
	if type==86 then
	return 1 
	end
return 0 
end

i hope it helped u

old Re: Lua Scripts/Questions/Help

CJ7
BANNED Off Offline

Quote
Phenixtri has written
wow >> so much for asking for help >> makes this thread kinda useless if no one actually responds to your question >>


Whenever you post a lua script, wrap it in the CODE tags, for readability's sake. Also, the script you posted isn't even complete, it's missing a few "end"s at the end.

old Re: Lua Scripts/Questions/Help

Phenixtri
User Off Offline

Quote
yea i couldnt get the damed code thing to work >> sry about that. Im talking with HaRe about the lua now so maybe he can help me as he partly made the original lua

old now this:

Aqua-
User Off Offline

Quote
So I want a command that when you say !give_ham, it gives the target a hamburger GutBomb ID = 86. But I have no idea what I'm supposed to do; help here?

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("hit","ham_hit")
function ham_hit(id,source,weapon)
if weapon == 86 then
        parse("sethealth "..source.." "..player(source,"health")+math.random(10,20))
        msg2(source,"You have eaten a hamburger!")
	return 1
    end
end

addhook("drop","ham_drop")
function dropham(id,iid,type,ain,a,mode,x,y)
     if type==86 then
     return 1 
     end
return 0 
end

addhook("say","ham_say")
function ham_say(p,txt,weapon)
	if (txt=="!give_ham") then
		else if weapon == 86 then
			parse("strip "..p.." 4")
		end
		return 1
	end
end
edited 1×, last 03.09.10 08:52:17 pm

old Re: Lua Scripts/Questions/Help

FASTDIE
User Off Offline

Quote
I TESTED THIS! dont edit hooks and functions name cuz it result ERROR attempt to call nil value DONT EDIT


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
addhook("attack","hamthrow")
function hamthrow(id)
     if (player(id,"weapontype") == 86) then
parse("sethealth "..id.." "..player(id,"health")+math.random(10,20))
msg2(source,"You have eaten a hamburger!")
     return 1
end
end

addhook("drop","hamdrop")
function hamdrop(id,iid,type,ain,a,mode,x,y)
if type==86 then
return 1
end
return 0
end

addhook("say","getham")
function getham(p,txt,weapon)
	if (txt=="!give_ham") then
		parse("equip "..p.." 86")
		return 1
	end
end
To the start Previous 1 2249 250 251338 339 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview