Forum

> > CS2D > Scripts > script to do some say commands
Forums overviewCS2D overview Scripts overviewLog in to reply

English script to do some say commands

19 replies
To the start Previous 1 Next To the start

old script to do some say commands

Help Needer
User Off Offline

Quote
hi there

i need some little pro scripts

--> script for display clock in server
--> script for enabling/disabling fog of war with a say command
--> script for enabling/disabling offline/LAN with a say command
--> script for enabling/disabling registered users only with a say command
--> script for enabling/disabling friendly fire with a say command
--> script for enabling/disabling auto team balance with a say command
--> script for enabling/disabling fast build with say command
--> script to show the damage u made to your ennemie
--> script to when someone say "!usgn <ID>", a message comes up with the player's USGN
--> script for mute

old Re: script to do some say commands

D-D3ADxPro
User Off Offline

Quote
Fog of war:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
if sample==nil then sample={} end
sample.sayfuncs={}

-------------------------------------------
--  Fog function Hook --
-------------------------------------------


addhook("say","sample.sayfuncs.fog")
function sample.sayfuncs.fog(p,txt)
	if (txt=="!fogon") then
	msg2(p,"Fog of war is now enabled!")
	parse('sv_fow 1')
elseif (txt=="!fogoff") then
	msg2(p,"Fog of war is now disabled!")
	parse('sv_fow 0')
	end
end

Lan code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
if sample==nil then sample={} end
sample.sayfuncs={}

-------------------------------------------
--  Lan function Hook --
-------------------------------------------


addhook("say","sample.sayfuncs.lan")
function sample.sayfuncs.lan(p,txt)
	if (txt=="!lanon") then
	msg2(p,"Your server is now in lan mode! Please note that your server wont be added to serverlist!")
	parse('sv_lan 1')
elseif (txt=="!lanoff") then
	msg2(p,"You had disabled lan mode! Your server will now be on the server list!")
	parse('sv_lan 0')
	parse('usgn_addserver')
	end
end

Friendly Fire:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
if sample==nil then sample={} end
sample.sayfuncs={}

-------------------------------------------
--  Friendlyfire function Hook --
-------------------------------------------

addhook("say","sample.sayfuncs.friendlyfire")
function sample.sayfuncs.friendlyfire(p,txt)
	if (txt=="!friendlyfireon") then
	parse('sv_friendlyfire 1')
	msg2(p,"You had enabled friendlyfire! You can now damage your own teammates!")
	return 1
elseif (txt=="!friendlyfireoff") then
	parse('sv_friendlyfire 0')
	msg2(p,"You had disabled friendlyfire! You can not damage your own teammates!")
	return 1
	end
end

Autoteam-balance:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
if sample==nil then sample={} end
sample.sayfuncs={}

----------------------------------------------------------------
--  Autoteambalance function Hook --
----------------------------------------------------------------

addhook("say","sample.sayfuncs.friendlyfire")
function sample.sayfuncs.friendlyfire(p,txt)
	if (txt=="!autoteambalanceon") then
	parse('mp_autoteambalance 1')
	msg2(p,"You had enabled autoteam balance! Their will now be a balance of teams!")
	return 1
elseif (txt=="!autoteambalanceoff") then
	parse('mp_autoteambalance 0')
	msg2(p,"You had disabled autoteam balance! Their will not be a balance of teams!")
	return 1
	end
end

Show Damage: Their is already one in the file archive. Why dont you search it up?


!Usgn <id>: Don't know how to do that.


!mute: Already one in the file archive. How about you search that up?


EDIT: Clock (Forgot about this one):
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
if sample==nil then sample={} end
sample.sayfuncs={}

-------------------------------------------
--  Clock function Hook --
-------------------------------------------

addhook("say","sample.sayfuncs.clock")
function sample.sayfuncs.clock(id,txt)
     if (txt=="!clockon") then
	parse('hudtxt2 '..id..' 5 "'..os.date("©000128255Time: %I:%M %p")..'" 10 210')
	parse('hudtxt2 '..id..' 6 "'..os.date("©000255128Date: %A, %d %b %Y")..'" 10 225')	
	msg("Clock Activated!")
elseif(txt=="!clockoff") then
	msg("Clock Disabled!")
	parse('hudtxt2 '..id..' 5 " " 10 210')
	parse('hudtxt2 '..id..' 6 " " 10 225')
	end
end

old Re: script to do some say commands

Patron14
User Off Offline

Quote
user D-D3ADxPro has written
Friendly Fire:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
if sample==nil then sample={} end
sample.sayfuncs={}

-------------------------------------------
--  Friendlyfire function Hook --
-------------------------------------------

addhook("say","sample.sayfuncs.friendlyfire")
function sample.sayfuncs.friendlyfire(p,txt)
	if (txt=="!friendlyfireon") then
	parse('sv_friendlyfire 1')
	msg2(p,"You had enabled friendlyfire! You can now damage your own teammates!")
	return 1
elseif (txt=="!friendlyfireoff") then
	parse('sv_friendlyfire 0')
	msg2(p,"You had disabled friendlyfire! You can not damage your own teammates!")
	return 1
	end
end

Autoteam-balance:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
if sample==nil then sample={} end
sample.sayfuncs={}

----------------------------------------------------------------
--  Autoteambalance function Hook --
----------------------------------------------------------------

addhook("say","sample.sayfuncs.friendlyfire")
function sample.sayfuncs.[u]friendlyfire[/u](p,txt)
	if (txt=="!autoteambalanceon") then
	parse('mp_autoteambalance 1')
	msg2(p,"You had enabled autoteam balance! Their will now be a balance of teams!")
	return 1
elseif (txt=="!autoteambalanceoff") then
	parse('mp_autoteambalance 0')
	msg2(p,"You had disabled autoteam balance! Their will not be a balance of teams!")
	return 1
	end
end


can you be more focus on the mistakes you make ?
because this
Spoiler >
you repeated it in friendly fire and auto team balance
in that case, the script will not work correctly on auto team balance + he requested fast build and usgn only
i maybe need them in the future
edited 1×, last 22.07.13 04:45:38 am

old Re: script to do some say commands

hunter139
User Off Offline

Quote
Hey i am new here !
this is what i need
i searched for topics and i found this one, so i didnt want to create another
Anyway, i did exactly what i supposed to do but my code didnt work
tell me what is wrong please
More >
edited 1×, last 22.07.13 05:37:35 pm

old Re: script to do some say commands

lucaSWAT
User Off Offline

Quote
Try this. file cs2d sheeL's | Server Functions

Command mute and !usgn.
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
49
50
51
52
muted = {}

function totable(t,match)
     local cmd = {}
     if not match then
          match = "[^%s]+"
     else
          match = "[^"..match.."]+"
     end
     for word in string.gmatch(t,match) do
          table.insert(cmd,word)
     end
     return cmd
end

addhook("sayteam","_sayteam")
function _sayteam(id)
if muted[id] == 1 then
msg2(id,"©255000000Error:You are muted.")
return 1
end
end

addhook("join","_join")
function _join(id)
muted[id] = 0
end

addhook("say","_say")
function _say(id,txt)
local p = totable(txt)
local cmd = tostring(p[1])
local pl = tonumber(p[2])
if cmd:lower() == "!mute" then
muted[pl] = 1
return 1
end
if cmd:lower() == "!usgn" then
msg2(id,"©255255255Name : "..player(pl,"name").."")
msg2(id,"©255255255IP : "..player(pl,"ip").."")
if player(pl,"usgn") > 0 then
msg2(id,"©255255255USGN : "..player(pl,"usgn").."")
else
msg2(id,"©255255255USGN : Not Logged...")
end
return 1
end
if muted[id] == 1 then
msg2(id,"©255000000Error:You are muted.")
return 1
end
end

old Re: script to do some say commands

hunter139
User Off Offline

Quote
@user lucaSWAT:
Thank you very much
i didnt see that script before
very helpful

@user EngiN33R:
sorry, i will try to apply your advise in the future

@user CaneCorso:
He/She just said that your ipairs script "sucks"
( us moderators and admins, no need to ban me because i said "sucks", i just wanted to write what help needer said to MY

old Re: script to do some say commands

hunter139
User Off Offline

Quote
dont wory
i am Help Needer's frind
i dont double account

he told me that he is temp ban and dont want to make anather acount so the mods dont ban him for ever, so he told me to crete another myself

sry for bad englich

*** EDIT ***
@user lucaSWAT: USGN work, but mute dont work corectly
when i muted, i can say what ever i wont

IMG:https://i33.servimg.com/u/f33/18/41/08/82/screen13.jpg
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview