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 2211 212 213338 339 Next To the start

old Re: Lua Scripts/Questions/Help

archmage
User Off Offline

Quote
Is that all your script? If not post it.
The problem is that the variable id is nil.
1
parse("flashplayer "..id.." 50") -- ERROR- id has not been initialized

1
2
id = 1 -- id has been initialized
parse("flashplayer "..id.." 50") -- no error

old Re: Lua Scripts/Questions/Help

KenVo
User Off Offline

Quote
i'm trying to make a car locking system using weiwen car script but i don't know how to make it sorry, i'm noob at scripting

Here is my script
Spoiler >


Here's the weiwen's script:
Spoiler >

old Lua

Snake_Eater
User Off Offline

Quote
Hi all! I want if I shoot somebody with deagle that this player teleports AND SPAWN again and again at a special place.For example at x=2160 y=784.
CAN ANYBODY SHOW ME A SCRIPT LIKE THIS??

old Re: Lua Scripts/Questions/Help

KINGGOLDrus
User Off Offline

Quote
Dark Byte,
1
2
3
4
5
6
7
8
9
10
11
12
addhook("spawn","spw")
function spw(id)
	if (pl_loaded[id]==0) then
		mes(id,1)
	else
		parse('sv_sound2 '..id..' rpg/sounds/other/respawn.wav')
		parse('setpos '..id..' '..pl_savedx[id]..' '..pl_savedy[id])
		parse('speedmod '..id..' '..rpg_speedmod[pl_sk[id][2]])
		resetallhud(id)
	end
	parse('flashplayer '..id..' 50')
end
flashing doesn't work

old Re: Lua Scripts/Questions/Help

DRoNe
User Off Offline

Quote
1
2
3
4
5
for id = 1, 32 do
	if player(id,"exists") then
		parse("flashplayer "..id.." 50")
	end
end

maybe this
edited 2×, last 25.06.10 08:39:37 pm

old Re: Lua Scripts/Questions/Help

RyceR
User Off Offline

Quote
How to make walls in a random place at round start?
It dont work:
1
2
3
4
addhook("startround","wall")
function wall()
	parse("spawnobject "..math.random(3,5).." "..math.random(1,14).." "..math.random(154,164).." 0 1 0 0")
end

P.S: Map tiles: 15x15
P.S: Sorry for my bad english
edited 3×, last 25.06.10 10:22:44 pm

old Re: Lua Scripts/Questions/Help

archmage
User Off Offline

Quote
@DRoNe
The quotes won't matter, but you could also use this.
1
2
3
4
5
for id = 1, 32 do
     if player(id,[[exists]]) then
          parse([[flashplayer ]]..id..[[ 50]])
     end
end
But I do not ever use those as they can be confusing.

@KINGGOLDrus
See if there are any errors in the console.
btw what is mes(id,1)?

Edit
I need your full script otherwise I will keep getting an error. If that is your whole script then I know the problem.

old Re: Lua Scripts/Questions/Help

DRoNe
User Off Offline

Quote
@MSek
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
addhook("startround","wall")
function wall()
local wall1 = math.random(0,10)
local wall2 = math.random(0,10)
local wall3 = math.random(0,10)
x = math.random(1, map("xsize")) -- or if tiles 15x15, x = math.random(1,15)
y = math.random(1, map("ysize")) -- here too
	for id = 1, wall1 do
		parse("spawnobject 3 " "..x.." "..y)
	end
	for id = 1, wall2 do
		parse("spawnobject 4 " "..x.." "..y)
	end
	for id = 1, wall3 do
		parse("spawnobject 5 " "..x.." "..y)
	end 
end

try this, i not tested it. maybe it should work.

old Re: Lua Scripts/Questions/Help

BrunoRZ
User Off Offline

Quote
I need a lua script.
I want a simple lua, just like in editor we have "trigger_start".
Cuz I need this trigger only to my server, and people that try use my map will fail.

kind of trigger start "seckey" <-- thats what I need
(prefer using lua instead of putting it in map)
THX

old Re: Lua Scripts/Questions/Help

archmage
User Off Offline

Quote
@BrunoRZ
1
2
3
4
5
addhook("startround", "sr")
trigger = "" -- what to trigger
function sr ()
	parse("trigger " .. trigger)
end
just replace trigger = ""
with
trigger = "<what to trigger>"

old Re: Lua Scripts/Questions/Help

YellowBanana
BANNED Off Offline

Quote
vesa-omar has written
Ok, Im trying to do when you throw an Smoke it freeze's the one's it hit.

But i cant get it to work


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
--Weapons--
addhook("projectile","hnsteam_smokecus")
function hnsteam_smokecus(id,weapon,x,y)
  if (weapon==53) then
     		parse('effect "colorsmoke" ' ..x.. ' ' ..y.. ' 140 96 0 0 128')
     		parse('effect "colorsmoke" ' ..x.. ' ' ..y.. ' 140 96 0 0 128')
		return 1
	end
end

addhook("hit","hnsteam_smokefreeze")
function hnsteam_freeze(target,weapon)
  if (weapon==53) then
		parse("speedmod "..target.." -100")
		return 1
	end
end


hit function will never be called when u hit with a smoke grenade, that's what projectile hook is for. So check in the projectile hook for every player if he's close to the grenade.

old Re: Lua Scripts/Questions/Help

Snake_Eater
User Off Offline

Quote
Hi all! I want if I shoot somebody with deagle that this player teleports AND SPAWN again and again at a special place.For example at x=2160 y=784.
CAN ANYBODY SHOW ME A SCRIPT LIKE THIS PLS PLS??
I am repeating me but there is no good answer
To the start Previous 1 2211 212 213338 339 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview