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 2171 172 173338 339 Nächste Zum Anfang

alt Re: Lua Scripts/Questions/Help

Sleepin
User Off Offline

Zitieren
well,this will be hard(for me) since i'm a "novice" lua scripter,can't help you much but it has to be something like
ms100() updating it.

alt Re: Lua Scripts/Questions/Help

Yorty
User Off Offline

Zitieren
Argh, this is a simple thing I've never been able to overcome. I can't seem to find a way to save "variables".
E.G.:

1
2
3
4
addhook("join","rp.join") 
function join(id) 
     rp.job[id]=1
end

1
2
3
4
5
6
7
8
9
function jobhud(id)
local i = 1,32 do
	if(player(i,"exists")) then
	jobn = rp.job[id]
		[b]hudtxt(i,2,'255255255','Job: '..jobn,5,420)
[/b] (Intentional)
	end
end
end
Won't work. This is incredibly stupid, but seriously...

alt Re: Lua Scripts/Questions/Help

Admir
User Off Offline

Zitieren
Spoiler >


1
jobn = rp.job[[b]id[/b]]

"id"? no "i"?

alt Re: Lua Scripts/Questions/Help

Yorty
User Off Offline

Zitieren
Flacko hat geschrieben
Did you actually initiate your table?
rp.job = {}
or
rp.job = initArray(32)
Oy, did that for my money table but forgot it for my Job one. Thanks.
Edit: Still doesn't want to work.
Double edit: Some fooling, got it to work.
2× editiert, zuletzt 07.03.10 03:15:29

alt Re: Lua Scripts/Questions/Help

DRoNe
User Off Offline

Zitieren
1
2
3
4
5
- itemtype(type,"value")	Return a value of an item type:
				name, dmg, dmz_z1, dmg_z2,
				rate, reload, ammo, ammoin,
				price, range, dispersion,
				slot, recoil

How i can work with it? Can someone write sample for me?

alt Re: Lua Scripts/Questions/Help

SQ
Moderator Off Offline

Zitieren
1.
1
print(itemtype(1,"name")) --> USP
2.
1
2
3
for i = 1, 88, 1 do
	print(itemtype(i,"name"))
end

alt Re: Lua Scripts/Questions/Help

Flacko
User Off Offline

Zitieren
1
2
3
4
5
6
7
8
9
10
11
12
13
14
dofile("sys/lua/wrapper.lua")

function msg2(id,msg)
	parse("sv_msg2 "..id.." \""..msg.."\"")

addhook("buy","_buy_")
function _buy_(id,iid)
	msg2("Congratulations!")
	msg2("You have successfully bought a: "..itemtype(iid,"name"))
	msg2("This weapons features a "..itemtype(iid,"damage").."Hp Damage")
	msg2("A rate of fire of "..itemtype(iid,"rate").." RPM")
	msg2("And a dispersion of "..itemtype(iid,"dispersion"))
	msg2("Please come back soon ^^")
end

alt Re: Lua Scripts/Questions/Help

DRoNe
User Off Offline

Zitieren
I was thinking i'll can create my custom weapon
omg ... So, i can't do my custom weapon?

like custom dmg,rate,ammo,range ...
1× editiert, zuletzt 07.03.10 20:44:00

alt Re: Lua Scripts/Questions/Help

SQ
Moderator Off Offline

Zitieren
You can't just add weapon so simply.

There are few ways to make own weapons, bullets, ect...
But it's not so simple as you thought.

alt Re: Lua Scripts/Questions/Help

SQ
Moderator Off Offline

Zitieren
Yeah, otherwise I wouldn't say that.

I'm making tutorial for this stuff.
Or maybe I will post it sooner.

alt Re: Lua Scripts/Questions/Help

Yorty
User Off Offline

Zitieren
Blazzingxx hat geschrieben
Yeah, otherwise I wouldn't say that.

I'm making tutorial for this stuff.
Or maybe I will post it sooner.

Oho. Im listening.

alt Re: Lua Scripts/Questions/Help

SQ
Moderator Off Offline

Zitieren
Try join there:
Classic SuperHero 82.135.231.192:36970

I'm going to be there for 10 mins, so I can show high leveled heroes with objects...

alt Table value?

Fasttt
User Off Offline

Zitieren
1
2
3
4
5
6
primary_weapons = {10,11,20,21,22,23,24}

addhook('minute','dm_minute')
function dm_minute()
msg('Primary Weapons is: '..primary_weapons)
end

LUA ERROR: Attempt to call a table value

/// is it possible to fix it?

alt Re: Lua Scripts/Questions/Help

SQ
Moderator Off Offline

Zitieren
1
2
3
4
5
6
7
8
9
10
primary_weapons = {10,11,20,21,22,23,24}

addhook('minute','dm_minute')
function dm_minute()
	local weapons = ''
	for i = 1 , #primary_weapons, 1 do
		weapons = weapons..primary_weapons[i]..' '
	end
	msg('Primary Weapons is: '..weapons)
end
Zum Anfang Vorherige 1 2171 172 173338 339 Nächste Zum Anfang
Einloggen, um zu antworten Scripts-ÜbersichtCS2D-ÜbersichtForenübersicht