Forum

> > CS2D > Scripts > Lua Scripts/Questions/Help
ForenübersichtCS2D-Übersicht Scripts-ÜbersichtEinloggen, um zu antworten

Englisch Lua Scripts/Questions/Help

6.770 Antworten
Seite
Zum Anfang Vorherige 1 2183 184 185338 339 Nächste Zum Anfang

alt Re: Lua Scripts/Questions/Help

GreenDevil
User Off Offline

Zitieren
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

alt Re: Lua Scripts/Questions/Help

goweiwen
User Off Offline

Zitieren
@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.

alt Buy Menu

Soja1997
User Off Offline

Zitieren
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$

alt Re: Lua Scripts/Questions/Help

Admir
User Off Offline

Zitieren
Editorman hat geschrieben
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

alt Buy Menu

Soja1997
User Off Offline

Zitieren
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$

alt Re: Lua Scripts/Questions/Help

Admir
User Off Offline

Zitieren
Editorman hat geschrieben
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.

alt Re: Lua Scripts/Questions/Help

Soja1997
User Off Offline

Zitieren
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!

alt Re: Lua Scripts/Questions/Help

YellowBanana
BANNED Off Offline

Zitieren
Soja1997 hat geschrieben
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.
2× editiert, zuletzt 05.04.10 12:12:25

alt Re: Lua Scripts/Questions/Help

DRoNe
User Off Offline

Zitieren
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

alt Re: Lua Scripts/Questions/Help

TimeQuesT
User Off Offline

Zitieren
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

alt Re: Lua Scripts/Questions/Help

Patasuss
User Off Offline

Zitieren
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

alt Re: Lua Scripts/Questions/Help

DRoNe
User Off Offline

Zitieren
Schinken hat geschrieben
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..'")
2× editiert, zuletzt 05.04.10 14:40:51

alt Re: Lua Scripts/Questions/Help

Soja1997
User Off Offline

Zitieren
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
1× editiert, zuletzt 05.04.10 21:54:32

alt Re: Lua Scripts/Questions/Help

DRoNe
User Off Offline

Zitieren
Schinken hat geschrieben
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..'")

alt Plz Make Next Page

Soja1997
User Off Offline

Zitieren
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
Zum Anfang Vorherige 1 2183 184 185338 339 Nächste Zum Anfang
Einloggen, um zu antworten Scripts-ÜbersichtCS2D-ÜbersichtForenübersicht