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 2225 226 227338 339 Next To the start

old Re: Lua Scripts/Questions/Help

Lee
Moderator Off Offline

Quote
The original broadcast color is actually 100255000, while the sub call can be simplified as txt:sub(12).

The following cases may cause unexpected behavior:

in "!broadcastall" -> out "ll"
in "I just want to use !broadcast" -> out "to use !broadcast"
etc etc

old Re: Lua Scripts/Questions/Help

TimeQuesT
User Off Offline

Quote
Oo he found the bug
it's better to get the first 10 letters.
combine the chars to a string bzw get the full string via
sub and check them if the 10 first chars are !broadcast.

than do the given way without string.find...
1
2
3
4
5
6
7
8
9
10
11
addhook ("say","sages")
function sages(id,txt)
local tox=txt:sub(txt,0,10)
if tox=="!broadcast" then
local fullstring = txt:sub(10,txt:len)

msg ("©000255255"..player(id,"name").."(broadcasts):"..fullstring)
return 1;
end
end
end

ps: thank i didn't know that the xyz:sub bzw find or else
works

old Re: Lua Scripts/Questions/Help

HaRe
User Off Offline

Quote
i need help with this script

1
2
3
4
5
6
7
addhook("name","black_faking")
function black_faking(id,oln,nen)
	if nen==">'#Black__" then
		parse("kick "..id)
		msg(" "..player(id,"name").." got kicked for faking")
	end
end

I want if the name of a player is >'#Black__NAME#'< then it kicks him but i cant get the NAME thing to work

old Re: Lua Scripts/Questions/Help

TimeQuesT
User Off Offline

Quote
is this " ' " part of the name?

if it's you have to
1
2
3
4
5
6
7
addhook("name","black_faking")
function black_faking(id,oln,nen)
     if nen==">\'#Black__" then
          parse("kick "..id)
          msg(" "..player(id,"name").." got kicked for faking")
     end
end

' is nearly like "
so it's ending the string.
bzw starting

so you have to put \ in front of it

old Re: Lua Scripts/Questions/Help

HaRe
User Off Offline

Quote
Schinken has written
is this " ' " part of the name?

if it's you have to
1
2
3
4
5
6
7
addhook("name","black_faking")
function black_faking(id,oln,nen)
     if nen==">\'#Black__" then
          parse("kick "..id)
          msg(" "..player(id,"name").." got kicked for faking")
     end
end

' is nearly like "
so it's ending the string.
bzw starting

so you have to put \ in front of it


Omg i mean if some ones name is

example like

>'#Black__Noob#'< then he gets kicked coz hes not registered in the USGN List, u dont have to add the usgn list but i mean

if the name is like >'#black_random#'< then he gets kicked coz hes not in the usgn list

old Re: Lua Scripts/Questions/Help

Lee
Moderator Off Offline

Quote
Here's the basic concept, you'll need to write the boilerplate code:

1
2
3
4
5
function on_join(id)
	if player(id,"name"):match("^>'#Black__.+#") then
		-- TODO: Kick, Ban, Maket/ct, etc
	end
end

Note that if you use the name hook, a player named >'#Black__Noob# can join and play an entire game without getting kicked.

old Re: Lua Scripts/Questions/Help

Phenixtri
User Off Offline

Quote
PLZ HELP ME. Im working on my CS:S mini mod & I need to make a custom reload lua script.
I have 2 sound sets to work with both Valve & Streloks realistic sounds ( I have his permission :3 ) I still have to edit the reload sounds as they are in separate files for each part IE slide action clip in clip out exc.

Heres what I need to do.

1) Custom reload sounds for each weapon. ( I am working on wav. files with FLStudio 9 :3 )

reload A will be when ever the gun still has ammo IE just the clip sounds. the lua will also have to cancel the sounds when & if the player continues to shoot the remaining ammo.

reload B will only work when the weapon is empty & the sounds will include reload As clip sfx + the action IE bolt pull / slide action depending on the gun.

2) The lua may also trigger temp. weapon & weapon_d models.

Basically during the reload B cycle certain guns will show a new temporary weapon model. IE when a pistol is empty it will be replaced by a model that shows its slide back during the reload only.

3) I need a lua specific only to the M4A1 & USP. When the player uses the silencer on either of these guns then the drop model will also show the silencer on the guns like in CS:S.

4) A lua only for FAMAS & Glock. When the player activates the 3 round burst function the normal firing sounds will be replaced with a 3 rounds burst sfx.

I know this is probably going to be a lot of work but I have plenty of time to learn & work. All Help is welcome.

So can some one at least give me some ideas or references?
I'm rather serious about my project but im completely clueless when it comes to lua scripts >>

old Re: Lua Scripts/Questions/Help

Starkkz
Moderator Off Offline

Quote
@Dewfighter:

1
2
3
4
5
6
7
8
9
10
pl_license = {}
addhook("say","kicksay")
function kicksay(id,txt)
	if string.sub(txt,1,5) == "!kick" then
		if pl_license[id] then
			parse("kick "..string.sub(txt,7))
		end
		return 1
	end
end

You mean, kick if the person have a license?.

old Re: Lua Scripts/Questions/Help

Dewfighter
User Off Offline

Quote
@Starkkz: i mean a !kick command for the CT and for the CT can sell License and can remove license and for the T can savepos and teleport


so i need 2 scripts my clan makes a rp server we have all other scripts only license and the kick scripts


PS: sry for my bad english i'm german

old Re: Lua Scripts/Questions/Help

Dewfighter
User Off Offline

Quote
lee can u make a License script (CT's can sell/remove license) and the T can savepos in a shop an can teleport in the shop

and a !kick scripts for the CT's

Admin/mod comment

Don't ask the same questions more than once. You've even created a topic for it! That's pure spam! /TheKilledDeath

old Re: Lua Scripts/Questions/Help

CmDark
User Off Offline

Quote
haha.. another person trying to recreate Trots' rpg server...

looks like this works for saving a table into a file

Input:
1
2
3
4
5
tablev={1,2,3}
	c=assert(io.open("file2save2.txt", "w"))
	d=table.concat(tablev,"\n")
	c:write(d)
	c:close()

Output:
1
2
3
4
5
File: file2save2.txt
content:
1
2
3

old Re: Lua Scripts/Questions/Help

Rainoth
Moderator Off Offline

Quote
I don't get any of this string stuff when i put this in my lua i get error...

1
2
3
4
5
6
7
8
9
10
11
addhook ("say","sages")
function sages(id,txt)
local tox=txt:sub(txt,0,12)
if tox=="!broadcast" then
local fullstring = txt:sub(12,txt:len)

msg ("©100255000"..player(id,"name").."(broadcasts):"..fullstring)
return 1;
end
end
end

LUA ERROR : sys/lua/broadcast.lua:5: function arguments expected near ')'

old Re: Lua Scripts/Questions/Help

Phenixtri
User Off Offline

Quote
Yea make a script my self when i have no idea how to do that >> You are real intelligent buddy >> This thread was created for the purpose of asking Qs about lua. IM NOT ASKING PPL TO MAKE EM! I just need some 1 to give me a lua scripting 101 & what can & cant be done with it. At least give me a link to a site that can do that for me >>
To the start Previous 1 2225 226 227338 339 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview