Forum

> > CS2D > Scripts > !get !to
ForenübersichtCS2D-Übersicht Scripts-ÜbersichtEinloggen, um zu antworten

Englisch !get !to

18 Antworten
Zum Anfang Vorherige 1 Nächste Zum Anfang

alt !get !to

wato24
User Off Offline

Zitieren
can any body give me
!get !to script
and heal 1 hp per second script if you can thx you

alt Re: !get !to

Alistaire
User Off Offline

Zitieren
Wtf is a !get !to script.

----

1
2
3
4
5
6
7
8
9
addhook('second', 'AA_second')

function AA_second()
	for i = 1, 32 do
		if player(i, 'health') < player(i, 'maxhealth') then
			parse('sethealth '..i..' '..player(i, 'health') + 1)
		end
	end
end

alt Re: !get !to

Yates
Reviewer Off Offline

Zitieren
He means if he says !get [id] then the id of the players gets teleported to him. !to [id] will teleport you to that id.

alt Re: !get !to

Alistaire
User Off Offline

Zitieren
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
addhook('say', 'AA_say')

function AA_say(id, txt)
	if txt:sub(1) == '!' then
		if txt:sub(1, 4) == '!get' then
			if player(txt:sub(6, 7), 'exists') then
				parse('setpos '..txt:sub(6, 7)..' '..player(id, 'x')..' '..player(id, 'y'))
				(id, '©000150050'..player(id, 'name')..' teleported you to '..player(id, 6), 'x')..', '..player(id, 'y'))
			end
		elseif txt:sub(1, 3) == '!to' then
			if player(txt:sub(5, 6), 'exists') then
				parse('setpos '..id..' '..player(txt:sub(5, 6), 'x')..' '..player(txt:sub(5, 6), 'y'))
				msg2(id, '©000150050You were teleported to '..player(txt:sub(5, 6), 'x')..', '..player(txt:sub(5, 6), 'y'))
			end
		else
			msg2(id, '©255000000ERROR: There is no such command')
		end
	return 1;
	end
end
2× editiert, zuletzt 28.06.12 17:50:21

alt Re: !get !to

wato24
User Off Offline

Zitieren
please, you can put (msg2 "have been bringed from ..(playername)
and you went to playername

anddddddddd not work:
LUA ERROR: sys/lua/server.lua:435: <name> or '...' expected near '1'

alt Re: !get !to

omg
User Off Offline

Zitieren
user Alistaire hat geschrieben
1
2
3
4
5
6
7
8
9
addhook('second', 'AA_second')

function AA_second()
	for _,id in ipairs(player(0,"tableliving")) do
		if player(id,"health")~=player(id,"maxhealth") then
			parse("sethealth "..id.." "..(player(id,"health")+1))--if u dont contain the +1 in parentheses with the player(id,"health"), it will give an error
		end
	end
end


user Alistaire hat geschrieben
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
addhook('say', 'AA_say')--wow, dropped a comma

function AA_say(id, txt)
	if txt:sub(1,1) == '!' then
		if txt:sub(2, 4) == 'get' then
			if player(tonumber(txt:sub(6)), 'exists') then--the id is a number parameter, not a string parameter. duh
				parse('setpos '..tonumber(txt:sub(6))..' '..player(id, 'x')..' '..player(id, 'y'))
			end
		elseif txt:sub(2, 3) == 'to' then
			if player(tonumber(txt:sub(5)), 'exists') then
				parse('setpos '..id..' '..player(tonumber(txt:sub(5)), 'x')..' '..player(tonumber(txt:sub(5)), 'y'))
			end
		end
	return 1;
	end
end
2× editiert, zuletzt 28.06.12 17:42:20

alt Re: !get !to

wato24
User Off Offline

Zitieren
LUA ERROR: sys/lua/server.lua:446: ')' expected near ''AA_say''

alt Re: !get !to

Alistaire
User Off Offline

Zitieren
user wato24 hat geschrieben
LUA ERROR: sys/lua/server.lua:446: ')' expected near ''AA_say''


Forgot 1 comma. Retry.

----

user omg hat geschrieben
1
2
3
4
5
6
7
8
9
addhook('second', 'AA_second')

function AA_second()
	for _,id in ipairs(player(0,"tableliving")) do
		if player(id,"health")~=player(id,"maxhealth") then
			parse("sethealth "..id.." "..(player(id,"health")+1))
		end
	end
end


Why replace all the apastrophes with quotation marks. Also why the fuck delete all spaces between parameters. It just makes it look ugly.

Btw, for i = 1, 32 works just fine. If the player doesn't exist, it just skips the comparison between health and maxhealth.

Same for player id health < maxhealth.

Also, you don't have to put player(id, 'health') between brackets again.
1× editiert, zuletzt 28.06.12 17:47:16

alt Re: !get !to

MikuAuahDark
User Off Offline

Zitieren
user Alistaire heal script is error better using this one:
1
2
3
4
5
6
addhook("second","healsecond")
function healsecond()
	for _, id in pairs(player(0,"table")) do
		parse("sethealth "..id.." "..player(id,"health")+1)
	end
end

the !get and !to command
1
2
3
4
5
6
7
8
9
10
11
12
13
14
addhook("say","getto")
function getto(id,txt)
	if txt:lower(txt:sub(1,4))=="!get" then
		if player(tonumber(txt:sub(6)),"exists") then
			parse("setpos "..pl.." "..player(id,"x").." "..player(id,"y"))
			msg2(id,string.char(169).."000255000you have been bring "..player(pl,"name"))
		end
	elseif txt:lower(txt:sub(1,3))=="!to" then
		if player(tonumber(txt:sub(5)),"exists") then
			parse("setpos "..id.." "..player(pl,"x").." "..player(pl,"y"))
			msg2(id,string.char(169).."000255000you go to "..player(pl,"name"))
		end
	end
end

alt Re: !get !to

omg
User Off Offline

Zitieren
rian, ur heal script is just as faulty as alistaires. u need to look thru player(0,"tableliving"). its shorter, faster, and avoids extra lines

use rians say script
user Alistaire hat geschrieben
Also, you don't have to put player(id, 'health') between brackets again.

i didnt use any brackets

alt Re: !get !to

Alistaire
User Off Offline

Zitieren
user omg hat geschrieben
i didnt use any brackets


user omg hat geschrieben
1
parse("sethealth "..id.." "..(player(id,"health")+1))


user omg hat geschrieben
1
(player(id,"health")+1)


Lie some more.

alt Re: !get !to

omg
User Off Offline

Zitieren
im pretty sure u do. i get errors when i dont add them in my scripts

also, these are brackets: []

alt Re: !get !to

Alistaire
User Off Offline

Zitieren
user omg hat geschrieben
im pretty sure u do. i get errors when i dont add them in my scripts

also, these are brackets: []


Wikipedia hat geschrieben
( ) — round brackets, open brackets, close brackets (UK), or parentheses


Your argument is invalid.

alt Re: !get !to

wato24
User Off Offline

Zitieren
i want to put only for admin and vips but idk how >_<
adminlist = {USGNS,15410,37289}
viplist = (USGN)


function checkadmin(id)
     for a = 1,#adminlist do
          if player(id,"usgn") == adminlist[a] then
               return true
          end
     end
     return false
end

function checkvip(id)
     for a = 2,#viplist do
          if player(id,"usgn") == viplist[a] then
               return true
          end
     end
     return false
end

this is my function to admin and vip, i think it no work U.u
-LUA ERROR: sys/lua/server.lua:337: bad argument #1 to 'player' (number expected, got nil)
-LUA ERROR: sys/lua/server.lua:427: attempt to get length of global 'viplist' (a nil value)

alt Re: !get !to

Cure Pikachu
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
adminlist = {15410,37289}
viplist = {71204} -- 71204 is just an example


function checkadmin(id)
	for _, a in ipairs(adminlist) do
		if player(id,"usgn") == a then
			return true
		end
	end
	return false
end

function checkvip(id)
	for _, b in ipairs(viplist) do
		if player(id,"usgn") == b then
			return true
		end
	end
	return false
end

alt Re: !get !to

omg
User Off Offline

Zitieren
add this to a say function:
1
2
3
if txt:sub(1,8)=="!makevip" then
	viplist.insert(player(tonumber(txt:sub(10)),"usgn"))
end
i dont believe this will permanently make them a vip, but they will be a vip until the map gets changed/server shutdown

eventually u would have to manually add their usgn into the vip list
1× editiert, zuletzt 28.06.12 22:39:31

alt Re: !get !to

Alistaire
User Off Offline

Zitieren
Also, it's better to use better string splitter functions for such important things.
Zum Anfang Vorherige 1 Nächste Zum Anfang
Einloggen, um zu antworten Scripts-ÜbersichtCS2D-ÜbersichtForenübersicht