Forum

> > CS2D > Scripts > Lua Scripts/Questions/Help
Forums overviewCS2D overview Scripts overviewLog in to reply

English Lua Scripts/Questions/Help

6,770 replies
Page
To the start Previous 1 2278 279 280338 339 Next To the start

old Re: Lua Scripts/Questions/Help

maPmaKer
User Off Offline

Quote
Can anybody tell me the code for a lua script so when admin enters his chat will be coloured in green for example?

And can it work with U.S.G.N. IDs so I can put more IDs for more admins?

Thanks!
maPmaKer

old Re: Lua Scripts/Questions/Help

SQ
Moderator Off Offline

Quote
maPmaKer has written
Can anybody tell me the code for a lua script so when admin enters his chat will be coloured in green for example?

Use NewAdmin(USGN ID,"COLOR NAME") function to add more admins. (Use this command in the end of the script)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
Colors = { green = "000255000", red = "255000000", blue = "000000255", yellow = "255255000" }
AdminTable = {}

addhook("say","AdminSay")

function NewAdmin(USGN,COLOR)
	AdminTable[USGN] = COLOR
end

function AdminSay(P,T)
	local A = AdminTable[player(P,"usgn")]
	if A then
		msg("©"..Colors[string.lower(A)]..player(P,"name").."(Admin): "..T)
		return(1)
	end
	return(0)
end

NewAdmin(5537,"Red")

old Re: Lua Scripts/Questions/Help

RyceR
User Off Offline

Quote
Hey, has anybody "RolePlay" script from "rp_shopmap" map?
if yes plz give me
edited 1×, last 13.10.10 08:11:07 am

old Re: Lua Scripts/Questions/Help

maPmaKer
User Off Offline

Quote
GrandMyth has written
maPmaKer has written
Can anybody tell me the code for a lua script so when admin enters his chat will be coloured in green for example?

Use NewAdmin(USGN ID,"COLOR NAME") function to add more admins. (Use this command in the end of the script)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
Colors = { green = "000255000", red = "255000000", blue = "000000255", yellow = "255255000" }
AdminTable = {}

addhook("say","AdminSay")

function NewAdmin(USGN,COLOR)
	AdminTable[USGN] = COLOR
end

function AdminSay(P,T)
	local A = AdminTable[player(P,"usgn")]
	if A then
		msg("©"..Colors[string.lower(A)]..player(P,"name").."(Admin): "..T)
		return(1)
	end
	return(0)
end

NewAdmin(5537,"Red")


Thanks it works! But how to add more classes like "Moderator" or "Gamer"? I tryed to add but it isn't working
edited 1×, last 13.10.10 09:48:20 am

old Re: Lua Scripts/Questions/Help

Snake_Eater
User Off Offline

Quote
Hi guys!
I need help at this...

1
2
3
4
5
6
addhook ("say","lat")
function lat(p,t)
if (t == "[^","]+,[^","]+") then -- doesnt work
msg ("Works")
end
end

I want if somebody says :"ONE OR MORE LETTERS UNEQUAL "," then a "," AND ONE OR MORE LETTERS UNEQUAL "," "

pls help
edited 1×, last 13.10.10 03:32:25 pm

old Re: Lua Scripts/Questions/Help

Jaso
BANNED Off Offline

Quote
addhook('hit','hit.weap')


-- Check if the gun is a pistol
function hit.weap(id,sid,w)
if w > 0 and w < 7 then hit.team(id,sid) return 1
else return 0 end
end


-- Check if it's fired by a Terrorist
function hit.team(id,sid)
if player(sid,'team') == 1 then hit.teleport(id)
elseif player(sid,'team') ~= 1 then msg2(sid,"©255000000You can't arrest people!") end
end


-- Teleport the player to a quasi-random location
function hit.teleport(id)
local PLACES = {{1680,80},{2000,80},{2032,528}}
local PLACE = PLACES[math.random(1,#PLACES)]
parse('setpos '..id..' '..PLACE[1]..' '..PLACE[2])
end

When i try this script i get error can some one fix the wrong thing in the script?

old Re: Lua Scripts/Questions/Help

Snake_Eater
User Off Offline

Quote
the error is because the functions...(hit.teleport....)
thats must work...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
addhook('hit','weap')

-- Check if the gun is a pistol
function weap(id,sid,w)
if w > 0 and w < 7 then team(id,sid) return 1
else return 0 end
end


-- Check if it's fired by a Terrorist
function team(id,sid)
if player(sid,'team') == 1 then teleport(id)
elseif player(sid,'team') ~= 1 then msg2(sid,"©255000000You can't arrest people!") end
end


-- Teleport the player to a quasi-random location
function teleport(id)
local PLACES = {{1680,80},{2000,80},{2032,528}}
local PLACE = PLACES[math.random(1,#PLACES)]
parse('setpos '..id..' '..PLACE[1]..' '..PLACE[2])
end

Ps:

Hi guys!
I need help at this...

1
2
3
4
5
6
addhook ("say","lat")
function lat(p,t)
if (t == "[^","]+,[^","]+") then -- doesnt work
msg ("Works")
end
end

I want if somebody says :"ONE OR MORE LETTERS UNEQUAL "," then a "," AND ONE OR MORE LETTERS UNEQUAL "," "

pls help

old Re: Lua Scripts/Questions/Help

Jaso
BANNED Off Offline

Quote
@Snake_Eater ok thanks but how can i change it so its only for ct?

addhook('hit','weap')

-- Check if the gun is a pistol
function weap(id,sid,w)
if w > 0 and w < 7 then team(id,sid) return 1
else return 0 end
end
-- Check if it's fired by a Terrorist

function team(id,sid)
if player(sid,'team') == 1 then teleport(id)
elseif player(sid,'team') ~= 1 then msg2(sid,"©255000000You can't arrest people!") end
end


-- Teleport the player to a quasi-random location
function teleport(id)
local PLACES = {{1680,80},{2000,80},{2032,528}}
local PLACE = PLACES[math.random(1,#PLACES)]
parse('setpos '..id..' '..PLACE[1]..' '..PLACE[2])
end

old Re: Lua Scripts/Questions/Help

Snake_Eater
User Off Offline

Quote
@jaso55

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
addhook('hit','weap')

-- Check if the gun is a pistol
function weap(id,sid,w)
if w > 0 and w < 7 then team(id,sid) return 1
else return 0 end
end


-- Check if it's fired by a Terrorist
function team(id,sid)
if player(sid,'team') == 2 then teleport(id) --Here team1 = terrorists team2 = counterterrorists
elseif player(sid,'team') ~= 1 then msg2(sid,"©255000000You can't arrest people!") end
end


-- Teleport the player to a quasi-random location
function teleport(id)
local PLACES = {{1680,80},{2000,80},{2032,528}}
local PLACE = PLACES[math.random(1,#PLACES)]
parse('setpos '..id..' '..PLACE[1]..' '..PLACE[2])
end

Ps:

Hi guys!
I need help at this...

1
2
3
4
5
6
addhook ("say","lat")
function lat(p,t)
if (t == "[^","]+,[^","]+") then -- doesnt work
msg ("Works")
end
end

I want if somebody says :"ONE OR MORE LETTERS UNEQUAL "," then a "," AND ONE OR MORE LETTERS UNEQUAL "," "

pls help
edited 1×, last 13.10.10 04:34:08 pm

old Re: Lua Scripts/Questions/Help

maPmaKer
User Off Offline

Quote
GrandMyth has written
maPmaKer has written
Can anybody tell me the code for a lua script so when admin enters his chat will be coloured in green for example?

Use NewAdmin(USGN ID,"COLOR NAME") function to add more admins. (Use this command in the end of the script)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
Colors = { green = "000255000", red = "255000000", blue = "000000255", yellow = "255255000" }
AdminTable = {}

addhook("say","AdminSay")

function NewAdmin(USGN,COLOR)
	AdminTable[USGN] = COLOR
end

function AdminSay(P,T)
	local A = AdminTable[player(P,"usgn")]
	if A then
		msg("©"..Colors[string.lower(A)]..player(P,"name").."(Admin): "..T)
		return(1)
	end
	return(0)
end

NewAdmin(5537,"Red")


Thanks it works! But how to add more classes like "Moderator" or "Gamer"? I tryed to add but it isn't working. Still need help please answer

old Re: Lua Scripts/Questions/Help

SQ
Moderator Off Offline

Quote
This time use NewAdmin(USGN_ID,"Color","Rank Name")

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
-- Script By Blazzingxx
Colors = { green = "000255000", red = "255000000", blue = "000000255", yellow = "255255000" }
AdminTable = { }

addhook("say","AdminSay")

function NewAdmin(USGN,COLOR,RANK)
	AdminTable[USGN] = { C = COLOR, R = RANK}
	local A = AdminTable[USGN]
end

function AdminSay(P,T)
	local A = AdminTable[player(P,"usgn")]
	if A then
		msg("©"..Colors[string.lower( A.C )]..player(P,"name").." ("..string.upper( A.R ).."): "..T)
		return(1)
	end
	return(0)
end

NewAdmin(5537,"Red","admin")
edited 2×, last 18.10.10 01:09:18 pm

old Re: Lua Scripts/Questions/Help

SQ
Moderator Off Offline

Quote
hyh2 has written
Hello, who have simple knockback Lua script? If you have please give me or post here.

1
2
3
4
5
6
7
8
9
10
11
12
13
-- Script By Blazzingxx
addhook("hit","Knockback")
function Knockback(V,S,W)
	if (W > 0 and W < 50) then
		local DMG = (itemtype(W,"dmg") / 2)
		local ROT = math.rad(player(S,"rot") - 90)
		local NX = player(V,"x") + (math.cos(ROT) * DMG)
		local NY = player(V,"y") + (math.sin(ROT) * DMG)
		if tile(NX / 32 - 1,NY / 32 - 1,"walkable") then
			parse(string.format("setpos %s %s %s",V,NX,NY))
		end
	end
end

old Re: Lua Scripts/Questions/Help

Admir
User Off Offline

Quote
maPmaKer has written
Does anybody has a working no super supply lua?


you can't, but you can make script that RPG is not collectable by player.

old Re: Lua Scripts/Questions/Help

hyh2
COMMUNITY BANNED Off Offline

Quote
GrandMyth has written
hyh2 has written
Hello, who have simple knockback Lua script? If you have please give me or post here.

1
2
3
4
5
6
7
8
9
10
11
12
13
-- Script By Blazzingxx
addhook("hit","Knockback")
function Knockback(V,S,W)
	if (W > 0 and W < 50) then
		local DMG = (itemtype(W,"dmg") / 2)
		local ROT = math.rad(player(S,"rot") - 90)
		local NX = player(V,"x") + (math.cos(ROT) * DMG)
		local NY = player(V,"y") + (math.sin(ROT) * DMG)
		if tile(NX / 32 - 1,NY / 32 - 1,"walkable") then
			parse(string.format("setpos %s %s %s",V,NX,NY))
		end
	end
end


Magic. THX.

old Re: Lua Scripts/Questions/Help

senar
User Off Offline

Quote
i wan't a script that when you say !laser equip you a laser for $5000 i made onew but diden't work there was a wrong

ps: i know that is easy but i still learning

old Re: Lua Scripts/Questions/Help

ohaz
User Off Offline

Quote
1
2
3
4
5
6
7
8
9
10
11
addhook("say", "buylaser")
function buylaser(id,txt)
	if (txt == "!laser") then
		if (player(id, "money") > 4999) then
			parse("equip "..id.." 45")
			msg2(id, "Bought Laser!")
			parse("setmoney "..id.." "..player(id,"money") - 5000)
		end
	return 1
	end
end
@senar
To the start Previous 1 2278 279 280338 339 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview