Forum

> > CS2D > Scripts > Emulating cs2d scripts in Java
Forums overviewCS2D overview Scripts overviewLog in to reply

English Emulating cs2d scripts in Java

3 replies
To the start Previous 1 Next To the start

old Emulating cs2d scripts in Java

Livia
User Off Offline

Quote
Boredom is the reason for many things. Today it forced me to create a very limited cs2d script emulator in Java. Here's the result:
test = {}

addhook("say", "test.say")
function test.say(id, message)
	msg(player(id, "name") .. " says: \"" .. message .. "\"")
	if message == "money" then
		parse("setmoney " .. id .. " 16000")
		return 1
	end
end

addhook("join", "test.join")
function test.join(id)
	msg("Welcome " .. player(id, "name"))
end

addhook("leave", "test.leave")
function test.leave(id)
	msg("Good bye " .. player(id, "name"))
end
Java snippet >
OUTPUT has written
[MSG] Welcome DC
[MSG] Welcome Livia
[MSG] Livia says: "Hi DC!"
[MSG] DC says: "money"
[PARSE] setmoney 1 16000
[RETURN] test.say: 1
[MSG] Good bye DC


Edit:
Amazing! It handles my sample gamemode without errors!

Gamemode can be found here: file File does not exist (12391)
Java snippet >
OUTPUT >
edited 5×, last 07.10.12 08:36:35 am
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview