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 2186 187 188338 339 Next To the start

old Script

Soja1997
User Off Offline

Quote
So this way somebody has or he is able to do the script that it is possible to have more than 16000 $

old Re: Lua Scripts/Questions/Help

Dictatus Papae
User Off Offline

Quote
I need to know how to do perma like in cc rp in gamemodes like con and dm. The only thing I can't figure out is how to spawn the item on the players position that the player has selected, so I mean if he has ak47 selected when he/she wants to drop then can I spawn the exact same item, and then also take the item away from the player instead of droping it normally.

old Re: Lua Scripts/Questions/Help

siuL
User Off Offline

Quote
Khaleed has written
YellowBanana has written
Pikachu_Lv85 has written
Khaleed has written
Spoiler >

Some1 help i need to make it just for terrorists

Maybe this will help (I am a noob...)

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
--------------------------------------------------
-- Glowing Players Script by Unreal Software    --
-- 08.11.2009 - www.UnrealSoftware.de           --
--------------------------------------------------

if sample==nil then sample={} end
sample.glowing={}

-- I won't be using the samples table if I were you...

--------------------------------------
-- GLOW                             --
--------------------------------------

-- Glow Function
function sample.glowing.makeallglow()
	if (team==1) then
		for i=1,32,1 do
			id=image("gfx/sprites/flare2.bmp",0,0,100+i)	-- Create image @ Player
			imagecolor(id,255,255,0)				-- Make image yellow
			imageblend(id,1)						-- Make image glow
			imagealpha(id,0.5)					-- Decrease Glow Strength
		end
	end
end

-- Make Glow instantly after starting server
sample.glowing.makeallglow()

-- Make Glow after roundstart (because images are deleted on roundstart!)
addhook("startround","sample.glowing.startround")
function sample.glowing.startround()
	sample.glowing.makeallglow()
end


seriously, learn to script..
What is "team" in your script?
This is how it should be.

Spoiler >

it dont says it have error but isnt workin

no1 help me...

old Re: Lua Scripts/Questions/Help

Sleepin
User Off Offline

Quote
Terminator T02 has written
I need to know how to do perma like in cc rp in gamemodes like con and dm. The only thing I can't figure out is how to spawn the item on the players position that the player has selected, so I mean if he has ak47 selected when he/she wants to drop then can I spawn the exact same item, and then also take the item away from the player instead of droping it normally.


Use the hook "drop" and use strip and spawnitem when your dropping a item

old Re: Lua Scripts/Questions/Help

Dictatus Papae
User Off Offline

Quote
banana200000 has written
Terminator T02 has written
I need to know how to do perma like in cc rp in gamemodes like con and dm. The only thing I can't figure out is how to spawn the item on the players position that the player has selected, so I mean if he has ak47 selected when he/she wants to drop then can I spawn the exact same item, and then also take the item away from the player instead of droping it normally.


Use the hook "drop" and use strip and spawnitem when your dropping a item


Yeah, but the thing I need to know is which player value is the one for the selected item and how can I "unequip" the player without the player dropping the item, cause if do drop and spawnitem, then it will duplify the item, not only perma drop it.

old Re: Lua Scripts/Questions/Help

Patasuss
User Off Offline

Quote
1
2
3
4
5
6
7
8
addhook("drop","tdrop")
fucntion tdrop(id,iid,type,ain,a,mode,x,y)
	parse("strip "..id.." "..iid)
	if(ain>0) then
	parse("spawnitem "..iid.." "..(player(id,"tilex")).." "..(player(id,"tiley")))
	end
	return 1
end
should work

old Re: Lua Scripts/Questions/Help

Sudden Death
User Off Offline

Quote
I have promblem with my first lua. I use "glowingplayers" but my image don't moving "free", i don't know how to make it "free"(moving with player).

old Re: Lua Scripts/Questions/Help

TimeQuesT
User Off Offline

Quote
Intrusion has written
I have promblem with my first lua. I use "glowingplayers" but my image don't moving "free", i don't know how to make it "free"(moving with player).


what image mod do you use?
to draw image permament over player use imgmode:
200+id

old Re: Lua Scripts/Questions/Help

Dictatus Papae
User Off Offline

Quote
Patasuss has written
1
2
3
4
5
6
7
8
addhook("drop","tdrop")
fucntion tdrop(id,iid,type,ain,a,mode,x,y)
	parse("strip "..id.." "..iid)
	if(ain>0) then
	parse("spawnitem "..iid.." "..(player(id,"tilex")).." "..(player(id,"tiley")))
	end
	return 1
end
should work


Ok, this should work, but how do I make it only work once, then if the player wants to do it again, it will have to be called again with a sayfunction or menu button (I don't need the say or menu function, I know how to do them)

old Re: Lua Scripts/Questions/Help

Lee
Moderator Off Offline

Quote
Error Handling within Lua using an implementation of try{}.except{}

http://gist.github.com/361772

Examples:

1
2
3
4
5
6
7
8
9
10
11
12
require "try"

try{
	function()
		a = a/a
		return a
	end
}.except(Exceptions.NilError){
	function(caught,exp,detail) print(exp, detail) end
}

print("\nProgram Successfully Terminated.")

Gives the following output
1
2
3
{GlobalError, NilError, GenericError, TypeError, ValueError, ArithmeticError}	lua:5: attempt to perform arithmetic on global 'a' (a nil value)

[b]Program Successfully Terminated.[/b]

The following error cases are supported.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
Exceptions.ConcatenationError
Exceptions.LocalError
Exceptions.StringError
Exceptions.NumberError
Exceptions.ValueError
Exceptions.GlobalError
Exceptions.GeneratorError
Exceptions.NilError
Exceptions.EnvironmentError
Exceptions.ComparisonError
Exceptions.FunctionError
Exceptions.TableError
Exceptions.TypeError
Exceptions.ArithmeticError
Exceptions.ParameterError
Exceptions.AssertionError
Exceptions.GenericError

All other exception classes automatically propagate to the Exceptions.GenericError class.

For example, a general exception handler can be written as

1
2
3
4
5
try{
	[b]block[/b]
}.except{
	[b]exception handler[/b]
}

Which is equivalent to

1
2
3
4
5
try{
	[b]block[/b]
}.except[u]()[/u]{
	[b]exception handler[/b]
}
and

1
2
3
4
5
try{
	[b]block[/b]
}.except[u](Exceptions.GenericError)[/u]{
	[b]exception handler[/b]
}

The Try-Except blocks are also contextual, meaning that if they were called from within a function, all of the local variables of the function are exposed (in a read-only manner for execution integrity) to the error handler. Thus, we can write something like the following:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
function test(a)
	try{
		function()
			print(a/a)
		end
	}.except{
		function(caught,exp,detail) print(exp, detail) end
	}
end

test(1)
test(0)
test()
test(test)


print("\nProgram Successfully Terminated.")

Which will correctly produce, even with the local values buried within the target function, intended results of a/a

1
2
3
4
5
6
1
-1.#IND
{TypeError, NilError, ArithmeticError, ValueError, GenericError}	try.lua:162: attempt to perform arithmetic on upvalue 'a' (a nil value)
{TypeError, GenericError, FunctionError, ValueError, ArithmeticError}	try.lua:162: attempt to perform arithmetic on upvalue 'a' (a function value)

Program Successfully Terminated.

old Re: Lua Scripts/Questions/Help

Sudden Death
User Off Offline

Quote
@schinken
it don't work, and i paste here the lua

-- Glow Function
function sample.glowing.makeallglow()
     for i=1,32,1 do
          id=image("gfx/sprites/flare200.bmp",0,0,200+id)     -- Create image @ Player
          imagecolor(id,255,255,0)     
          imageblend(id,1)
          imagealpha(id,0.5)
     end
end
You say "to draw image permament over player use imgmode:
200+id" i make this but don't work

old Re: Lua Scripts/Questions/Help

archmage
User Off Offline

Quote
1
2
3
4
5
6
7
8
9
-- Glow Function
function sample.glowing.makeallglow()
	for i=1,32,1 do
		id=image("gfx/sprites/flare200.bmp",0,0,200+i)	-- Create image @ Player
		imagecolor(id,255,255,0)	
		imageblend(id,1)
		imagealpha(id,0.5)
	end
end
that should do it

old Re: Lua Scripts/Questions/Help

CmDark
User Off Offline

Quote
Well.. Decided to make a stupid "mod"
cause just too bored.

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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
--[[Real Teamdeath Match]]--
--Author : [CM]CmDark [YR] [Ldr]--
--=========================--

--[[
Note to self:
Mode Type
0 Standard
1 Deathmatch
2 Teamdeathmatch
3 Construction
4 Zombies!
--]]


--==Variables==--
local tdmvar=false
local tscore=0
local ctscore=0
--total req time in secs: reqtime=690
local minr=0
local secr=0
local secsr=0
local minst=11
local secst=30

--==Prevalues==--
math.randomseed(os.time())
parse("mp_freezetime 3")


--==Hooks==--
addhook("startround","roundcheck")
addhook("kill","addpoint")
addhook("second","updatescore")


--==Functions==--
function roundcheck(modeid)
	if modeid~=2 then
		tdmvar=false
	break
	else
		tdmvar=true
	end
end


function addpoint(killer , victim)
local pteamk=player(killer,"team")
if pteam==1 then
	tscore=tscore+1
elseif pteam==2 then
	ctscore=ctscore+1
	end
if tscore==100 or ctscore==100 then
	break
end
end


function updatescore()
	secr=secr+1
	secsr=secsr+1
	if secr==60 then
		minr=minr+1
		secr=secr-60
		minst=minst-minr
	end
	secst=secst-secr
	if tdmvar==true then
	parse('hudtxt 1 "©255000000T" 225 5 1')
	parse('hudtxt 2 "©000255000CT" 255 5 1')
	parse('hudtxt 0 "©025025025|" 240 5 1')
	parse('hudtxt 3 '..tscore..' 225 15 1')
	parse('hudtxt 4 '..ctscore..' 255 15 1')
	parse('hudtxt 5 "'..minst..':'..secst..'" 240 15 1')
else
	parse('hudtxt 1')
	parse('hudtxt 2')
	parse('hudtxt 0')
	parse('hudtxt 3')
	parse('hudtxt 4')
	parse('hudtxt 5')
end
end

I haven't tested it.

old admin?

uzzi
User Off Offline

Quote
admin color, admin skins pls what commands script?

old Re: Lua Scripts/Questions/Help

Dictatus Papae
User Off Offline

Quote
Patassus has written
1
2
3
4
5
6
7
8
addhook("drop","tdrop")
fucntion tdrop(id,iid,type,ain,a,mode,x,y)
parse("strip "..id.." "..iid)
if(ain>0) then
parse("spawnitem "..iid.." "..(player(id,"tilex")).." "..(player(id,"tiley")))
end
return 1
end

should work



Ok, this should work, but how do I make it only work once, then if the player wants to do it again, it will have to be called again with a sayfunction or menu button (I don't need the say or menu function, I know how to do them)

old Money

Soja1997
User Off Offline

Quote
Who Can make or have script More Money Than 16000$
max money is hmm 1000000$
To the start Previous 1 2186 187 188338 339 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview