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 271 72 73338 339 Nächste Zum Anfang

alt Re: Lua Scripts/Questions/Help

CmDark
User Off Offline

Zitieren
@ someone

could you help me with this?

1
2
3
4
5
6
7
8
9
10
11
12
13
14
addhook("move","gm.o.move")
function gm.o.move(id,walk)

tid = player(id,"team")


    if (walk==1 and tid==1) then
    parse("setarmor "..id.." 206")
    else
    if (walk==0 and tid==1) then
    parse("setarmor "..id.." 0")
    end
 end
 end

alt hi to all i need help with an mod

Starkkz
Moderator Off Offline

Zitieren
i to all i need help with an mod

BF2D
how i can make an menu,
this not works good

Zitat
addhook("spawn","sid")
function sid(id)
menu(id,"Select Class,Medic,Super")
end

addhook("menu","selection")
function selection(id,men,sele)
menu(id,"Select Class,Medic,Super")
if (sele=="1") then
parse("killplayer "..i.."")
parse("spawn "..i.."")
parse("equip "..i.." 82")
parse("equip "..i.." 78")
parse("equip "..i.." 20")
parse("setmaxhealth "..i.." 138")
if (sele=="2") then
parse("killplayer "..i)
parse("spawn "..i)
parse("equip "..i.." 83")
parse("equip "..i.." 45")
parse("speedmod "..i.." 100")
end
end
end

alt Re: Lua Scripts/Questions/Help

playa slaya
COMMUNITY BANNED Off Offline

Zitieren
CmDark hat geschrieben
@ someone

could you help me with this?

1
2
3
4
5
6
7
8
9
10
11
12
13
14
addhook("move","gm.o.move")
function gm.o.move(id,walk)

tid = player(id,"team")


    if (walk==1 and tid==1) then
    parse("setarmor "..id.." 206")
    else
    if (walk==0 and tid==1) then
    parse("setarmor "..id.." 0")
    end
 end
 end

do you have function for walk? because im pretty sure walk is not a whatever

alt Re: Lua Scripts/Questions/Help

CmDark
User Off Offline

Zitieren
playa slaya hat geschrieben
CmDark hat geschrieben
@ someone

could you help me with this?

1
2
3
4
5
6
7
8
9
10
11
12
13
14
addhook("move","gm.o.move")
function gm.o.move(id,walk)

tid = player(id,"team")


    if (walk==1 and tid==1) then
    parse("setarmor "..id.." 206")
    else
    if (walk==0 and tid==1) then
    parse("setarmor "..id.." 0")
    end
 end
 end

do you have function for walk? because im pretty sure walk is not a whatever


um could you say that in English please?

alt Re: Lua Scripts/Questions/Help

playa slaya
COMMUNITY BANNED Off Offline

Zitieren
does anyone think it is possible to have a no-clipping mode without hack that would be f---ing awesome

EDIT I:
(
If you do not know what "no-clipping" is then that is where you walk through walls and obstacles)

alt Re: Lua Scripts/Questions/Help

CmDark
User Off Offline

Zitieren
@playaslaya

that could be easily be done

even without lua

make a whole map with sprites(non walled)

or dynwalls with sprites

and trigger .. easy

alt Re: Lua Scripts/Questions/Help

CmDark
User Off Offline

Zitieren
well if not then it could be done with lua

but the map might need to be altered

so.. yeah until dc releases

a command like:

removetile <x> <y>

then pretty much impossible

edit:

oh and you need a spawntile <x> <y> <tileid>
too

alt Re: Lua Scripts/Questions/Help

BetaM
User Off Offline

Zitieren
Get ready for a brain storm:

Spoiler >


All of the values are good, but when the player changes the team it says:
"LUA ERROR: sys/lua/server.lua:1457: attempt to concatenate field '?' (a nil value)"
The 1457 line is the first long line in the spoiled script:
Spoiler >


So what is wrong?

(DO NOT COPY THIS SCRIPT TO YOUR ONE)
1× editiert, zuletzt 27.10.09 20:20:42

alt Re: Lua Scripts/Questions/Help

SQ
Moderator Off Offline

Zitieren
mat5b hat geschrieben
(DO NOT COPY THIS SCRIPT TO YOUR ONE)

LOL, look what's talking (I'm sure you not the guy who created U.S.G.N. saves)

You are sure it's that line?

You can use for command for that. But that values...
1
2
3
For i = 1,50
	   file:write(value[i]) -- there should be special values for it.
end

Anyway, it's mess with values and you should rescript your work.

alt Re: Lua Scripts/Questions/Help

Flacko
User Off Offline

Zitieren
Blazzingxx hat geschrieben
mat5b hat geschrieben
(DO NOT COPY THIS SCRIPT TO YOUR ONE)

LOL, look what's talking (I'm sure you not the guy who created U.S.G.N. saves)


Haha, he can't tell you to not copy his idea, ideas are free and can't be patented by any means, what you can patent is what you have done. Scripts for example. Not what you think, like a video game using blue bananas as protagonists fighting polar bears with light sabres.
Maybe he is talking about his script and not his idea?

mat5b hat geschrieben
Oh yea, sure. I just need to re-script 50 achievements. Veeery easy. (sarcasm)

Anyway, forget about this.


Programmers can write good code in all the program and have no problems with it.
Or they can write bad code in all a program and have to rewrite lots of his code because he forgot some simple thing.
But they rarely abandon the projects they have put a big effort in.

alt Re: Lua Scripts/Questions/Help

SQ
Moderator Off Offline

Zitieren
Flacko hat geschrieben
Spoiler >

Anyway, who would copy his "useful" script.
It's part of script which doesn't help at all.

Yes, you are actualy right about ideas.
Of course there is some cases then people buying ideas.

There is so much mods with my ideas and scripts...
I can't do anything, just say that add my credits.

alt Re: Lua Scripts/Questions/Help

Lee
Moderator Off Offline

Zitieren
Flacko hat geschrieben
Programmers can write good code in all the program and have no problems with it.
Or they can write bad code in all a program and have to rewrite lots of his code because he forgot some simple thing.
But they rarely abandon the projects they have put a big effort in.


Great point, I would also like to point out that testing is/should be encouraged during scripting.

And also, another point, common functions needs to be refactored so that you won't ever have the need to rescript everything due to minor changes.

alt no reloading...again

Toa Hero 92
User Off Offline

Zitieren
Hello I've made this script for my server

1
2
3
4
5
6
7
8
addhook("reload","noreloadtoa")
function noreloadtoa (id,mode)

	if (mode==1) then
	parse("equip "..id.." "..player(id,"weaponid").."")

end
end

But I got this error
ERROR: equip - item with type id 0 does not exist!


So then I made this script



1
2
3
4
5
6
7
8
9
10
11
addhook("reload","noreloadtoa")
function noreloadtoa (id,mode)

	if (mode==1) then
	if (player(id,"weaponid") == 0) then
	return 0
	else parse("equip "..id.." "..player(id,"weaponid").."")

end
end
end

This script doesn't work because it still reads my wepid as a 0 value.

What can i do to change that?
Or, am I approaching it completely wrong?

alt Re: Lua Scripts/Questions/Help

CmDark
User Off Offline

Zitieren
@Toa Hero 92

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
if noreload==nil then noreload={} end
noreload={}


addhook ("attack","noreload")
function noreload(id)

	for i=1,90 do
	
		wid = player(id,"weapontype")
		
		if (wid == i) then 
		parse ("equip "..id.." "..wid)
		end
	end
end

notice the i=1,90


EDIT: CAN SOMEONE HELP ME WITH THIS:

1
2
3
4
5
6
7
8
9
10
11
12
score = player(id,"score")
deaths = player(id,"deaths")
health = player(id,"health")

	parse ('hudtext 4 "©000235115Kills: "..score,113 425 2')
	parse ('hudtext 5 "©000255000Deaths: "..deaths,10 420 2')
	parse ('hudtext 6 "©255010003Health: "..health,10 425 2')

I'm tryin to make hud for my ghostmatch script
(not a edit of Kiffer-Opa's ghostmatch (custom version))

appreciate the help..

EDIT 2: (mainly i suck at lua)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
i need to make usgn save
that records the 

weapons and money
that the person has when he/she leaves

and loads when they come back

yeah.... i don't understand how to use the code to read the weapons and money T_T

-- Open File
io.open()
-- Close File
close()
-- Write File
write() 
-------------Edit 3= I got playa slaya to help------
even if you can't help me but can explain, please do so....
4× editiert, zuletzt 28.10.09 03:32:02
Zum Anfang Vorherige 1 271 72 73338 339 Nächste Zum Anfang
Einloggen, um zu antworten Scripts-ÜbersichtCS2D-ÜbersichtForenübersicht