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 2198 199 200338 339 Next To the start

old Re: Lua Scripts/Questions/Help

archmage
User Off Offline

Quote
gabpro has written
In "say" the return didn't works for me too...

When I "return 1" in the say hook of my scripts,the message appears =x

What's wrong?It's a error?

I would help, but you did not post any scripts. Though it might not be an error but a bug. Some of the hooks are buggy.

old Re: Lua Scripts/Questions/Help

Redefinder
User Off Offline

Quote
Another problem.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
addhook("say","dropmoney")
function dropmoney(id,txt)
	if (txt=="!drop100") and player(id,"money")>=100 then
		parse("spawnitem 66 "..player(id,"tilex").." "..player(id,"tiley"))
		parse("setmoney "..i.." "..player(i,"money") - 100) 
		return 1
	elseif (txt=="!drop500") and player(id,"money")>=500 then
		parse("spawnitem 67 "..player(id,"tilex").." "..player(id,"tiley"))
		parse("setmoney "..i.." "..player(i,"money") - 500) 
		return 1
	elseif (txt=="!drop1000") and player(id,"money")>=1000 then
		parse("setmoney "..i.." "..player(i,"money") - 1000) 
		parse("spawnitem 68 "..player(id,"tilex").." "..player(id,"tiley"))
		return 1
	end
end
It drops money but it doesn't strips an amount of money from the player.

old Re: Lua Scripts/Questions/Help

Vectarrio
User Off Offline

Quote
redefinder has written
Another problem.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
addhook("say","dropmoney")
function dropmoney(id,txt)
	if (txt=="!drop100") and player(id,"money")>=100 then
		parse("spawnitem 66 "..player(id,"tilex").." "..player(id,"tiley"))
		parse("setmoney "..i.." "..player(i,"money") - 100) 
		return 1
	elseif (txt=="!drop500") and player(id,"money")>=500 then
		parse("spawnitem 67 "..player(id,"tilex").." "..player(id,"tiley"))
		parse("setmoney "..i.." "..player(i,"money") - 500) 
		return 1
	elseif (txt=="!drop1000") and player(id,"money")>=1000 then
		parse("setmoney "..i.." "..player(i,"money") - 1000) 
		parse("spawnitem 68 "..player(id,"tilex").." "..player(id,"tiley"))
		return 1
	end
end
It drops money but it doesn't strips an amount of money from the player.

You have "setmoney "..I.."...
but you don't have I, only id
just change

old Re: Lua Scripts/Questions/Help

Redefinder
User Off Offline

Quote
@Vectar666,thanks man

EDIT:In my previous code I have three say hooks,does this affect the script in any way?
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
leader_usgn = {29595}

addhook("say","leadersay")
function leadersay(id,txt)
          for index,USGN in ipairs(leader_usgn) do
               if player(id,"usgn") == 29595 then
                 msg("©000000255(CAN)Redefinder[Leader]: "..txt)
		 return 1
               end
          end
end

admin_usgnid = {6831, 30773}

addhook("say","adminsay")
function adminsay(id,txt)
          for index,USGN in ipairs(admin_usgnid) do
               if player(id,"usgn") == 6831 or player(id,"usgn") == 30773 then
                 msg("©255000000"..player(id,"name").." [Admin]: "..txt)
		 return 1
               end
          end
end

member_usgn = {41794}

addhook("say","membersay")
function membersay(id,txt)
          for index,USGN in ipairs(member_usgn) do
               if player(id,"usgn") == 41794 then
                 msg("©255255255"..player(id,"name").." [Member]: "..txt)
		 return 1
               end
          end
end

old Re: Lua Scripts/Questions/Help

Flacko
User Off Offline

Quote
Lol wtf, that's damn ugly.
You should write sth more or less like this:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
usgn = {
	Leader = {29595},
	Admin = {6831, 30773},
	Member = {41794}	
}
colors = {
	Leader = "000000255",
	Admin = "255000000",
	Member = "255255255"
}
addhook("say","leadersay")
function leadersay(id,txt)
	for key,v in pairs(usgn) do
		for i,usgn in ipairs(v) do
			if player(id,"usgn") == usgn then
				msg("©"..colors.key..player(id,"name").."["..key.."]: "..txt)
				return 1
			end
		end
	end
end

old Re: Lua Scripts/Questions/Help

Redefinder
User Off Offline

Quote
Flacko has written
Lol wtf, that's damn ugly.
You should write sth more or less like this:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
usgn = {
     Leader = {29595},
     Admin = {6831, 30773},
     Member = {41794}     
}
colors = {
     Leader = "000000255",
     Admin = "255000000",
     Member = "255255255"
}
addhook("say","leadersay")
function leadersay(id,txt)
     for key,v in pairs(usgn) do
          for i,usgn in ipairs(v) do
               if player(id,"usgn") == usgn then
                    msg("©"..colors.key..player(id,"name").."["..key.."]: "..txt)
                    return 1
               end
          end
     end
end

It's not working :S

old Re: Lua Scripts/Questions/Help

Soja1997
User Off Offline

Quote
It can do so that someone in the upper right corner of the said
Gang:
Money:
Gangs - Crips, Bloods
Crips - BLUE (CT)
Bloods - RED (TT)

old Re: Lua Scripts/Questions/Help

Heartless Soldier
User Off Offline

Quote
redefinder has written
@Flacko,Strange...
Is it possible that something else from the script stops it for working properly?


Yes, if you first use a Say hook, and then you use one more, the "return 1" won't work properly, check if you aren't using the say hook for two different functions.

old Re: Lua Scripts/Questions/Help

Redefinder
User Off Offline

Quote
@N-B-K,ah yes,I am using two,the color message say hook and the say drop money hook above.
How do I fix it?

PS:I tried getting them in a single hook but then the say drop money script doesn't work.

old Re: Lua Scripts/Questions/Help

Redefinder
User Off Offline

Quote
byengul has written
hi guyz i can't join to favourite server when i try to join it always says loading server data... why??

Well idk why you couldn't join your server,but I do know that you shouldn't have posted this here.This thread is for lua scripting.

old Re: Lua Scripts/Questions/Help

Heartless Soldier
User Off Offline

Quote
redefinder has written
@N-B-K,ah yes,I am using two,the color message say hook and the say drop money hook above.
How do I fix it?

PS:I tried getting them in a single hook but then the say drop money script doesn't work.


Yes, of course the solution is get them in only one hook, maybe you can give me your code by pm if you don't want to post it so i can fix it.

old Re: Lua Scripts/Questions/Help

SkullFace
User Off Offline

Quote
Do you guys know what is wrong here ?

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
67
68
69
70
addhook("_walkover","zm_assault")
function zm_assault_walkover(id,x,y)

if (x == 46 and y == 22) then
if (player(id,"money")>2499) then
parse("setmoney "..id.." "..(player(id,"money")-2500))
else
msg(id,"©255000000You don't have enough money (need 2500 $)")
end
end
end

if (x == 46 and y == 23) then
if (player(id,"money")>2999) then
parse("setmoney "..id.." "..(player(id,"money")-3000))
else
msg(id,"©255000000You don't have enough money (need 3000 $)")
end
end
end

if (x == 46 and y == 24) then
if (player(id,"money")>3499) then
parse("setmoney "..id.." "..(player(id,"money")-3500))
else
msg(id,"©255000000You don't have enough money (need 3500 $)")
end
end
end

if (x == 46 and y == 25) then
if (player(id,"money")>3999) then
parse("setmoney "..id.." "..(player(id,"money")-4000))
else
msg(id,"©255000000You don't have enough money (need 4000 $)")
end
end
end

if (x == 46 and y == 26) then
if (player(id,"money")>4499) then
parse("setmoney "..id.." "..(player(id,"money")-4500))
else
msg(id,"©255000000You don't have enough money (need 4500 $)")
end
end
end

if (x == 46 and y == 27) then
if (player(id,"money")>4999) then
parse("setmoney "..id.." "..(player(id,"money")-5000))
else
msg(id,"©255000000You don't have enough money (need 5000$)")
end
end
end

if (x == 46 and y == 28) then
if (player(id,"money")>15999) then
parse("setmoney "..id.." "..(player(id,"money")-16000))
parse ("setmaxhealth "..id.." 150")
else
msg(id,"©255000000You don't have enough money (need 16000 $)")
end
end
end

if (x == 48 and y == 21) then
msg(id,"©000255000Hi there! Want to buy some thing ?")
end

I want here when they walk over specified gun which is on ground to lose some money. How I do that ?
To the start Previous 1 2198 199 200338 339 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview