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 2183 184 185338 339 Next To the start

old Re: Lua Scripts/Questions/Help

GreenDevil
User Off Offline

Quote
Hi all, i tryied to do when i reload i getting a portal gun (for fun)
It doesn't work why? please help
1
2
3
4
5
6
addhook("reload","player")
function player(id,mode)
	if (player(id,"reload") == 1) then
		parse('equip "..id.." 88')
end
end

old Re: Lua Scripts/Questions/Help

goweiwen
User Off Offline

Quote
@oleg58300
The hit hook's parameters are as follows:
hit(id,source,weapon,hpdmg,apdmg)
Yours is the other way round, so the killer is actually the victim and vice versa.

old Buy Menu

Soja1997
User Off Offline

Quote
Somebody can make the Buy Menut for me because alone I am not able
Medikit|500$
Bandage|100$
Vodka|100$ parse("shake "..id.." 20000")
PrimaryAmmo|300$
SecondaryAmmo|300$
Snowball|3000$
Armor100|1000$
Armor200|3000$
Speed x5|1000$
Speedx10|3000$

old Re: Lua Scripts/Questions/Help

Admir
User Off Offline

Quote
Editorman has written
Hi all, i tryied to do when i reload i getting a portal gun (for fun)
It doesn't work why? please help
1
2
3
4
5
6
addhook("reload","player")
function player(id,mode)
	if (player(id,"reload") == 1) then
		parse('equip "..id.." 88')
end
end


Maybe something like this?

1
2
3
4
5
6
addhook("reload","player")
function player(id,mode)
	if mode == 1 then
		parse('equip "..id.." 88')
end
end

old Buy Menu

Soja1997
User Off Offline

Quote
Somebody can make the Buy Menut for me because alone I am not able
Medikit|500$
Bandage|100$
Vodka|100$ parse("shake "..id.." 20000")
PrimaryAmmo|300$
SecondaryAmmo|300$
Snowball|3000$
Armor100|1000$
Armor200|3000$
Speed x5|1000$
Speedx10|3000$

old Re: Lua Scripts/Questions/Help

Admir
User Off Offline

Quote
Editorman has written
Edit:

Doesn't work i dont getting the portal gun


LOL.

you can get like this

1
2
3
4
5
6
addhook("reload","player")
function player(id,mode)
	if (mode == 1 or mode == 2) then
		parse("equip "..id.." 88")
	end
end

or

1
2
3
4
addhook("reload","player")
function player(id,mode)
	parse("equip "..id.." 88")
end

but you need to shot then reload, you can't by pressing R without any reload on weapon.

old Re: Lua Scripts/Questions/Help

Soja1997
User Off Offline

Quote
Somebody can make the Buy Menut for me because alone I am not able
Medikit|500$
Bandage|100$
Vodka|100$ parse("shake "..id.." 20000")
PrimaryAmmo|300$
SecondaryAmmo|300$
Snowball|3000$
Armor100|1000$
Armor200|3000$
Speed x5|1000$
Speedx10|3000$

HEEELP MEE!

old Re: Lua Scripts/Questions/Help

YellowBanana
BANNED Off Offline

Quote
Soja1997 has written
Somebody can make the Buy Menut for me because alone I am not able
Medikit|500$
Bandage|100$
Vodka|100$ parse("shake "..id.." 20000")
PrimaryAmmo|300$
SecondaryAmmo|300$
Snowball|3000$
Armor100|1000$
Armor200|3000$
Speed x5|1000$
Speedx10|3000$

HEEELP MEE!



Here you go

Spoiler >


And this one is even easier to edit:

Spoiler >


use f2 to open the buymenu.
edited 2×, last 05.04.10 12:12:25 pm

old Re: Lua Scripts/Questions/Help

DRoNe
User Off Offline

Quote
How i make something like a rank if player1 has more kills like player2 and that player1 will be added to message ...

i was trying to make it but in vain

old Re: Lua Scripts/Questions/Help

TimeQuesT
User Off Offline

Quote
pls explain better.
do you mean when for example:
player 1 kills player 2 -->
player 1 has more kills than player 2 -->
player 1 gets a message?

1
2
3
4
5
6
addhook ("kill","killen")
function killen(id,oper)
if(player(id,"score")>player(opfer,"score")) then
msg2 (id,"your kills are higher than you enemys one");
end
end

old Re: Lua Scripts/Questions/Help

Patasuss
User Off Offline

Quote
Hi,
My script failes to change the imagealpha:
1
2
3
4
5
bgid=image("gfx/pgfx/whitepix.bmp",0,1,1)
imagepos(bgid,0,0,0)
imagescale(bgid,map("xsize")*32,map("ysize")*32)
imageblend(bgid,1)
imagealpha(bgid,0.5)
Could someone help me?
BTW: This script draws an image over the hole map, and whitepix.bmp is a 1x1 px image

old Re: Lua Scripts/Questions/Help

DRoNe
User Off Offline

Quote
Schinken has written
pls explain better.
do you mean when for example:
player 1 kills player 2 -->
player 1 has more kills than player 2 -->
player 1 gets a message?

1
2
3
4
5
6
addhook ("kill","killen")
function killen(id,oper)
if(player(id,"score")>player(opfer,"score")) then
msg2 (id,"your kills are higher than you enemys one");
end
end


yes if player has more kills than all players on server -->
msg("Player name '..kills..'")
edited 2×, last 05.04.10 02:40:51 pm

old Re: Lua Scripts/Questions/Help

Soja1997
User Off Offline

Quote
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
items = {
               {title ="Medikit",price = 500,cmd = "equip",param=64},
               {title ="Bandage",price = 100,cmd = "equip",param=65},
               {title = "Vodka",price=100,cmd = "shake",param=20000},
               {title = "PrimaryAmmo",price=300,cmd = "equip",param=61},
               {title = "SecondaryAmmo",price=300,cmd = "equip",param=62},
               {title = "Snowball",price=3000,cmd = "equip",param=75},
               {title = "Armor100",price=1000,cmd = "setarmor",param=100},
               {title = "Armor200",price=3000,cmd = "setarmor",param=200},
               {title = "Speed x5",price=1000,cmd = "speedmod",param=25},
               {title = "Speed x10",price=3000,cmd = "speedmod",param=50},
               {title = "MAC10",price=16000,cmd = "equip",param=23}
          }

function createMenu(header, matrix)
     local menuString = header;
     menuString = menuString..", "
     for key, value in ipairs(matrix) do
          menuString = menuString..value.title.." | $"..tostring(value.price).. ","
     end
     return menuString
end


addhook("serveraction","my_serveraction")
function my_serveraction(id,action)
     if(action == 1) then
          menu(id,createMenu("Items",items))
     end
end

addhook("menu","my_menu")
function my_menu(id,title,button)
     if(button == 0) then
          return
     end

     if(title == "Items") then
          if(player(id,"money") > items[button].price) then
               parse("setmoney "..id.." "..(player(id,"money") - items[button].price))
               cmd = string.format("%s %i %i",items[button].cmd,id,items[button].param)
               parse(cmd)
          else
               msg2(id,"©255000000 You have insufficient funds!")
          end
     end
end
Hey can you make next page? only 9 items are located at this page
edited 1×, last 05.04.10 09:54:32 pm

old Re: Lua Scripts/Questions/Help

DRoNe
User Off Offline

Quote
Schinken has written
pls explain better.
do you mean when for example:
player 1 kills player 2 -->
player 1 has more kills than player 2 -->
player 1 gets a message?

1
2
3
4
5
6
addhook ("kill","killen")
function killen(id,oper)
if(player(id,"score")>player(opfer,"score")) then
msg2 (id,"your kills are higher than you enemys one");
end
end


yes if player has more kills than all players on server -->
msg("Player name '..kills..'")

old Plz Make Next Page

Soja1997
User Off Offline

Quote
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
items = {
               {title ="Medikit",price = 500,cmd = "equip",param=64},
               {title ="Bandage",price = 100,cmd = "equip",param=65},
               {title = "Vodka",price=100,cmd = "shake",param=20000},
               {title = "PrimaryAmmo",price=300,cmd = "equip",param=61},
               {title = "SecondaryAmmo",price=300,cmd = "equip",param=62},
               {title = "Snowball",price=3000,cmd = "equip",param=75},
               {title = "Armor100",price=1000,cmd = "setarmor",param=100},
               {title = "Armor200",price=3000,cmd = "setarmor",param=200},
               {title = "Speed x5",price=1000,cmd = "speedmod",param=25},
               {title = "Speed x10",price=3000,cmd = "speedmod",param=50},
               {title = "MAC10",price=16000,cmd = "equip",param=23}
          }

function createMenu(header, matrix)
     local menuString = header;
     menuString = menuString..", "
     for key, value in ipairs(matrix) do
          menuString = menuString..value.title.." | $"..tostring(value.price).. ","
     end
     return menuString
end


addhook("serveraction","my_serveraction")
function my_serveraction(id,action)
     if(action == 1) then
          menu(id,createMenu("Items",items))
     end
end

addhook("menu","my_menu")
function my_menu(id,title,button)
     if(button == 0) then
          return
     end

     if(title == "Items") then
          if(player(id,"money") > items[button].price) then
               parse("setmoney "..id.." "..(player(id,"money") - items[button].price))
               cmd = string.format("%s %i %i",items[button].cmd,id,items[button].param)
               parse(cmd)
          else
               msg2(id,"©255000000 You have insufficient funds!")
          end
     end
end
Hey can you make next page? only 9 items are located at this page
To the start Previous 1 2183 184 185338 339 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview