2 hours = Vip
10 replies



Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
p = {}
addhook("team","_t")
function _t(id,t)
if not p[id] then p[id]=0 end
end
addhook("minute","_m")
function _m()
for k, v in pairs (player(0,"table")) do
p[v] = p[v] + 1
if p[v] == 120 then
-- give vip here
end
end
end
addhook("leave","_l")
function _l(id)
if p[id] then p[id] = nil end
end
addhook("team","_t")
function _t(id,t)
if not p[id] then p[id]=0 end
end
addhook("minute","_m")
function _m()
for k, v in pairs (player(0,"table")) do
p[v] = p[v] + 1
if p[v] == 120 then
-- give vip here
end
end
end
addhook("leave","_l")
function _l(id)
if p[id] then p[id] = nil end
end
Works even if the player goes into spectator.
// P.S. for someone who claimed to have found security issues. You're pretty bad if you ask for these kind of things...
edited 1×, last 03.01.16 07:59:41 pm
@
Rainoth: There will be an error at line 4 because after the condition you don't assign any value to p[id].

I'm awesome ... and I really like cookies.
Will do the same as
Rainoth's.

Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
p = {}
addhook("team","_t")
function _t(id,t)
p[id] = p[id] or 0
end
addhook("minute","_m")
function _m()
for k, v in ipairs (player(0,"table")) do
p[v] = p[v] + 1
if p[v] == 120 then
-- give vip here
end
end
end
addhook("leave","_l")
function _l(id)
p[id] = nil
end
addhook("team","_t")
function _t(id,t)
p[id] = p[id] or 0
end
addhook("minute","_m")
function _m()
for k, v in ipairs (player(0,"table")) do
p[v] = p[v] + 1
if p[v] == 120 then
-- give vip here
end
end
end
addhook("leave","_l")
function _l(id)
p[id] = nil
end
I'm awesome ... and I really like cookies.
I believe
would work as well
Edit: sorry for being Slowpoke.
Code:
1
p[id] = (p[id] or 0)
would work as well
Edit: sorry for being Slowpoke.
Trust me, I'm an engineer |
DC approved
Super extra mod for CS2D (64), yeah!



It isn't actually hard to do that if you know at least some basics in Lua. The stuff that you asked is basically very simple to do so.
Your only task is by adding your USGN ID in the {} brackets and that's it.
Edit: Oopsie, I left return 1 forgotten which means it will lead to a bug - whenever you type something, the message will appear two times. I guess you wouldn't mind it, I fixed that issue nevertheless. Was bit in a hurry while typing the code.
Code:
1
2
3
4
5
6
7
8
9
10
11
12
2
3
4
5
6
7
8
9
10
11
12
VIP = {}
function VIPsay(id, text)
for _,i in ipairs(VIP) do
if i == player(id, "usgn") then
msg("\169255255255"..player(id, "name").." [VIP]: "..text)
return 1
end
end
end
addhook("say","VIPsay")
function VIPsay(id, text)
for _,i in ipairs(VIP) do
if i == player(id, "usgn") then
msg("\169255255255"..player(id, "name").." [VIP]: "..text)
return 1
end
end
end
addhook("say","VIPsay")
Your only task is by adding your USGN ID in the {} brackets and that's it.

edited 2×, last 04.01.16 09:34:04 am
@
Mami Tomoe: No. He can simply put that code inside the
Rainoth's code, it wouldn't be such of a bother. I am pretty sure he knows how to.





