English ADD & REMOVE VIP

21 replies
Goto Page
To the start Previous 1 2 Next To the start
08.10.12 06:37:02 pm
Up
SektoR_
User
Offline Off
Hi all! I'm here again to ask how do I add a command @addvip <usgn> or <id> (vip to add to the server) and @removevip <usgn> or <id> (to remove vip). Not forgetting that the vip will have rights to some skins and others.

Please show me how!
08.10.12 06:49:14 pm
Up
Sweet Death
User
Offline Off
You need a lua script like this one: http://www.unrealsoftware.de/files_show.php?file=6847
08.10.12 07:26:20 pm
Up
Yates
Reviewer
Offline Off
user Sweet Death has written:
You need a lua script like this one: http://www.unrealsoftware.de/files_show.php?file=6847

You need to actually help people instead of suggesting the shittiest administration scripts uploaded here.
08.10.12 07:42:05 pm
Up
Gaios
Reviewer
Offline Off
I make script later.
08.10.12 09:15:34 pm
Up
sheeL
User
Offline Off
My script Have the command :
@give_vip [USGN]
@remove_vip [USGN]

http://unrealsoftware.de/files_show.php?file=11132
08.10.12 10:36:06 pm
Up
Gaios
Reviewer
Offline Off
user SektoR_ has written:
Hi all! I'm here again to ask how do I add a command @addvip <usgn> or <id> (vip to add to the server) and @removevip <usgn> or <id> (to remove vip). Not forgetting that the vip will have rights to some skins and others.

Please show me how!

@user SektoR_I'll do all the code for you if you give me something in return.

Code:
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
function Array(s,v)
     local a = {}
     for i = 1,s do
          a[i] = v
     end
     return a
end
vip = Array(32,0)

function LoadAccount(id)
     local usgn = player(id,"usgn")
     if usgn > 0 then
          local file = io.open("sys/lua/"..usgn..".txt","r")
          if file then
               vip[id] = tonumber(file:read());
          end
     end
end

function SaveAccount(id,level)
     local usgn = player(id,"usgn")
     if usgn > 0 then
          local file = io.open("sys/lua/"..usgn..".txt","w")
          file:write(level)
          file:close()
     end
end

addhook("join","_joinHook")
function _joinHook(id)
     vip[id] = 0
     LoadAccount(id)
     if vip[id] == 1 then
          msg2(id,"©000255000You are VIP!@C")
     end
end

addhook("say","_sayHook")
function _sayHook(id,txt)
for pl = 1,32 do
     if txt == "!addvip "..pl.."" then
          vip[pl] = 1
          SaveAccount(pl,1)
          return 1
     elseif txt == "!removevip "..pl.."" then
          vip[pl] = 0
          SaveAccount(pl,0)
          return 1
     end
end
end
edited 1×, last 09.10.12 02:06:48 pm
09.10.12 02:14:04 pm
Up
Suprise
BANNED
Offline Off
Better if you make a folder to every Usgn. Otherwise lua folder will get spammed!
09.10.12 02:24:15 pm
Up
Gaios
Reviewer
Offline Off
user Suprise has written:
Better if you make a folder to every Usgn. Otherwise lua folder will get spammed!


Let him add folder.
edit for SaveAccount and LoadAccount change:
Code:
1
2
local file = io.open("sys/lua/"..usgn..".txt","r")
local file = io.open("sys/lua/"..usgn..".txt","w")

on
Code:
1
2
local file = io.open("sys/lua/saves/"..usgn..".txt","r")
local file = io.open("sys/lua/saves/"..usgn..".txt","w")


You must create folder: saves
09.10.12 05:15:53 pm
Up
Suprise
BANNED
Offline Off
@user Gaios: Also better not add vip if he is already, don't you think?^^

Change this:
Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
addhook("say","_sayHook")
function _sayHook(id,txt)
for pl = 1,32 do
     if txt == "!addvip "..pl.."" then
          vip[pl] = 1
          SaveAccount(pl,1)
          return 1
     elseif txt == "!removevip "..pl.."" then
          vip[pl] = 0
          SaveAccount(pl,0)
          return 1
     end
end
end


to

Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
addhook("say","_sayHook")
function _sayHook(id,txt)
     for pl = 1,32 do
          if txt == "!addvip "..pl.."" then
               if vip[pl] == 0 then
                    vip[pl] = 1
                    SaveAccount(pl,1)
                    msg2(pl,"©255255255You're now VIP!")
                    return 1
               else
                    msg2(id,"©255000000Error: The player you wanted to add is already VIP!")
               end
          elseif txt == "!removevip "..pl.."" then
               if vip[pl] == 1 then
                    vip[pl] = 0
                    SaveAccount(pl,0)
                    msg2(pl,"©255255255Your vip status has been removed!")
                    return 1
               else
                    msg2(id,"©255000000Error: This guy is NOT VIP!")
               end
          end
     end
end


This looks better
13.10.12 01:54:10 am
Up
SektoR_
User
Offline Off
@user Gaios and @user Suprise: Thanks! But as I'll add commands to it? How menu and others?
edited 1×, last 13.10.12 04:07:19 am
13.10.12 04:56:07 am
Up
sheeL
User
Offline Off
See, only a bit example

Code:
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
addhook("serveraction","a")
function a(if,a)
     if a == 1 then
          if vip[id] == 1 then
          menu(id,"Test,A,B,C")
          else
          msg2(id,"©255255255Error, Only VIP Acess the Menu !")
          end
     end
end

addhook("menu","b")
function b(id,t,b)
     if t == "Test" then 
          if b == 1 then
               msg("123")
          elseif b == 2 then
               msg("1234")
          elseif b == 3 then
               msg("12345")
          end
     end
end

addhook("say","c") 
function c(id,t
          if vip[id] == 1 then 
               if t == "!on"
               msg("©255255255 VIP : "..player(id,"name").." ON.")
          else
               msg2(id,"©255255255 Error, Commands Only to Vips")
               return 1
          end
     end
end
edited 1×, last 09.11.14 07:14:42 pm
13.10.12 05:18:23 am
Up
SektoR_
User
Offline Off
Thanks @user sheeL! I was just wondering lines 4 and 27!
13.10.12 07:33:38 am
Up
Suprise
BANNED
Offline Off
I tab'd it if you don't mind
And changed some things in it.

Code:
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
addhook("serveraction","_action")
function _action(id,action)
     if action == 1 then
          if vip[id] == 1 then
               menu(id,"Test,A,B,C") -- THE MENU
          else
                  --It's pointless to put Error text, in my opinon.
          end
     end
end

addhook("menu","_menu")
function _menu(id,title,button)
     if title == "Test" then -- TITTLE OF MENU
          if button == 1 then -- B = BUTTONS IN MENU
               msg("123") --You can use menu(id,"Test2") too!
          elseif button == 2 then
               msg("1234")
          elseif button == 3 then
               msg("12345")
          end
     end
end

addhook("say","_say")
function _say(id,t)
     if t == "!on" then
          if vip[id] == 1 then
               msg("©255255255"..player(id,"name").." |VIP| "..txt)
               return 1
          else
               msg2(id,"©255255255This command is only for Vip/Admin!")
          end
     end
end
13.10.12 12:49:43 pm
Up
adamCSzombie
GAME BANNED
Offline Off
This is for NO COMENT
16.10.12 01:54:36 am
Up
SektoR_
User
Offline Off
@user Suprise - @user Gaios: When executed, this error appears: [...]:861: attempt to call field 'open' (a nil value)

The 861 line is this:
Code:
1
local file = io.open("sys/lua/OCP 2.0/OCP config/"..usgn..".txt","r")


What to do?
16.10.12 02:27:36 am
Up
sheeL
User
Offline Off
user SektoR_ has written:
@user Suprise - @user Gaios: When executed, this error appears: [...]:861: attempt to call field 'open' (a nil value)

The 861 line is this:
Code:
1
local file = io.open("sys/lua/OCP 2.0/OCP config/"..usgn..".txt","r")


What to do?


Post the Script complete...
16.10.12 04:08:42 am
Up
SektoR_
User
Offline Off
user sheeL has written:
user SektoR_ has written:
@user Suprise - @user Gaios: When executed, this error appears: [...]:861: attempt to call field 'open' (a nil value)

The 861 line is this:
Code:
1
local file = io.open("sys/lua/OCP 2.0/OCP config/"..usgn..".txt","r")


What to do?


Post the Script complete...


Look there!
Recalling that is giving the error on line 33.

Code:
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
list_adm = {00000}


--                   ADM

function ADMS(id)
     for _, usgn in ipairs(list_adm) do
          if (player(id,"usgn") == usgn) then
               return true
          end
     end
     return false
end


--                  ARRAY

function initArray(m)
local array = {}
     for i = 1, m do array[i]=0
     end
return array
end


--                   CODE

vip = initArray(32,0)

function LoadAccount(id)
     local usgn = player(id,"usgn")
     if usgn > 0 then
          local file = io.open("sys/lua/OCP 2.0/OCP config/"..usgn..".txt","r") -- Line error.
          if file then
               vip[id] = tonumber(file:read());
          end
     end
end

function SaveAccount(id,level)
     local usgn = player(id,"usgn")
     if usgn > 0 then
          local file = io.open("sys/lua/OCP 2.0/OCP config/"..usgn..".txt","w")
          file:write(level)
          file:close()
     end
end

addhook("join","_joinHook")
function _joinHook(id)
     vip[id] = 0
     LoadAccount(id)
     if vip[id] == 1 then
          msg2(id,"©000255000You are VIP!@C")
     end
end

addhook("say","_sayHook")
function _sayHook(id,txt)
          if ADMS(id) then
     for pl = 1,32 do
          if txt == "!addvip "..pl.."" then
               if vip[pl] == 0 then
                    vip[pl] = 1
                    SaveAccount(pl,1)
                    msg2(pl,"©255255255You're now VIP!")
                    return 1
               else
                    msg2(id,"©255000000Error: The player you wanted to add is already VIP!")
               end
          elseif txt == "!removevip "..pl.."" then
               if vip[pl] == 1 then
                    vip[pl] = 0
                    SaveAccount(pl,0)
                    msg2(pl,"©255255255Your vip status has been removed!")
                    return 1
               else
                    msg2(id,"©255000000Error: This guy is NOT VIP!")
               end
          end
     end
      end -- if ADMS
end
edited 1×, last 16.10.12 04:20:29 am
16.10.12 06:56:37 am
Up
Gaios
Reviewer
Offline Off
Spoiler >


Maybe, you dont have folder OCP 2.0 and OCP Config.
When I am going to computer, then I fix the bug.
16.10.12 01:24:31 pm
Up
IPC CS2D
User
Offline Off
I read that all,
Thanks for information.
Even if someone says it's piece of shit, just don't listen to them ~ Factis Words.
17.10.12 07:05:08 pm
Up
SektoR_
User
Offline Off
user Gaios has written:
Spoiler >


Maybe, you dont have folder OCP 2.0 and OCP Config.
When I am going to computer, then I fix the bug.


But I created the folder!
To the start Previous 1 2 Next To the start