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 25 6 7338 339 Next To the start

old Re: Lua Scripts/Questions/Help

Todesengel
User Off Offline

Quote
Why cant another guys my script not use?...

Only i cant this use but the another guys not...

Here`s my Script

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
function initArray(m)
    local array = {}
for i = 1, m do
   array[i]=0
end
  return array
end
  be=initArray(32)

    addhook ("use","be")
function be (id, event, data, x, y)
if (x==23 and y==21) then
    menu (id,"Wenn du Denkst dass du doof bist Zahle  
   1k,Okay ich Zahle,Ich Zahle vielleicht...,Ich Zahle Nicht!")
end
end

     addhook ("menu","das")
function das (id,sel)
if (menu=="Wenn du Denkst dass du doof bist Zahle 1k") then
if (sel==1 and player (id,"money")>999) then
parse ("sethealth "..id.." "..(player(id,"health")+50))
   parse ("setmoney "..id.." "..(player(id,"money")-1000))
 end
end
end


Its a German script sorry, but in the German Forum cant help me...
edited 2×, last 04.05.09 11:37:02 pm

old Re: Lua Scripts/Questions/Help

Lee
Moderator Off Offline

Quote
BeLiioN has written
Leegaoo?,

How make a script,

I trigger a trigger_use with name "menu",
then come a menu with function.. how i make this? can you make a sample to this ?

youre Profi in lua :P..


You'll have to use a use hook not a trigger hook in this case since CS2D doesn't pass in the player who triggered the event.

After that just call the normal menu(p, "title, item, list")

old Re: Lua Scripts/Questions/Help

Todesengel
User Off Offline

Quote
Hmm, When you have Time for me, can you make me a Easy Script for a Menu what i Trigger with Trigger use?...


When do you have time for me, then i Thank you very very much...

old Re: Lua Scripts/Questions/Help

Lee
Moderator Off Offline

Quote
BeLiioN has written
Hmm, When you have Time for me, can you make me a Easy Script for a Menu what i Trigger with Trigger use?...


When do you have time for me, then i Tank you very very much...


well, I have 6 AP tests, 3 SAT 2 Subject tests, and my final examinations coming up all within the next 3 weeks so I'm not sure that I'll be able to find much time anytime soon.

old Re: Lua Scripts/Questions/Help

Todesengel
User Off Offline

Quote
Hmm..

Simple Question, is it difficult or it is a work from 5 Minutes?

     
Like you said I would be grateful if you sent me a small menu on doing what I can use the trigger ... nothing big, but it should all use.


Okay.. I look soon, maybe have you create this little script..


Edit:,

Okay no script

Can me help a another guy ?
edited 1×, last 05.05.09 01:21:21 pm

old Re: Lua Scripts/Questions/Help

sonnenschein
User Off Offline

Quote
can someone make me a script that equips you with a weapon ( i will type weapon myself)
when you trigger a certain trigger (trigger_use)

so when you press "E" in front of trigger_use, you got item. but certain (certain trigger of course) not any

and a script that automatically parse "setpos" a player who press E in front of trigger
thnx
edited 1×, last 06.05.09 05:41:44 pm

old Re: Lua Scripts/Questions/Help

TMK
User Off Offline

Quote
TMK's Admin Plugin

Version: Pre Alpha

∗Modules:
- Team Kill/Wound Protection
- Warmup
- Adverts
- Stats
- Victim Stats
- Voting (Rock the Vote, Vote Ban, Vote Kick)
- Betting
- Bounty
- MugMod
- Restrict Weapons (x per team)
- Basic Team Balance
- Slot Reservation

∗Console commands:
-wait
-tap_restrict weapon [amount per team] (0 - Restricted)
-tap_vote Question;Answer1::commands;Answer2::commands;...
tap_vote Votemap;de_dust::map de_dust;de_aztec::map de_aztec;de_inferno::map de_inferno
-tap_slaymenu ID
-tap_slapmenu ID
-tap_kickmenu ID
-tap_banmenu ID
-tap_votebanmenu ID
-tap_votekickmenu ID

∗Say commands:
!kpd, !statsme
!rank, !place
!kpm
!rtv, !rockthevote
!nominate
!voteban
!votekick
+ commandslist.txt for admins

Link:
http://www.speedyshare.com/826519443.html

old Re: Lua Scripts/Questions/Help

Admir
User Off Offline

Quote
TMK has written
TMK's Admin Plugin

Version: Pre Alpha

∗Modules:
- Team Kill/Wound Protection
- Warmup
- Adverts
- Stats
- Victim Stats
- Voting (Rock the Vote, Vote Ban, Vote Kick)
- Betting
- Bounty
- MugMod
- Restrict Weapons (x per team)
- Basic Team Balance
- Slot Reservation

∗Console commands:
-wait
-tap_restrict weapon [amount per team] (0 - Restricted)
-tap_vote Question;Answer1::commands;Answer2::commands;...
tap_vote Votemap;de_dust::map de_dust;de_aztec::map de_aztec;de_inferno::map de_inferno
-tap_slaymenu ID
-tap_slapmenu ID
-tap_kickmenu ID
-tap_banmenu ID
-tap_votebanmenu ID
-tap_votekickmenu ID

∗Say commands:
!kpd, !statsme
!rank, !place
!kpm
!rtv, !rockthevote
!nominate
!voteban
!votekick
+ commandslist.txt for admins

Link:
http://www.speedyshare.com/826519443.html


what is MugMod?

old Re: Lua Scripts/Questions/Help

Zune5
COMMUNITY BANNED Off Offline

Quote
leegao has written
BeLiioN has written
Hmm, When you have Time for me, can you make me a Easy Script for a Menu what i Trigger with Trigger use?...


When do you have time for me, then i Tank you very very much...


well, I have 6 AP tests, 3 SAT 2 Subject tests, and my final examinations coming up all within the next 3 weeks so I'm not sure that I'll be able to find much time anytime soon.


You too?
Good Luck.

old Re: Lua Scripts/Questions/Help

wenn
User Off Offline

Quote
Is there a way using lua script to return a value whenever a players toggle on and off nightvision?

player(id,"nightvision") only returns a value true or false if it's equipped, not for turning it on and off.

old Re: Lua Scripts/Questions/Help

DC
Admin On Online

Quote
no. that's not possible. the server doesn't know if the nightvision of a certain is on or off. so it's not possible to add Lua hooks for that.

old Re: Lua Scripts/Questions/Help

wups
User Off Offline

Quote
LinuxGuy has written
can someone make me a script that equips you with a weapon ( i will type weapon myself)
when you trigger a certain trigger (trigger_use)

so when you press "E" in front of trigger_use, you got item. but certain (certain trigger of course) not any

and a script that automatically parse "setpos" a player who press E in front of trigger
thnx


http://amx2d.co.cc/viewtopic.php?f=11&t=79

Recode this one, i think it's exactly like you want it to do.

old Re: Lua Scripts/Questions/Help

spartan029
User Off Offline

Quote
wups has written
LinuxGuy has written
can someone make me a script that equips you with a weapon ( i will type weapon myself)
when you trigger a certain trigger (trigger_use)

so when you press "E" in front of trigger_use, you got item. but certain (certain trigger of course) not any

and a script that automatically parse "setpos" a player who press E in front of trigger
thnx


http://amx2d.co.cc/viewtopic.php?f=11&t=79

Recode this one, i think it's exactly like you want it to do.


Well wait a sec! DC added the "only appere when triggerd" to the evn_item already!! So why would LinuxGuy and wups need this script?

old Re: Lua Scripts/Questions/Help

sonnenschein
User Off Offline

Quote
spartan029 has written
Well wait a sec! DC added the "only appere when triggerd" to the evn_item already!! So why would LinuxGuy and wups need this script?


Can you make this possible with no lua:
You loose money when you press a trigger (and get item at the same time). I don't think so, but if you do, please say

EDIT: This doesn't work. I recoded original for AMX

1
2
3
4
5
6
7
8
9
10
11
12
13
addhook("use","elevator.press")
 function elevator.press(id, event, data, x, y)

	xtrig = 86 -- The X-position of the trigger
	ytrig = 75 -- The Y-position of the trigger
  
	if (x == xtrig) and (y == ytrig) then
		parse("setpos "..id.." "100 100")
		msg2(id, "*ding*")

		end
	end 
 end
edited 3×, last 08.05.09 07:52:54 pm

old Re: Lua Scripts/Questions/Help

Lee
Moderator Off Offline

Quote
1
2
3
4
5
6
7
8
9
10
11
12
13
addhook("use","elevator.press")
 function elevator.press(id, event, data, x, y)

	xtrig = 86 -- The X-position of the trigger
	ytrig = 75 -- The Y-position of the trigger
  
	if (x == xtrig) and (y == ytrig) then
		parse("setpos "..id.." "100 100")
		msg2(id, "*ding*")

		end
	end 
 end

Is elevator a table? (Did you do elevator = {})?

also

          parse("setpos "..id.." "100 100")

That should be
          parse("setpos "..id.."100 100")

Quote
Why cant another guys my script not use?...

Only i cant this use but the another guys not...

Here`s my Script...


What do you see in the console when you trigger the use key?

old Re: Lua Scripts/Questions/Help

KimKat
GAME BANNED Off Offline

Quote
How to add white color to this line?

1
2
3
4
5
6
7
8
9
function sample.badwords.say(p,t)
	t=string.lower(t)
	for i = 1,#sample.badwords.words do
		if (string.find(t,sample.badwords.words[i])~=nil) then
			[b]msg(player (p,"name").." has been given a warning for foul language!")[/b]
			parse("slap "..p)
			break
		end
	end
Thanks in advanced.

old Re: Lua Scripts/Questions/Help

Lee
Moderator Off Offline

Quote
KimKat has written
How to add white color to this line?
Thanks in advanced.


add this into ur code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
function digits(n, p, m)
     if not m then m = 10^p - 1 end
     if n == 0 then return "000" end
     if n <= m then
          local _p = 0
          while (n < 10^(p-1)) do
               p = p-1
               _p = _p + 1
          end
          local str = n
          for i = 1, _p, 1 do
               str = "0"..str
          end
          return str
     else
          return m
     end
end

function Color(r, b, g)
     return string.format("©%s%s%s", digits(r, 3, 255), digits(b, 3, 255),digits(g, 3, 255))
end

and then change your code to

1
2
3
4
5
6
7
8
9
function sample.badwords.say(p,t)
     t=string.lower(t)
     for i = 1,#sample.badwords.words do
          if (string.find(t,sample.badwords.words[i])~=nil) then
               msg(Color([b][u]Red, Blue, Green[/u][/b])...player (p,"name").." has been given a warning for foul language!")
               parse("slap "..p)
               break
          end
     end

Replace Red, Blue, and Green with a number from 0 to 255 (In this case it will be Color(255, 255, 255))
To the start Previous 1 25 6 7338 339 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview