Forum

> > CS2D > Scripts > return 1 wont Work
Forums overviewCS2D overview Scripts overviewLog in to reply

English return 1 wont Work

12 replies
To the start Previous 1 Next To the start

old return 1 wont Work

baRD
User Off Offline

Quote
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
-------------------------
----Admin Commands v1----
------ by bardecon ------
-------------------------
Admin = {160589} -- Write here the usgn of the players who you want to be admin --

-- Say Hook1 --
addhook("say","sayCommand")
-- Admin Commands --

function sayCommand(id,txt)
for usgn in pairs(Admin) do
if (txt == "!sArmor") then 	--!sArmour Command, gives admin super armour.--
parse("equip "..id.." superarmor")
msg2(id,"©255255000Super Armor Succesfully equiped!")
elseif (txt =="!rs") then 	--!rs Command, resets your scores and deaths.--
if (player(id,"score")>0) or (player(id,"deaths")> 0) then
parse("setscore "..id.. " 0")
parse("setdeaths "..id.. " 0")
msg2(id,"©255255000Scores has succesfully reseted!")
return 1 --wont work plz help--
else
msg2(id,"©255255000You dont have scores yet!")
end
end
end
end
plz help me with this, return 1 wont work why?

old Re: return 1 wont Work

Louie
User Off Offline

Quote
You probably have another one of that hook somewhere, it won't work if you have multiple say hooks. Also, just a tip, do try tabbing your code as it can be a pain to read.

old Re: return 1 wont Work

Mora
User Off Offline

Quote
You can use
\169
instead of
©
. It would surely ignore causes with A and dots over it if you ever had.
If you dont know what's tabbing: You have a key on your keyboard called "TAB". Click it to move your text each for each
for
and
end
and
if
and
while
and etc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
Admin = {114940} -- Write here the usgn of the players who you want to be admin --

-- Say Hook1 --
addhook("say","sayCommand")
-- Admin Commands --

function sayCommand(id,txt)
	for usgn in pairs(Admin) do
		if (txt == "!sArmor") then      --!sArmour Command, gives admin super armour.--
			parse("equip "..id.." superarmor")
			msg2(id,"\169255255000Super Armor Succesfully equiped!")
		return 1
		elseif (txt =="!rs") then      --!rs Command, resets your scores and deaths.--
			if (player(id,"score")>0) or (player(id,"deaths")> 0) then
				parse("setscore "..id.. " 0")
				parse("setdeaths "..id.. " 0")
				msg2(id,"\169255255000Scores has succesfully reseted!")
			else
				msg2(id,"\169255255000You dont have scores yet!")
			end
		return 1
		end
	end
end

old Re: return 1 wont Work

baRD
User Off Offline

Quote
It still wont work.
And the A with dots on top still shows up.
But thx for posting though...

old Re: return 1 wont Work

Dousea
User Off Offline

Quote
I'm feeling good today.
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
-------------------------
----Admin Commands v1----
------ by bardecon ------
-------------------------
Admin = {160589} -- Write here the usgn of the players who you want to be admin --

-- Say Hook1 --
addhook("say","sayCommand")
-- Admin Commands --

function sayCommand(id,txt)
	for _, usgn in ipairs(Admin) do
		if (player(id,"usgn") == usgn) then
			if (txt == "!sArmor") then      --!sArmour Command, gives admin super armour.--
				parse("equip "..id.." superarmor")
				msg2(id,"\169255255000Super Armor Succesfully equiped!")
				return 1
			elseif (txt =="!rs") then      --!rs Command, resets your scores and deaths.--
				if (player(id,"score")>0) or (player(id,"deaths")> 0) then
					parse("setscore "..id.. " 0")
					parse("setdeaths "..id.. " 0")
					msg2(id,"\169255255000Scores has succesfully reseted!")
				else
					msg2(id,"\169255255000You dont have scores yet!")
				end
				return 1
			end
			break
		end
	end
end

old Re: return 1 wont Work

Mora
User Off Offline

Quote
No, my code was working perfectly. It's you have problems with hooks or smth else.

old Yes i do...

baRD
User Off Offline

Quote
Yes i do use my own scripts and a admin script that i dont own....
I yet have 5 scripts...

fastbuild.lua
joinMsg.lua
Player_Shop_v.1.lua
spawnEquip.lua

and i have my admin script
in my other folder...

old Re: return 1 wont Work

Yates
Reviewer Off Offline

Quote
At the very beginning of the lua script, type
return 1


It works I guarantee it 10/10 √

old Re: return 1 wont Work

_3yrus
User Off Offline

Quote
user baRD has written
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
-------------------------
----Admin Commands v1----
------ by bardecon ------
-------------------------
Admin = {160589} -- Write here the usgn of the players who you want to be admin --

-- Say Hook1 --
addhook("say","sayCommand")
-- Admin Commands --

function sayCommand(id,txt)
  for usgn in pairs(Admin) do
    if (txt == "!sArmor") then      --!sArmour Command, gives admin super armour.--
    parse("equip "..id.." superarmor")
    msg2(id,"©255255000Super Armor Succesfully equiped!")
  elseif (txt =="!rs") then      --!rs Command, resets your scores and deaths.--
    if (player(id,"score")>0) or (player(id,"deaths")> 0) then
      parse("setscore "..id.. " 0")
      parse("setdeaths "..id.. " 0")
      msg2(id,"©255255000Scores has succesfully reseted!")
      return 1 --wont work plz help--
    else
      msg2(id,"©255255000You dont have scores yet!")
    end
  end
end
end
plz help me with this, return 1 wont work why?


and also tab ur code , it would be more understandable
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview