· 8 years ago · Aug 01, 2018, 09:26 AM
1local con = dbConnect("sqlite", ":/registry.db")
2dbExec(con, "CREATE TABLE IF NOT EXISTS goTeam ('accountname','team')")
3
4AF = createTeam("Armed Forces")
5SWAT = createTeam("SWAT Team")
6Gov = createTeam("Government")
7
8AddAcc = {
9"AFODusty",
10"Kreature",
11"JosefMTD",
12"Gonzalomanya",
13"bossnico"
14}
15
16--AF Team
17function goAF (source, commandName)
18qh1 = dbQuery(con, "SELECT getPlayerAccount(source), af FROM goTeam")
19result = dbPoll( qh1, 0 )
20 if result == false then
21 outputChatBox("You don't have access to this command", source)
22 elseif result == nil then
23 outputChatBox("Try again in a few secs", source)
24 else
25 if ( getPlayerWantedLevel ( source ) < 3 ) then
26 setPlayerTeam ( source, AF )
27 setElementData( source, "o", "Armed Forces")
28 setElementModel ( source, 287 )
29 outputServerLog ( getPlayerName ( source ) .. " went to AF job with wanted level: " .. getPlayerWantedLevel ( source ))
30 else
31 outputChatBox("Your wanted level is too high", source)
32 end
33 end
34end
35
36addCommandHandler("goaf", goAF)
37
38--SWAT Team
39function goSWAT (source, commandName)
40qh2 = dbQuery(con, "SELECT getPlayerAccount(source), swat FROM goTeam")
41result = dbPoll( qh2, 0 )
42 if result == false then
43 outputChatBox("You don't have access to this command", source)
44 elseif result == nil then
45 outputChatBox("Try again in a few secs", source)
46 else
47 if ( getPlayerWantedLevel ( source ) < 3 ) then
48 setPlayerTeam ( source, SWAT )
49 setPlayerNametagColor ( source, 65, 105, 225 )
50 setElementData( source, "o", "SWAT Team")
51 setElementModel ( source, 285 )
52 outputServerLog ( getPlayerName ( source ) .. " went to SWAT job with wanted level: " .. getPlayerWantedLevel ( source ))
53 else
54 outputChatBox("Your wanted level is too high", source)
55 end
56 end
57end
58
59addCommandHandler("goswat", goSWAT)
60
61--FBI Team
62function goFBI (source, commandName)
63qh3 = dbQuery(con, "SELECT getPlayerAccount(source), fbi FROM goTeam")
64result = dbPoll( qh3, 0 )
65 if result == false then
66 outputChatBox("You don't have access to this command", source)
67 elseif result == nil then
68 outputChatBox("Try again in a few secs", source)
69 else
70 if ( getPlayerWantedLevel ( source ) < 3 ) then
71 setPlayerTeam ( source, Gov )
72 setPlayerNametagColor ( source, 52, 52, 51 )
73 setElementData( source, "o", "Federal Agent")
74 setElementModel ( source, 286 )
75 outputServerLog ( getPlayerName ( source ) .. " went to FBI job with wanted level: " .. getPlayerWantedLevel ( source ))
76 else
77 outputChatBox("Your wanted level is too high", source)
78 end
79 end
80end
81
82addCommandHandler("gofbi", goFBI)
83
84--SAPD Team
85function goSAPD (source, commandName)
86qh4 = dbQuery(con, "SELECT getPlayerAccount(source), sapd FROM goTeam")
87result = dbPoll( qh4, 0 )
88 if result == false then
89 outputChatBox("You don't have access to this command", source)
90 elseif result == nil then
91 outputChatBox("Try again in a few secs", source)
92 else
93 if ( getPlayerWantedLevel ( source ) < 3 ) then
94 setPlayerTeam ( source, Gov )
95 setPlayerNametagColor ( source, 52, 52, 51 )
96 setElementData( source, "o", "SAPD Officer")
97 outputServerLog ( getPlayerName ( source ) .. " went to SAPD job with wanted level: " .. getPlayerWantedLevel ( source ))
98 else
99 outputChatBox("Your wanted level is too high", source)
100 end
101 end
102end
103
104addCommandHandler("gosapd", goSAPD)
105
106--give access to goAF/goSWAT/goFBI/goSAPD
107function addgoaf(source, commandname, name)
108 if getPlayerFromName(name) then
109 if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(source)), aclGetGroup("L5")) or getAccountName(getPlayerAccount(source)) == AddAcc then
110 dbExec(con, "INSERT INTO goTeam VALUES (?, ?)", af, getPlayerAccount(getPlayerFromName(name)))
111 outputChatBox("Added", source)
112 outputServerLog ( getPlayerName ( source ) .. " added /goaf for " .. name)
113 end
114 end
115end
116addCommandHandler("addgoaf", addgoaf)
117
118function addgoswat(source, commandname, name)
119 if getPlayerFromName(name) then
120 if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(source)), aclGetGroup("L5")) or getAccountName(getPlayerAccount(source)) == "Dusty" then
121 dbExec(con, "INSERT INTO goTeam VALUES (?, ?)", swat,getPlayerAccount(getPlayerFromName(name)))
122 outputChatBox("Added", source)
123 outputServerLog ( getPlayerName ( source ) .. " added /goswat for " .. name)
124 end
125 end
126end
127addCommandHandler("addgoswat", addgoswat)
128
129function addgofbi(source, commandname, name)
130 if getPlayerFromName(name) then
131 if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(source)), aclGetGroup("L5")) or getAccountName(getPlayerAccount(source)) == "Dusty" then
132 dbExec(con, "INSERT INTO goTeam VALUES (?, ?)", fbi,getPlayerAccount(getPlayerFromName(name)))
133 outputChatBox("Added", source)
134 outputServerLog ( getPlayerName ( source ) .. " added /gofbi for " .. name)
135 end
136 end
137end
138addCommandHandler("addgofbi", addgofbi)
139
140function addgosapd(source, commandname, name)
141 if getPlayerFromName(name) then
142 if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(source)), aclGetGroup("L5")) or getAccountName(getPlayerAccount(source)) == "Dusty" then
143 dbExec(con, "INSERT INTO goTeam VALUES (?, ?)", sapd,getPlayerAccount(getPlayerFromName(name)))
144 outputChatBox("Added", source)
145 outputServerLog ( getPlayerName ( source ) .. " added /gosapd for " .. name)
146 end
147 end
148end
149addCommandHandler("addgosapd", addgosapd)