Forum

> > CS2D > Scripts > PM Lua
Forums overviewCS2D overview Scripts overviewLog in to reply

English PM Lua

29 replies
Page
To the start Previous 1 2 Next To the start

old PM Lua

mr_s
User Off Offline

Quote
Hi all can anyone make for me a pm lua with command @sayto and will be CT on my citylife server?

only a tiny file i need i tryed much but lua crashes and stoppes when i use it, please post it today

old Re: PM Lua

RebornDuck
User Off Offline

Quote
1
2
3
4
5
6
7
8
9
10
11
12
13
14
addhook("say","pm")
function pm(id,message)
if string.sub(txt, 1, 6) == "@sayto" then
        local p, message = string.match(txt, "@sayto (%d+) (.+)")
        if (p ~= nil) and (player(p,"exists")) then
            msg2(p,"©255125000[PM from] "..player(id,"name").." : "..message)
            msg2(id,"©255125000[PM to] "..player(p,"name").." : "..message)
            return 1
        else
            msg2(id,"©255000000[Error] @sayto <ID> <MESSAGE>")
            return 1
        end
	end
end

Not sure what you meant but that sends a message to the ID you put in. Untested but I think it works.

old Re: PM Lua

mr_s
User Off Offline

Quote
user RebornDuck has written
1
2
3
4
5
6
7
8
9
10
11
12
13
14
addhook("say","pm")
function pm(id,message)
if string.sub(txt, 1, 6) == "@sayto" then
        local p, message = string.match(txt, "@sayto (%d+) (.+)")
        if (p ~= nil) and (player(p,"exists")) then
            msg2(p,"©255125000[PM from] "..player(id,"name").." : "..message)
            msg2(id,"©255125000[PM to] "..player(p,"name").." : "..message)
            return 1
        else
            msg2(id,"©255000000[Error] @sayto <ID> <MESSAGE>")
            return 1
        end
	end
end

Not sure what you meant but that sends a message to the ID you put in. Untested but I think it works.

wait to test it

EDIT: Don't WORK Thx anyway, for your try
edited 1×, last 04.03.13 05:03:24 pm

old Re: PM Lua

Suprise
BANNED Off Offline

Quote
This should work perfectly:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
addhook("say","_say")
function _say(id,t)
	if t:sub(1,6)=="!sayto" then
		pl = 0
		msg = ""
		if t:sub(9,9)~=" " then
			pl = tonumber(t:sub(8,9))
			msg = t:sub(11)
		else
			pl = tonumber(t:sub(8,8))
			msg = t:sub(10)
		end
	if player(pl,"exists") then
		msg2(id,"©255255255PM==> "..player(pl,"name")..": "..msg)
		msg2(pl,"©255255255"..player(id,"name").."(PM): "..msg)
	end
	return 1
end

old Re: PM Lua

mr_s
User Off Offline

Quote
THx but not work

i have smiley city lua and dont work

pls a one compatible with smiley city
edited 1×, last 05.03.13 02:15:38 pm

old Re: PM Lua

EngiN33R
Moderator Off Offline

Quote
user Suprise has written
This should work perfectly:

-snip-

Why should it? You forgot an end to close your first if clause.

Try this:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
addhook("say","pm")
function pm(id,t)
	if (t:sub(1,6)=="@sayto") then
		local tt={}
		for w in t:gmatch("[^%s]+") do tt[#tt+1]=w end
		local pl=tt[2]
		local m=table.concat(tt," ",3)
		if (player(pl,"exists")) then
			msg2(id,"PM to "..player(pl,"name")..": "..m)
			msg2(pl,"PM from "..player(id,"name")..": "..m)
		else
			msg2(id,"Player with the ID "..pl.." does not exist!")
		end
		return 1
	end
end
edited 1×, last 05.03.13 02:23:33 pm

old Re: PM Lua

mr_s
User Off Offline

Quote
compatible with smiley city?

REPLY: how to hide Player(Visitor): @sayto 1 hi
?

old Re: PM Lua

EngiN33R
Moderator Off Offline

Quote
user mr_s has written
REPLY: how to hide Player(Visitor): @sayto 1 hi
?

I edited the code, try it now.

user mr_s has written
compatible with smiley city?

I have no idea, I don't know what that is.

old Re: PM Lua

mr_s
User Off Offline

Quote
it sends pm but shows :
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
----- Server started -----
friendly fire ENABLED
Lua: Adding function 'bm.menuselect' to hook 'menu'
Lua: Adding function 'pm' to hook 'say'
Lua: Adding function 'rp_load' to hook 'join'
Lua: Adding function 'rp_team' to hook 'team'
Lua: Adding function 'rp_leave' to hook 'leave'
Lua: Adding function 'rp_startround' to hook 'startround'
Lua: Adding function 'rp_attack' to hook 'attack'
Lua: Adding function 'rp_int' to hook 'say'
Lua: Adding function 'news_show' to hook 'say'
Lua: Adding function 'rp_kill' to hook 'kill'
Lua: Adding function 'rp_always' to hook 'always'
Lua: Adding function 'rp_minute' to hook 'minute'
Lua: Adding function 'rp_second' to hook 'second'
Lua: Adding function 'rp_walkover' to hook 'walkover'
Lua: Adding function 'rp_die' to hook 'die'
Lua: Adding function 'rp_action' to hook 'serveraction'
Lua: Adding function 'rp_drop' to hook 'drop'
Lua: Adding function 'rp_menu' to hook 'menu'
Lua: Adding function 'rp_build' to hook 'build'
Lua: Adding function 'rp_build' to hook 'build'
Lua: Adding function 'rp_spawn' to hook 'spawn'
Lua: Adding function 'rp_hit' to hook 'hit'
Lua: Adding function 'rp_projectile' to hook 'projectile'
Lua: Adding function 'watertile' to hook 'movetile'
Lua: Adding function 'rp_use' to hook 'use'
Lua: Adding function 'rp_select' to hook 'select'
Lua: Adding function 'horse1_use' to hook 'use'
Lua: Adding function 'horse2_use' to hook 'use'
Lua: Adding function 'horse3_use' to hook 'use'
Lua: Adding function 'vehicle1mod_use' to hook 'use'
Lua: Adding function 'vehicle2mod_use' to hook 'use'
Lua: Adding function 'vehicle3mod_use' to hook 'use'
Lua: Adding function 'vehicle4mod_use' to hook 'use'
Lua: Adding function 'vehicle5mod_use' to hook 'use'
Lua: Adding function 'vehicle6mod_use' to hook 'use'
Lua: Adding function 'vehicle7mod_use' to hook 'use'
Lua: Adding function 'vehicle8mod_use' to hook 'use'
Lua: Adding function 'vehicle9mod_use' to hook 'use'
Lua: Adding function 'vehicle10mod_use' to hook 'use'
Lua: Adding function 'vehicle11mod_use' to hook 'use'
Lua: Adding function 'vehicle12mod_use' to hook 'use'
Lua: Adding function 'Safezone' to hook 'movetile'
Login with 61131
LUA ERROR: sys/lua/Teal/Main.lua:326: attempt to call global 'isAdmin' (a nil value)
U.S.G.N.: Sending serverlist ADD-request...
U.S.G.N.: Ping/State 'playing'
U.S.G.N.: Server added to serverlist
[SAZ]SaMeR joins the Terrorist Forces
[SAZ]SaMeR(Visitor): @sayto 1 hi
PM to [SAZ]SaMeR: hi
PM from [SAZ]SaMeR: hi
REPLY: understand now?, i explain it

old Re: PM Lua

Starkkz
Moderator Off Offline

Quote
@user mr_s: try disabling any other scripts, remove them from autorun folder. Then put the PM script in the autorun folder.

old Re: PM Lua

mr_s
User Off Offline

Quote
1
2
3
4
[SAZ]SaMeR joins the Terrorist Forces
[SAZ]SaMeR(Visitor): @sayto 1 hi
PM to [SAZ]SaMeR: hi
PM from [SAZ]SaMeR: hi
user Obviously Exactly Myself has written
The error is not from the PM script.

Not the error, i fixed it but
Here it shows PM to everyone
How to remove "[SAZ]SaMeR(Visitor): @sayto 1 hi" ??
edited 1×, last 05.03.13 03:05:18 pm

old Re: PM Lua

omg
User Off Offline

Quote
its because u have other scripts running that hook "say"
it may return 1 on this particular function but when running through another one it wont return 1

old Re: PM Lua

mr_s
User Off Offline

Quote
i dont understand any word
EDIT: why w0w have moderator say and @sayto ?
edited 1×, last 05.03.13 03:06:59 pm

old Re: PM Lua

Shawni
User Off Offline

Quote
Its just because you have used say hook randomly.

Bring the say hook here.

old Re: PM Lua

mr_s
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
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
addhook("say","rp_int")
function rp_int(id,txt)
	
	if Mute_text== 1 then
		rp_msg2(id,"255000000","You cant send message in mute mode, use team message")
		return 1
	end
	
	-- if depos[id] == 0 and checkbound(id,Config.Bank) then
		-- local bankamount = txt
		-- if rp_money[id] >= bankamount then
			-- rp_money[id] = rp_money[id] - bankamount
			-- Bankmoney[id] = Bankmoney[id] + bankamount
			-- updatehud(id)
			-- depos[id] = 0
		-- elseif rp_money[id] < bankamount then
			-- rp_msg2(id,"255255255","not enought money with you")
			-- depos[id] = 0
		-- end
	-- end
	
	--if withd[id] == 1 and checkbound(id,Config.Bank) then
		-- local bankamount = txt
		-- if Bankmoney[id] >= bankamount then
			-- rp_money[id] = rp_money[id] + bankamount
			-- Bankmoney[id] = Ban\kmoney[id] - bankamount
			-- updatehud(id)
			-- rp_msg2(id,"255255255","You have successfuly withdrawn "..bankamount.."$ from your Bank-account!")
			-- withd[id] = 0
		-- elseif Bankmoney[id] < bankamount then
			-- rp_msg2(id,"255255255","not enought money on your Bank-account!")
			-- withd[id] = 0
		-- end
	--end	
	--withd[id] = 0
	
	 if (txt =="hi" and player(id,"tilex")==vehiclenpcx and player(id,"tiley")==vehiclenpcy) then
	 rp_msg2(id,"255000000","Vehicle Seller: Hello Which vehicle you would like to rent?")
	menu(id,"Vehicle list 1,BMW 2010 |3k,Porche |1.5k,Nissan |5k,BMW X5 |7.5k,Sedan |3k,Other Vehicles")
     elseif (txt=="hi" and player(id,"tilex")==horsenpcx and player(id,"tiley")==horsenpcy) then
	 rp_msg2(id,"255000000","Horse Seller: Hello Which horse you would like to rent?")
	menu(id,"Horses,White horse |10k,Orange horse |10k,Brown horse |10k")
    elseif (txt=="hi" and player(id,"tilex")==movienpcx and player(id,"tiley")==movienpcy) then
	 rp_msg2(id,"255000000"," Hello Which movie you would like to watch?")
	menu(id,"Movie,Naruto |100$,Harry Potter |100$,bye")    
     elseif (txt=="hi" and player(id,"tilex")==bridge1npcx and player(id,"tiley")==bridge1npcy) then
	 rp_msg2(id,"255000000","Hi,Welcome to the island.")
	menu(id,"Bridge,Can I pass?,Buy a ticket. |30k,Bye")
	elseif (txt=="hi" and player(id,"tilex")==bridge2npcx and player(id,"tiley")==bridge2npcy) then
	 rp_msg2(id,"255000000","Hi,Welcome to the island.")
	menu(id,"Bridge2,Can I pass?,Buy a ticket. |30k,Bye")
	elseif (txt=="hi" and player(id,"tilex")==vicarnpcx and player(id,"tiley")==vicarnpcy) then
	 rp_msg2(id,"255000000","Vicar:Welcome to the church.")
	 menu(id,"Heal,Heal |1k,Bye")
	elseif (txt=="hi" and player(id,"tilex")==licensenpcx and player(id,"tiley")==licensenpcy) then
	 rp_msg2(id,"255000000","License Seller: Hello Which License you would like to Buy?")
	menu(id,"License List,Normal License |100k,Vehicle License |150k,Vip |5000k,Temp Ct power |100000k,Buy speed")    
   elseif (txt=="hi" and player(id,"tilex")==shopnpcx and player(id,"tiley")==shopnpcy) then
		if rp_Adminlevel[id] >= 1 then
		rp_msg2(id,"255000000","House Seller: Hello admin, What would you like to do?")
		menu(id,"sansnasa,This menu , is under, constuction!")
		else 
		rp_msg2(id,"255000000","House Seller: Hello, Which house you would like to Buy?")
		menu(id,"Buy House,house 1 |"..house1owner..",house 2 |"..house2owner..",house 3 |"..house3owner..",house 4 |"..house4owner..",house 5 |"..house5owner..",bye")
		end
	elseif (txt=="hi" and player(id,"tilex")==shop2npcx and player(id,"tiley")==shop2npcy) then
		if rp_Adminlevel[id] >= 1 then
		rp_msg2(id,"255000000","House Seller: Hello admin, What would you like to do?")
		menu(id,"sansnasa2,This menu , is under, constuction!")
		else 
		rp_msg2(id,"255000000","House Seller: Hello, Which house you would like to Buy?")
		menu(id,"Buy House2,house 6 |"..house6owner..",house 7 |"..house7owner..",house 8 |"..house8owner..",house 9 |"..house9owner..",house 10 |"..house10owner..",bye")
		end
    elseif (txt=="hi" and player(id,"tilex")==magicnpcx and player(id,"tiley")==magicnpcy) then
	 rp_msg2(id,"255000000","Magician: Hello Which Magic you would like to learn?")
	CreateAddonsSell(id)
	elseif (txt=="hi" and checkbound(id,Config.Bank)) then
	 rp_msg2(id,"255000000","Banker:Welcome to the bank.")
	 menu(id,"bank,my money  |"..Bankmoney[id]..",Deposit ,Withdraw,Credit card ,Info ")
	end
	
	if rp_ct[id]==true then
		if txt:sub(1,1)=="!" then
			print(player(id,'name')..' used a command:'..txt)
			ParseAdminCommand(id,txt)
			return 1
		end
		
		if txt:sub(1,1)=="$" then
			print(player(id,'name')..' made a action:'..txt)
			more_say(id,txt)
			return 1
		end
	
	if rp_ct[id] == true then
		if txt ~="rank" then
			if rp_Adminlevel[id]== 11 then
				rp_msg("255205055",player(id,"name").."(Creator): "..txt)
			elseif rp_Adminlevel[id]== 10 then
				rp_msg("200250205",player(id,"name").."(Owner): "..txt)
			elseif rp_Adminlevel[id]== 9 then
				rp_msg("255220183",player(id,"name").."(Scripter): "..txt)
			elseif rp_Adminlevel[id]== 8 then
				rp_msg("200200200",player(id,"name").."(Mapper): "..txt)
			elseif rp_Adminlevel[id]== 7 then
				rp_msg("255255255",player(id,"name").."(Clan Leader): "..txt)
			elseif rp_Adminlevel[id]== 6 then
			    rp_msg("233114250",player(id,"name").."(Vice Leader): "..txt)	
			elseif rp_Adminlevel[id]== 5 then
			    rp_msg("124255062",player(id,"name").."(Elite Member): "..txt)
			elseif rp_Adminlevel[id]== 4 then
			    rp_msg("062255245",player(id,"name").."(SuperMod): "..txt)	
			elseif rp_Adminlevel[id]== 3 then
			    rp_msg("071062255",player(id,"name").."(Moderator): "..txt)
			elseif rp_Adminlevel[id] == 2 then
			    rp_msg("250255062",player(id,"name").."(Trainee): "..txt)
			elseif rp_Adminlevel[id] == 1 then
			    rp_msg("254154063",player(id,"name").."(Member): "..txt)	
			else rp_msg("254154063",player(id,"name").."(Visitor): "..txt)
			end
		return 1
		end
	end
	end
	
	if rp_vipmsg[id]>0 and txt ~="rank" then
		rp_msg("000255255",player(id,"name").."(VIP): "..txt)
		rp_vipmsg[id]=0
		return 1
	end
	
	if rp_ct[id] == false then
	   if txt ~="rank" then
			if rp_Adminlevel[id] == 0 then
				rp_msg("255255255",player(id,"name").."(Visitor): "..txt)
			return 1
			end
		end
	end
end
edited 1×, last 05.03.13 03:09:55 pm

old Re: PM Lua

Starkkz
Moderator Off Offline

Quote
1
addhook("say","pm",99999999999999999)
I think that if you modify the say hook like this, it should work.

old Re: PM Lua

mr_s
User Off Offline

Quote
what 99999999999999999999 do?
REPLY: and the function rp_int?

it will be deleted?
months will be deleted?

old Re: PM Lua

Shawni
User Off Offline

Quote
user mr_s has written
what 99999999999999999999 do?
REPLY: and the function rp_int?

it will be deleted?
months will be deleted?


The priority,
If there are other say hooks then this hook will be the 1st to be executed.

old Re: PM Lua

Suprise
BANNED Off Offline

Quote
samer has written
months will be deleted?


yes, no more payday.
To the start Previous 1 2 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview