Forum

> > CS2D > Scripts > God Mode for CityLife
Forums overviewCS2D overview Scripts overviewLog in to reply

English God Mode for CityLife

6 replies
To the start Previous 1 Next To the start

old God Mode for CityLife

Ryden
User Off Offline

Quote
Hello us

I want make GOD mode on citylife server,

I have made lot of tries but all FAILED,

Here is the lasted code i used
Spoiler >


It won't work and in consol it says other ERRORS but not error on this file

i have put this on sys/lua/godemod.lua,

I want to do like when AdminListed players say "!g" or press "g" it turn "godmode ON" and "godmode OFF"

Or i want to add the GodMode on F3,

WARNING: On F3, there is the ADMIN MENU and i want to ADD GodMode with the Admin MENU

The whole Code is this:
Spoiler >


If i have made a mistake or the whole code is False
Can you please correct it or tell me exactly how.

Thanks
-playø

old Re: God Mode for CityLife

Cure Pikachu
User Off Offline

Quote
That's the whole code?
Here you go, I guess:
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
adminlist = {122363} -- USGN list
godMode={}

addhook("say","_say")
addhook("join","_join")
addhook("hit","_hit")
addhook("leave","_leave")
addhook("serveraction","_serveraction")
addhook("menu","_menu")

function checkadmin(id)
	for _, u in ipairs(adminlist) do
		if player(id,"usgn") == u then
			return true
		end
	end
	retrun false
end

function togglegodmode(id)
	if godMode[id] then
		godMode[id] = false
		msg2(id,"God mode off")
	else
		godMode[id] = true
		msg2(id,"God mode on")
	end
end

function _join(id)
	godMode[id]=false
end

function _leave(id)
	godMode[id]=nil
end

function _say(id,text)
	if text == "!g" then
		if checkadmin(id) then
			togglegodmode(id)
		end
	end
end

function _serveraction(id,action)
	if action == 2 -- F3
		if checkadmin(id) then
			menu(id,"Admin Menu, God Mode")
		end
	end
end

function _menu(id,title,button)
	if title == "Admin Menu" then
		if button == 1 then
			togglegodmode(id)
		end
	end
end

function _hit(id)
	if godMode[id] then
		return 1
	end
end

old Re: God Mode for CityLife

Skripter5000
User Off Offline

Quote
Hey!

@user Ryden: to clarify whats wrong here:
You have got an admin script or such on your server, which takes F3 and sends a menu to the player.
-> Here you should hook, if you want to add a new Menu entry.
-> But you take the serveraction as hook, and test if command is g which isnt everytime, because action is 1, 2 or 3. (If I remember correctly), the F2, F3 or F4 respectively. The command var isn't even existing.

For say command, you must hook the say hook and check if message is !g .

-> Prebuilt Solution by @user Cure Pikachu:
--> His Solution will _also_ send a menu to the player, which is pressing F3 & admin.
---> With currently one Entry:
----> God Mode
--> Btw. Is this correct in your code? @user Cure Pikachu: line 49?

-> Depending on your admin script, it is easy to add the god command in there.

old Re: God Mode for CityLife

Ryden
User Off Offline

Quote
@user Cure Pikachu: Thank you for your code , and How can i use your code?

I mean, how to ON godMod with your code?
-By pressing on "G"
-By Typing "!g"
-By press F3 (Admin Menu of CITYLIFE)

??

@user Skripter5000: Thanks for your informations

old Re: God Mode for CityLife

Cure Pikachu
User Off Offline

Quote
@user Skripter5000: This says yes.
cs2d lua cmd menu has written
Note: This command has just TWO (2) paramters! The first one is the player id and the second one a string which defines the contents of the menu!

@user Ryden: Like what user Black Wolf said, you press F3 to bring up the admin menu, and then click on the "God Mode" button, or press 1 on your keyboard. Or you can just type !g in chat.
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview