Forum

> > CS2D > General > Questions [long ones]
Forums overviewCS2D overviewGeneral overviewLog in to reply

English Questions [long ones]

8 replies
To the start Previous 1 Next To the start

old Questions [long ones]

RedPillow
User Off Offline

Quote
Ooookay, this time i got so much questions that... god

1.How to run all the scripts i want @ start of my game? leegao said something about... "dofile" ? but i dont get it.

2.Where i can get these Cs2D-fuctions so i can try to do something? like "spawnmoney" where do you get those?

3.Uh, how those "injected-hacks" work, imean im not using them but why they can get into the game and memory-editors and other progs dont? [dont have to answer] Im just so god amn interested about computer security and things, anybody got a link for thesekind of things? no hacksites..

---------------I need some examples (LUA)---------------

1.How to make for example a clock that counts from 1 to 5 and then starts all over (01:00 --> 01:01 --> 05:00 --> 01:00)

2.How to make a script that fr example sends a randomized number (1-5) as a message like "your number is+randomnumber"

3.How to make a button which send msg to player who pushed it like this "Hello-playernamewhopushedit"

4.Could somebody give a links to a Class-script or send example here? it should include police,civilian & moderator
and all playyer must choose a class @ start of the game.

-police has tmp & kevlar
-civilian has rights to kick and laser
-moderator has right to kick, superarmor andability to teleport himself and players.

5.Example for script which removes or gives all players 3000$ every 120 seconds.

6.Example for simple commandsystem so i could just write to my chat-bar for example if i want to kick player ID 6 ill write to chatbar "/kick 6" or if i want to give player 20$ ill just type "give (ID) 20" so no console needed

7.no example needed but is it possible to make a modded bot?

Thank you!!

old Re: Questions [long ones]

ohaz
User Off Offline

Quote
Quote
1.How to run all the scripts i want @ start of my game? leegao said something about... "dofile" ? but i dont get it.
open /sys/lua/server.lua and add one line for each file at the end:
dofile("sys/lua/filename")
Quote
2.Where i can get these Cs2D-fuctions so i can try to do something? like "spawnmoney" where do you get those?
http://www.cs2d.com/help.php?cat=all
Quote
1.How to make for example a clock that counts from 1 to 5 and then starts all over (01:00 --> 01:01 --> 05:00 --> 01:00)

1
2
3
4
5
6
7
8
9
time = 0
addhook("second","timer")
function timer()
	time = time+1
	msg(time)
	if (time == 5)then
		time = 0
	end
end
Quote
6.Example for simple commandsystem so i could just write to my chat-bar for example if i want to kick player ID 6 ill write to chatbar "/kick 6" or if i want to give player 20$ ill just type "give (ID) 20" so no console needed

1
2
3
4
5
6
7
8
9
addhook("say","command")
function command(p,t)
		if (player(p,"usgn") == YOURUSGN) then
			if(string.sub(t, 1, 5) == "/kick")then
				kickedplayer = string.sub(t,7,string.len(t))
				parse("kick "..kickedplayer)
			end
		end
end

old Re: Questions [long ones]

Lee
Moderator Off Offline

Quote
Quote
3.Uh, how those "injected-hacks" work, imean im not using them but why they can get into the game and memory-editors and other progs dont? [dont have to answer] Im just so god amn interested about computer security and things, anybody got a link for thesekind of things? no hacksites..


This isn't readily answered, the most basic way of doing this, and often the more practiced way by the hackers, is to take some software someone have already written for runtime memory tracing, follow a few simple tutorials, and alter a few variables in game and proclaim themselves as Gods of the game. Obviously these sort of people are not smart on any level.

A more advanced explanation of this technique falls on two fronts. One can either inject code during preprocessing via DLL injection, which is relatively simple, since all you would need is to compile the alteration code into a simple DLL and modify the program only very minutely, or during runtime by actually taking a look at all of the memory addresses that the program occupies and individually or by cluster, modify them to get the desired results. In either cases, an advanced knowledge of the inner workings of not only the computer but also the specific OS you're working on is required. In most cases, the so called "hackers" do not have any skills beyond the fundamental reading skills needed to read a tutorial on how to click a few buttons.

Quote
2.How to make a script that fr example sends a randomized number (1-5) as a message like "your number is+randomnumber"

1
2
3
4
5
6
7
function sendRandom(player)
	--Seed the random to the current exe time
	math.randomseed(os.clock())
	--get the random val
	local val = math.random(1,5)
	msg2(player, string.format("Your random value is %s",val))
end

Quote
3.How to make a button which send msg to player who pushed it like this "Hello-playernamewhopushedit"


This isn't possible unless you're using a menu

Quote
4.Could somebody give a links to a Class-script or send example here? it should include police,civilian & moderator
and all playyer must choose a class @ start of the game.

-police has tmp & kevlar
-civilian has rights to kick and laser
-moderator has right to kick, superarmor andability to teleport himself and players.


This is a bit complicated but uses the same concept as the sample/classes.lua. Only here, you'll need to have a say function to single out if a player has written out !kick ID or !tele ID and check to see if they are in the right classes.

For a sample of a teleport command, use
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
function adm_teleport_admin(p, typ, cmd)
	cmd = toTable(cmd)
	local i = cmd[1]
	local x = cmd[2]
	local y = cmd[3]
	if not y then return invalid(p, typ) end
	if not player(i, "exists") then return invalid(p, typ, "Invalid Player") end
	parse(string.format("setpos %s %s %s", i, x, y))
end

function adm_teletile_admin(p, typ, cmd)
	cmd = toTable(cmd)
	local i = cmd[1]
	local x = cmd[2]
	local y = cmd[3]
	if not y then return invalid(p, typ) end
	if not player(i, "exists") then return invalid(p, typ, "Invalid Player") end
	parse(string.format("setpos %s %s %s", i, x*32, y*32))
end

Quote
5.Example for script which removes or gives all players 3000$ every 120 seconds.


1
2
3
4
5
6
7
addhook("minute", "give3000")
local time = 1
function give3000(p)
	if not time == 2 then time = 2 else time = 1 
		parse(string.format("setmoney %s %s", p, player(p, "money")+3000))
	end
end

That should give you an idea of all of the rest of the answers

old Re: Questions [long ones]

Zune5
COMMUNITY BANNED Off Offline

Quote
Jonzku777 has written
Ooookay, this time i got so much questions that... god

*Answered as simple as possible. Because I like Simple.*

1.How to run all the scripts i want @ start of my game? leegao said something about... "dofile" ? but i dont get it.

dofile ("sys/lua/The File Name of Your Lua.lua")

2.Where i can get these Cs2D-fuctions so i can try to do something? like "spawnmoney" where do you get those?

If you look in the Sample folder, DC created a Info.txt allllll about it

3.Uh, how those "injected-hacks" work, imean im not using them but why they can get into the game and memory-editors and other progs dont? [dont have to answer] Im just so god amn interested about computer security and things, anybody got a link for thesekind of things? no hacksites..

Using "DLL"s or Dynamic Library...yeah that crap.

old Re: Questions [long ones]

RedPillow
User Off Offline

Quote
Why it is DLL-inject??

I mean, why it can`t be exe-inject of ini-inject?
By the way, can you do anything "good" with these injects?
Or are they used of any known programs like umm... microsoft word?

old Re: Questions [long ones]

DC
Admin Off Offline

Quote
the steam overlay in steam games is realized with some sort of injection probably. or the fps overlay of fraps.

it's forbidden to use injection in cs2d (Readme.txt).

old Re: Questions [long ones]

RedPillow
User Off Offline

Quote
1
2
3
4
5
6
7
8
9
time = 0
addhook("second","timer")
function timer()
     time = time+1
     msg(time)
     if (time == 60)then
          time = 0
     end
end



I got problems with this 60 second "clock" i want.
It displays number in order jsut liek i want 1..2...3...
BUT it spams the whole chat, is it possible to make the clock to show in a single row so it wont spam the chat?
not like:
1
2
3
4
5

Like this:
1(changes to 2 changes to 3 etc...)

In same row and same place, and other players speech wont move it or do anything to it, it jsut stays in same place and changes there.


And this one:

1
2
3
4
5
6
7
8
9
addhook("say","command")
function command(p,t)
          if (player(p,"usgn") == Monkeyz) then
               if(string.sub(t, 1, 5) == "/kick")then
                    kickedplayer = string.sub(t,7,string.len(t))
                    parse("kick "..kickedplayer)
               end
          end
end

How to add ban,ipban and teleport (x,y) to the same script-file, so i dont have to do another?
AND how to send message to other players like when i kick id number 60 and playername is "cs2drocks" it will display message something like "sucker kicked" or something like that


EDIT: Oh, i would also like to know how to configure my constuction server so it can have unlimited buildings/player like 10 supplies etc.??

And, may i have a script which makes all ak-47`s infinite? nothing else.
Thanks.
edited 2×, last 08.04.09 05:45:44 pm

old Re: Questions [long ones]

ohaz
User Off Offline

Quote
1
2
3
4
5
6
7
8
9
10
11
12
13
14
addhook("say","command")
function command(p,t)
if (player(p,"usgn") == YOUR USGN NUMBER! NOT YOUR NICK!) then
if(string.sub(t, 1, 5) == "/kick")then
kickedplayer = string.sub(t,7,string.len(t))
parse("kick "..kickedplayer)
end
if(string.sub(t,1,4 == "/ban")then
bannedplayer = string.sub(t,6,string.len(t))
parse("banip "..bannedplayer)
end
(ADD OTHER IF PARTS HERE!)
end
end

to make unlimited buildings, just rcon:
mp_buildings_limit "BUILDING" 999999

old Re: Questions [long ones]

Lee
Moderator Off Offline

Quote
Quote
I got problems with this 60 second "clock" i want.
It displays number in order jsut liek i want 1..2...3...
BUT it spams the whole chat, is it possible to make the clock to show in a single row so it wont spam the chat?
not like:
1
2
3
4
5

Like this:
1(changes to 2 changes to 3 etc...)


use this

1
2
3
4
5
6
7
local timehud = 'hudtxt %s "%sTime: %s" 130 100 1'
local _time = 0
addhook("second", "changeTime")
function changeTime()
	parse(string.format(timehud, 1, "©255100000", _time))
	_time = _time + 1
end
To the start Previous 1 Next To the start
Log in to replyGeneral overviewCS2D overviewForums overview