Forum

> > CS2D > Scripts > !get !to
Forums overviewCS2D overview Scripts overviewLog in to reply

English !get !to

18 replies
To the start Previous 1 Next To the start

old !get !to

wato24
User Off Offline

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

old Re: !get !to

Alistaire
User Off Offline

Quote
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

old Re: !get !to

Yates
Reviewer Off Offline

Quote
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.

old Re: !get !to

Alistaire
User Off Offline

Quote
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
edited 2×, last 28.06.12 05:50:21 pm

old Re: !get !to

wato24
User Off Offline

Quote
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'

old Re: !get !to

omg
User Off Offline

Quote
user Alistaire has written
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 has written
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
edited 2×, last 28.06.12 05:42:20 pm

old Re: !get !to

wato24
User Off Offline

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

old Re: !get !to

Alistaire
User Off Offline

Quote
user wato24 has written
LUA ERROR: sys/lua/server.lua:446: ')' expected near ''AA_say''


Forgot 1 comma. Retry.

----

user omg has written
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.
edited 1×, last 28.06.12 05:47:16 pm

old Re: !get !to

MikuAuahDark
User Off Offline

Quote
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

old Re: !get !to

omg
User Off Offline

Quote
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 has written
Also, you don't have to put player(id, 'health') between brackets again.

i didnt use any brackets

old Re: !get !to

Alistaire
User Off Offline

Quote
user omg has written
i didnt use any brackets


user omg has written
1
parse("sethealth "..id.." "..(player(id,"health")+1))


user omg has written
1
(player(id,"health")+1)


Lie some more.

old Re: !get !to

omg
User Off Offline

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

also, these are brackets: []

old Re: !get !to

Alistaire
User Off Offline

Quote
user omg has written
im pretty sure u do. i get errors when i dont add them in my scripts

also, these are brackets: []


Wikipedia has written
( ) — round brackets, open brackets, close brackets (UK), or parentheses


Your argument is invalid.

old Re: !get !to

wato24
User Off Offline

Quote
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)

old Re: !get !to

Cure Pikachu
User Off Offline

Quote
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

old Re: !get !to

omg
User Off Offline

Quote
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
edited 1×, last 28.06.12 10:39:31 pm

old Re: !get !to

Alistaire
User Off Offline

Quote
Also, it's better to use better string splitter functions for such important things.
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview