Forum

> > CS2D > Scripts > Spawn Item
ForenübersichtCS2D-Übersicht Scripts-ÜbersichtEinloggen, um zu antworten

Englisch Spawn Item

3 Antworten
Zum Anfang Vorherige 1 Nächste Zum Anfang

alt Spawn Item

KhaledMaher
BANNED Off Offline

Zitieren
Well i know this easy for some guys
but i am new and you can say i am noob scripting too

i want to know how to make item spawn on the mouse position

√ Thanks for help

alt Re: Spawn Item

Masea
Super 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
item_id = 1 --item id here. (example: 1 = usp)

positions = {}

addhook("join","_join")
function _join(id)
	positions[id] = {x = 0, y = 0}
end

addhook("clientdata","_cd")
function _cd(id,m,x,y)
	if m == 2 then
		positions[id].x, positions[id].y = x, y
	end
end

function spawn_item_mouse(id)
	reqcld(id,2)
	local x, y = math.floor(positions[id].x/32), math.floor(positions[id].y/32)
	parse("spawnitem "..item_id.." "..x.." "..y)
end
You didn't tell us when that item spawn. So I've made only the function for now. Use it wherever you want.
1× editiert, zuletzt 12.01.17 19:43:09

alt Re: Spawn Item

GeoB99
Moderator Off Offline

Zitieren
@user Masea: Your code will bug at 13 line cause of unexpected
,
before
positions[id].y
table.
Zum Anfang Vorherige 1 Nächste Zum Anfang
Einloggen, um zu antworten Scripts-ÜbersichtCS2D-ÜbersichtForenübersicht