English 2 hours = Vip

10 replies
Goto Page
To the start Previous 1 Next To the start
03.01.16 11:58:36 am
Up
Ali security
User
Offline Off
Hi guys!

please help me.

2hours = vip

giving code and thx all
Security.
03.01.16 12:26:39 pm
Up
Rainoth
Moderator
Offline Off
Code:
1
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


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
03.01.16 01:03:42 pm
Up
Dousea
User
Offline Off
@user 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.
03.01.16 01:14:55 pm
Up
Cure Pikachu
User
Offline Off
@user Rainoth: Fixed.
Code:
1
2
3
function _t(id,t)
     if not p[id] then p[id] = 0 end
end
IMG:https://i.imgur.com/DeSeUxC.png
IMG:https://i.imgur.com/xpsyQRX.png
03.01.16 01:43:36 pm
Up
Dousea
User
Offline Off
Will do the same as user Rainoth's.
Code:
1
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
I'm awesome ... and I really like cookies.
03.01.16 01:52:16 pm
Up
Avo
User
Offline Off
I believe
Code:
1
p[id] = (p[id] or 0)

would work as well

Edit: sorry for being Slowpoke.
Trust me, I'm an engineer | user DC approved file cs2d Super extra mod for CS2D (64), yeah!
03.01.16 07:26:33 pm
Up
Slooper 1
BANNED
Offline Off
@user Dousea:
@user Rainoth:
@user:
That's work for me
Multiple account of Ya_Bogalb (a.k.a TN Anonymous)
03.01.16 08:35:45 pm
Up
Ali security
User
Offline Off
thx all, but
©255255255[VIP]
Please TAG
--
thx.
Security.
03.01.16 08:58:48 pm
Up
GeoB99
Moderator
Offline Off
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.
Code:
1
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")

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.
edited 2×, last 04.01.16 09:34:04 am
04.01.16 04:41:51 pm
Up
Mami Tomoe
User
Offline Off
@user GeoB99: you also forgot to make it work with the 2 hours thing

idk if he will mind tho
It's hard being the best girl in the whole entire world
04.01.16 04:47:08 pm
Up
GeoB99
Moderator
Offline Off
@user Mami Tomoe: No. He can simply put that code inside the user Rainoth's code, it wouldn't be such of a bother. I am pretty sure he knows how to.
To the start Previous 1 Next To the start