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 2278 279 280338 339 Nächste Zum Anfang

alt Re: Lua Scripts/Questions/Help

maPmaKer
User Off Offline

Zitieren
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

alt Re: Lua Scripts/Questions/Help

SQ
Moderator Off Offline

Zitieren
maPmaKer hat geschrieben
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")

alt Re: Lua Scripts/Questions/Help

maPmaKer
User Off Offline

Zitieren
GrandMyth hat geschrieben
maPmaKer hat geschrieben
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
1× editiert, zuletzt 13.10.10 09:48:20

alt Re: Lua Scripts/Questions/Help

Snake_Eater
User Off Offline

Zitieren
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
1× editiert, zuletzt 13.10.10 15:32:25

alt Re: Lua Scripts/Questions/Help

Jaso
BANNED Off Offline

Zitieren
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?

alt Re: Lua Scripts/Questions/Help

Snake_Eater
User Off Offline

Zitieren
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

alt Re: Lua Scripts/Questions/Help

Jaso
BANNED Off Offline

Zitieren
@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

alt Re: Lua Scripts/Questions/Help

Snake_Eater
User Off Offline

Zitieren
@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
1× editiert, zuletzt 13.10.10 16:34:08

alt Re: Lua Scripts/Questions/Help

maPmaKer
User Off Offline

Zitieren
GrandMyth hat geschrieben
maPmaKer hat geschrieben
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

alt Re: Lua Scripts/Questions/Help

SQ
Moderator Off Offline

Zitieren
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")
2× editiert, zuletzt 18.10.10 13:09:18

alt Re: Lua Scripts/Questions/Help

SQ
Moderator Off Offline

Zitieren
hyh2 hat geschrieben
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

alt Re: Lua Scripts/Questions/Help

Admir
User Off Offline

Zitieren
maPmaKer hat geschrieben
Does anybody has a working no super supply lua?


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

alt Re: Lua Scripts/Questions/Help

hyh2
COMMUNITY BANNED Off Offline

Zitieren
GrandMyth hat geschrieben
hyh2 hat geschrieben
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.

alt Re: Lua Scripts/Questions/Help

senar
User Off Offline

Zitieren
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

alt Re: Lua Scripts/Questions/Help

ohaz
User Off Offline

Zitieren
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
Zum Anfang Vorherige 1 2278 279 280338 339 Nächste Zum Anfang
Einloggen, um zu antworten Scripts-ÜbersichtCS2D-ÜbersichtForenübersicht