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 2211 212 213338 339 Nächste Zum Anfang

alt Re: Lua Scripts/Questions/Help

archmage
User Off Offline

Zitieren
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

alt Re: Lua Scripts/Questions/Help

KenVo
User Off Offline

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

alt Lua

Snake_Eater
User Off Offline

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

alt Re: Lua Scripts/Questions/Help

KINGGOLDrus
User Off Offline

Zitieren
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

alt Re: Lua Scripts/Questions/Help

DRoNe
User Off Offline

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

maybe this
2× editiert, zuletzt 25.06.10 20:39:37

alt Re: Lua Scripts/Questions/Help

RyceR
User Off Offline

Zitieren
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
3× editiert, zuletzt 25.06.10 22:22:44

alt Re: Lua Scripts/Questions/Help

archmage
User Off Offline

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

alt Re: Lua Scripts/Questions/Help

DRoNe
User Off Offline

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

alt Re: Lua Scripts/Questions/Help

BrunoRZ
User Off Offline

Zitieren
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

alt Re: Lua Scripts/Questions/Help

archmage
User Off Offline

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

alt Re: Lua Scripts/Questions/Help

YellowBanana
BANNED Off Offline

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

alt Re: Lua Scripts/Questions/Help

Snake_Eater
User Off Offline

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