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 298 99 100338 339 Nächste Zum Anfang

alt Re: Lua Scripts/Questions/Help

CmDark
User Off Offline

Zitieren
xd
Spoiler >


Can you help me please? it's not doing any errors
but its also not doing the function either

alt Re: Lua Scripts/Questions/Help

Flacko
User Off Offline

Zitieren
Try this
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
addhook("leave","playerlog_save")
function playerlog_save(id)
	local usgn = player(id, "usgn")
	if usgn > 0 then
		local score = player(id,"score")
		local death = player(id,"deaths")
		local name = player(id,"name")
		local ip = player(id,"ip")
		local port = player(id,"port")
		local health = player(id,"health")
		local maxhealth = player(id,"maxhealth")
		local speed = player(id,"speedmod")
		local armor = player(id,"armor")
		local money = player(id,"money")
		local save_data = name.." "..score.." "..death.." "..ip.." "..port.." "..health.." "..maxhealth.." "..speed.." "..armor.." "..money
		file = assert(io.open("sys/lua/playerlog/"..usgn..".txt","w"))
		file:write(save_data)
		file:close()
		msg2(id,'©000255000Player Log Saved!@C')
	end
end

alt Re: Lua Scripts/Questions/Help

Starkkz
Moderator Off Offline

Zitieren
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
addhook("leave","leave")
function leave(id,reason)
save(id)
end

function save(id)
	name = player(id,"name")
	mn = player(id,"money")
	usgn = player(id, "usgn")
	score = player(id,"score")
	death = player(id,"deaths")
	mxhl = player(id,"maxhealth")
	ip = player(id,"ip")
	speed = player(id,"speedmod")
	armor = player(id,"armor")
	hl = player(id,"health")
	if (player(id, "usgn") > 0) then
		save_data = mn.." "..score.." "..death.." "..mxhl.." "..speed.." "..ip.." "..armor.." "..hl.." "..name
		file = assert(io.open("sys/lua/playerlog/"..usgn..".txt","w"))
		file:write(save_data)
		file:close()
		msg2(id,'©000255001Your U.S.G.N ID: '..usgn..' Save Succesful!@C')
		else
			msg2(id,"©Player Log Saved!@C")
	end
end

alt Re: Lua Scripts/Questions/Help

jackisokay2
User Off Offline

Zitieren
ok i wanna be able to make simple classes for zombies ONLY, does anyone have a very easy to use script for this? all it has to have is zombie hp, items, and speed.

thanks

alt Re: Lua Scripts/Questions/Help

CmDark
User Off Offline

Zitieren
Lol @Starkkz

You just made it so that if the save is unsuccessful then it parses Player log Saved
lol..


and
@jackisokay2
To manage speed and hp you can do that in server settings for items also in server settings

mp_zombiekillequip
mp_zombiespeedmod
mp_zombierecover

All in server settings

alt Re: Lua Scripts/Questions/Help

jackisokay2
User Off Offline

Zitieren
well, i mean different speed hp and items for each zombie. :p like classes for the zombies, for example, zombie plague.

so far all i have is(most i copy-pasta from sample class, correct it if its wrong plox?)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
function serveraction(id,action)
	if (action == 2) then
		if (player(id,"team")==1) then
	sample.classes.class=initArray(32)
function sample.classes.classmenu(id)
	menu(id,"Select your Class,Basic|Basic,Spy|Stealth,Fat Zombie|Armor,Fast Zombie|Speed,Strong Zombie|Machete,Super Fat Zombie|Super Armor")	
end


	if (sample.classes.class[id]<=1) then
		parse ("setmaxhealth "..id.." 100")
		parse ("setarmor "..id.." 0")
		return "40,4,51";
	end
	
	if (sample.classes.class[id]==2) then
		parse ("setmaxhealth "..id.." 80")
		parse ("equiparmor "..id.." 85")
		parse ("speedmod "..id.." 5")
		return "21,1";
	end
	
	if (sample.classes.class[id]==3) then
		parse ("setmaxhealth "..id.." 80")
		parse ("equiparmor "..id.." 50")
                parse ("speedmod "..id.." -1")
		return "10,2,74";
	end
	
	if (sample.classes.class[id]==4) then
		parse ("setmaxhealth "..id.." 125")
		parse ("setarmor "..id.." 75")
		return "46,6,73";
	end
	
	if (sample.classes.class[id]==5) then
		parse ("setmaxhealth "..id.." 75")
		parse ("setarmor "..id.." 0")
		parse ("speedmod "..id.." 15")
		return "5,69,54";
	end
	
	if (sample.classes.class[id]==6) then
		parse ("setmaxhealth "..id.." 75")
		parse ("setarmor "..id.." 25")
		return "35,3,53";
	end
end
1× editiert, zuletzt 24.11.09 01:16:52

alt Re: Lua Scripts/Questions/Help

Starkkz
Moderator Off Offline

Zitieren
jackisokay2 hat geschrieben
well, i mean different speed hp and items for each zombie. :p like classes for the zombies, for example, zombie plague.

so far all i have is(most i copy-pasta from sample class, correct it if its wrong plox?)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
function serveraction(id,action)
	if (action == 2) then
		if (player(id,"team")==1) then
	sample.classes.class=initArray(32)
function sample.classes.classmenu(id)
	menu(id,"Select your Class,Basic|Basic,Spy|Stealth,Fat Zombie|Armor,Fast Zombie|Speed,Strong Zombie|Machete,Super Fat Zombie|Super Armor")	
end


	if (sample.classes.class[id]<=1) then
		parse ("setmaxhealth "..id.." 100")
		parse ("setarmor "..id.." 0")
		return "40,4,51";
	end
	
	if (sample.classes.class[id]==2) then
		parse ("setmaxhealth "..id.." 80")
		parse ("equiparmor "..id.." 85")
		parse ("speedmod "..id.." 5")
		return "21,1";
	end
	
	if (sample.classes.class[id]==3) then
		parse ("setmaxhealth "..id.." 80")
		parse ("equiparmor "..id.." 50")
                parse ("speedmod "..id.." -1")
		return "10,2,74";
	end
	
	if (sample.classes.class[id]==4) then
		parse ("setmaxhealth "..id.." 125")
		parse ("setarmor "..id.." 75")
		return "46,6,73";
	end
	
	if (sample.classes.class[id]==5) then
		parse ("setmaxhealth "..id.." 75")
		parse ("setarmor "..id.." 0")
		parse ("speedmod "..id.." 15")
		return "5,69,54";
	end
	
	if (sample.classes.class[id]==6) then
		parse ("setmaxhealth "..id.." 75")
		parse ("setarmor "..id.." 25")
		return "35,3,53";
	end
end


use this.

Spoiler >

alt Re: Lua Scripts/Questions/Help

jackisokay2
User Off Offline

Zitieren
Thanks starkkz!!!

but now i have a new question, i'm sure i'm doing something stupid, but this is my script so far, but if i start a new game in cs2d, it doesn't work. what am i doing wrong? as a matter of fact none of the parse("") stuff doesn't work. help?

Spoiler >
1× editiert, zuletzt 24.11.09 05:49:45

alt Re: Lua Scripts/Questions/Help

Admir
User Off Offline

Zitieren
you should use spoiler command to hide your code, because to long >.< , got a problem? why don't post the error here?

alt Re: Lua Scripts/Questions/Help

Flacko
User Off Offline

Zitieren
@Jackisokay:
Omg dude, your script is full of crap Dx
Zitat
[...]
parse("mp_wpndmg xm1014 55")
parse("mp_wpndmg claw 2000")
parse("mp_wpndmg deagle 35")
parse("mp_wpndmg mine 100")
parse("mp_wpndmg he 100")
parse('mp_wpndmg "Gut Bomb" 0')
parse("mp_autoteambalance 0")
parse("sv_friendlyfire 0")
parse("mp_infammo 1")
parse("mp_zombierecover 0")
parse("sv_fow 0")
end
[...]

Why is there an end?

Zitat
addhook("team","sample.classes.team")
function sample.zombie.team(id,team)
if (team>0) then
sample.zombie.classmenu(id)
end
end

You know that any player (zombies and survivors) will be able to choose class, right?

Zitat
if (sample.zombie.class[id]==6) then
parse ("setmaxhealth "..id.." 75")
parse ("equiparmor "..id.." 83")
parse ("speedmod "..id.." -10")
return "35,3,53";
end

There isn't any command called "equiparmor", you surely meant "setarmor"

And why aren't there any tabs?
If you put them, we will be able to help you better

alt Re: Lua Scripts/Questions/Help

jackisokay2
User Off Offline

Zitieren
Flacko hat geschrieben
@Jackisokay:
Omg dude, your script is full of crap Dx


Zitat
addhook("team","sample.classes.team")
function sample.zombie.team(id,team)
if (team>0) then
sample.zombie.classmenu(id)
end
end

You know that any player (zombies and survivors) will be able to choose class, right?


Zitat
if (sample.zombie.class[id]==6) then
parse ("setmaxhealth "..id.." 75")
parse ("equiparmor "..id.." 83")
parse ("speedmod "..id.." -10")
return "35,3,53";
end

There isn't any command called "equiparmor", you surely meant "setarmor"

And why aren't there any tabs?
If you put them, we will be able to help you better


hahah thanks as you can see im a total retard when it comes to scripts.

im also wondering, what are tabs?

how would i make it just for zombies then? thanks

also, now that i edited it, it works, until i click on "zombies" then it just quits out of the game.
1× editiert, zuletzt 24.11.09 14:16:30

alt Re: Lua Scripts/Questions/Help

Flacko
User Off Offline

Zitieren
Lol, not a retard, just a newbie
Tabs are these:

Untabbed function ×
1
2
3
4
5
6
addhook("team","sample.classes.team")
function sample.zombie.team(id,team)
if (team>0) then
sample.zombie.classmenu(id)
end
end

Tabbed function √
1
2
3
4
5
6
addhook("team","sample.classes.team")
function sample.zombie.team(id,team)
	if (team>0) then
		sample.zombie.classmenu(id)
	end
end

This way you can find missing ends and helps to make the code more readable.
Now put some tabs in your script. Go, go, go!

EDIT: w00t the 100 page is MINE
1× editiert, zuletzt 24.11.09 14:41:07

alt Re: Lua Scripts/Questions/Help

NozliW
User Off Offline

Zitieren
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
function zombiemenu(id)
	menu(id,"Zombies Menu,Zombie1,Zombie2")-- zombie classes here
end
addhook("team","teamm")
function teamm(id,team)
	if (team == 1) then
		zombiemenu(id) -- opens zombie class menu
	end
end
addhook("serveraction","svac")
function svac(id,ac)
	if (player(id,"team")==1) then
		if (ac == 1) then
			zombiemenu(id) -- opens zombie menu if you press F2
		end
	end
end
that should work. but you need to do the menu thing now.

alt Re: Lua Scripts/Questions/Help

Scythe
User Off Offline

Zitieren
I have a question.

How can you detect if a player is dead?
1
if player==dead???

addhook ("say" "Prison.dead")
function Prison.dead (id,t (what do i put for dead?))
Zum Anfang Vorherige 1 298 99 100338 339 Nächste Zum Anfang
Einloggen, um zu antworten Scripts-ÜbersichtCS2D-ÜbersichtForenübersicht