Advertisement
Guest User

Untitled

a guest
Aug 7th, 2011
1,818
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.41 KB | None | 0 0
  1. /*
  2. BASIC ADMIN SYSTEM...
  3. Version: 1.0
  4. This a Basic structure of an Admin System. You have to edit everything there is nothing set up.
  5.  
  6.  
  7.  
  8.  
  9. */
  10. #include <a_samp>
  11. #include <sscanf2>
  12. #include <zcmd>
  13. #define COLOR_WHITE 0xFFFFFFFF
  14. enum pInfo
  15. {
  16. pAdmin,
  17. pAdminDuty,
  18. }
  19. new PlayerInfo[MAX_PLAYERS][pInfo];
  20.  
  21.  
  22. new Levels[6][24] =
  23. {
  24. {
  25. "ADMIN LEVEL 1" //ADD THE NAME OF RANK 1 ADMIN
  26. },
  27. {
  28. "ADMIN LEVEL 2" //ADD THE NAME OF RANK 2 ADMIN
  29. },
  30. {
  31. "ADMIN LEVEL 3" //ADD THE NAME OF RANK 3 ADMIN
  32. },
  33. {
  34. "ADMIN LEVEL 4" //ADD THE NAME OF RANK 4 ADMIN
  35. },
  36. {
  37. "ADMIN LEVEL 5" //ADD THE NAME OF RANK 5 ADMIN
  38. },
  39. {
  40. "ADMIN LEVEL 6" //ADD THE NAME OF RANK 6 ADMIN
  41. }
  42. };
  43.  
  44. //NOTE: You can add more Rank names in it.
  45.  
  46.  
  47.  
  48.  
  49. #if defined FILTERSCRIPT
  50.  
  51. public OnFilterScriptInit()
  52. {
  53. print("\n--------------------------------------");
  54. print("Basic Admin System Loaded by: Harsimar Singh.");
  55. print("--------------------------------------\n");
  56. return 1;
  57. }
  58.  
  59. public OnFilterScriptExit()
  60. {
  61. return 1;
  62. }
  63.  
  64. #else
  65.  
  66. main()
  67. {
  68. print("\n----------------------------------");
  69. print("Basic Admin system unloaded by: Harsimar Singh.");
  70. print("----------------------------------\n");
  71. }
  72.  
  73. #endif
  74.  
  75.  
  76.  
  77. public OnPlayerRequestClass(playerid, classid)
  78. {
  79. SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
  80. SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
  81. SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
  82. return 1;
  83. }
  84.  
  85. public OnPlayerConnect(playerid)
  86. {
  87. SendClientMessage(playerid, COLOR_WHITE,"Basic Admin System by: Harsimar Singh. Type /bashelp");
  88. return 1;
  89. }
  90.  
  91. public OnPlayerDisconnect(playerid, reason)
  92. {
  93. return 1;
  94. }
  95.  
  96. public OnPlayerSpawn(playerid)
  97. {
  98. return 1;
  99. }
  100.  
  101. public OnPlayerDeath(playerid, killerid, reason)
  102. {
  103. return 1;
  104. }
  105.  
  106. public OnVehicleSpawn(vehicleid)
  107. {
  108. return 1;
  109. }
  110.  
  111. public OnVehicleDeath(vehicleid, killerid)
  112. {
  113. return 1;
  114. }
  115.  
  116. public OnPlayerText(playerid, text[])
  117. {
  118. return 1;
  119. }
  120.  
  121. public OnPlayerCommandText(playerid, cmdtext[])
  122. {
  123. if (strcmp("/mycommand", cmdtext, true, 10) == 0)
  124. {
  125. // Do something here
  126. return 1;
  127. }
  128. return 0;
  129. }
  130.  
  131. public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
  132. {
  133. return 1;
  134. }
  135.  
  136. public OnPlayerExitVehicle(playerid, vehicleid)
  137. {
  138. return 1;
  139. }
  140.  
  141. public OnPlayerStateChange(playerid, newstate, oldstate)
  142. {
  143. return 1;
  144. }
  145.  
  146. public OnPlayerEnterCheckpoint(playerid)
  147. {
  148. return 1;
  149. }
  150.  
  151. public OnPlayerLeaveCheckpoint(playerid)
  152. {
  153. return 1;
  154. }
  155.  
  156. public OnPlayerEnterRaceCheckpoint(playerid)
  157. {
  158. return 1;
  159. }
  160.  
  161. public OnPlayerLeaveRaceCheckpoint(playerid)
  162. {
  163. return 1;
  164. }
  165.  
  166. public OnRconCommand(cmd[])
  167. {
  168. return 1;
  169. }
  170.  
  171. public OnPlayerRequestSpawn(playerid)
  172. {
  173. return 1;
  174. }
  175.  
  176. public OnObjectMoved(objectid)
  177. {
  178. return 1;
  179. }
  180.  
  181. public OnPlayerObjectMoved(playerid, objectid)
  182. {
  183. return 1;
  184. }
  185.  
  186. public OnPlayerPickUpPickup(playerid, pickupid)
  187. {
  188. return 1;
  189. }
  190.  
  191. public OnVehicleMod(playerid, vehicleid, componentid)
  192. {
  193. return 1;
  194. }
  195.  
  196. public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
  197. {
  198. return 1;
  199. }
  200.  
  201. public OnVehicleRespray(playerid, vehicleid, color1, color2)
  202. {
  203. return 1;
  204. }
  205.  
  206. public OnPlayerSelectedMenuRow(playerid, row)
  207. {
  208. return 1;
  209. }
  210.  
  211. public OnPlayerExitedMenu(playerid)
  212. {
  213. return 1;
  214. }
  215.  
  216. public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
  217. {
  218. return 1;
  219. }
  220.  
  221. public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
  222. {
  223. return 1;
  224. }
  225.  
  226. public OnRconLoginAttempt(ip[], password[], success)
  227. {
  228. return 1;
  229. }
  230.  
  231. public OnPlayerUpdate(playerid)
  232. {
  233. return 1;
  234. }
  235.  
  236. public OnPlayerStreamIn(playerid, forplayerid)
  237. {
  238. return 1;
  239. }
  240.  
  241. public OnPlayerStreamOut(playerid, forplayerid)
  242. {
  243. return 1;
  244. }
  245.  
  246. public OnVehicleStreamIn(vehicleid, forplayerid)
  247. {
  248. return 1;
  249. }
  250.  
  251. public OnVehicleStreamOut(vehicleid, forplayerid)
  252. {
  253. return 1;
  254. }
  255.  
  256. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  257. {
  258. return 1;
  259. }
  260.  
  261. public OnPlayerClickPlayer(playerid, clickedplayerid, source)
  262. {
  263. return 1;
  264. }
  265.  
  266. //______________________________________________________________________________
  267.  
  268. /* COMMANDS */
  269. CMD:setadmin(playerid, params[])
  270. {
  271. new victimname[MAX_PLAYER_NAME], adminname[MAX_PLAYER_NAME], admlvl, id;
  272. if(IsPlayerAdmin(playerid) || PlayerInfo[playerid][pAdmin] >= 5) {
  273. if (sscanf(params, "ui", id, admlvl)) return SendClientMessage(playerid, COLOR_WHITE, "Usage: /setadmin [id] [adminlevel]");
  274. if (id == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_WHITE, "Invalid Player.");
  275. if (admlvl > 6 || admlvl < 0) return SendClientMessage(playerid, COLOR_WHITE,"Levels only from 1 - 6");
  276.  
  277. PlayerInfo[id][pAdmin] = admlvl;
  278. GetPlayerName(id, victimname, sizeof(victimname));
  279. GetPlayerName(playerid, adminname, sizeof(adminname));
  280. new str[128];
  281. format(str,128,"You have gave admin level %i to %s[ID %d]", admlvl, victimname, id);
  282. SendClientMessage(playerid, COLOR_WHITE, str);
  283.  
  284. format(str,128,"Admin %s[ID %d] gave you admin level %i", adminname, playerid, admlvl);
  285. SendClientMessage(id, COLOR_WHITE, str);
  286.  
  287. format(str,128,"Admin %s[ID %d] has set %s [ID %d] admin level to %i",adminname, playerid, victimname, id, admlvl);
  288. SendClientMessageToAll(COLOR_WHITE,str);
  289. return 1;
  290. }
  291. else return SendClientMessage(playerid,COLOR_WHITE,"You are not authorized to use that command.");
  292. }
  293.  
  294.  
  295.  
  296. CMD:aduty(playerid, params[])
  297. {
  298. new status[4];
  299. new name[MAX_PLAYER_NAME], string[128];
  300. if(PlayerInfo[playerid][pAdmin] < 1) return SendClientMessage(playerid, COLOR_WHITE,"You are not authorized to use that command.");
  301. if(sscanf(params,"s[4]",status))return SendClientMessage(playerid, COLOR_WHITE, "Usage: /a[dmin]duty [On/Off]");
  302. if(strcmp(status, "on", true) == 0) {
  303. if(PlayerInfo[playerid][pAdminDuty] == 0) {
  304. PlayerInfo[playerid][pAdminDuty] = 1;
  305. SetPlayerColor(playerid, COLOR_WHITE);
  306. GetPlayerName(playerid, name, sizeof(name));
  307. format(string, sizeof(string),"Admin %s is now on duty", name);
  308. SendClientMessageToAll(COLOR_WHITE, string);
  309. return SendClientMessage(playerid, COLOR_WHITE, "You are now admin duty On.");
  310. }
  311. else return SendClientMessage(playerid, COLOR_WHITE, "You are not off duty admin.");
  312. }
  313. if(strcmp(status, "off", true) == 0) {
  314. if(PlayerInfo[playerid][pAdminDuty] == 1) {
  315. PlayerInfo[playerid][pAdminDuty] = 0;
  316. SetPlayerColor(playerid, COLOR_WHITE);
  317. GetPlayerName(playerid, name, sizeof(name));
  318. format(string, sizeof(string),"Admin %s is now off duty", name);
  319. SendClientMessageToAll(COLOR_WHITE, string);
  320. return SendClientMessage(playerid, COLOR_WHITE, "You are now admin duty Off");
  321. }
  322. else return SendClientMessage(playerid, COLOR_WHITE, "You are not a on duty admin.");
  323. }
  324.  
  325. return 1;
  326. }
  327.  
  328.  
  329. CMD:admins(playerid, params[])
  330. {
  331. new pName[24],string2[128];
  332.  
  333. SendClientMessage(playerid, COLOR_WHITE,"__________________________");
  334. SendClientMessage(playerid, COLOR_WHITE,"Admin online:");
  335. for(new i = 0; i < MAX_PLAYERS; i++) {
  336. if(IsPlayerConnected(i)) {
  337. if(PlayerInfo[i][pAdmin] > 0) {
  338. GetPlayerName(i, pName, MAX_PLAYERS);
  339. format(string2, sizeof(string2), "%s: %s[ID %d] - %s",Levels[PlayerInfo[i][pAdmin]-1],pName,i,PlayerInfo[i][pAdminDuty] ? ("On Duty") : ("Off Duty"));
  340. if(PlayerInfo[i][pAdminDuty] == 0) {
  341. SendClientMessage(playerid, COLOR_WHITE, string2);
  342. }
  343. else {
  344. SendClientMessage(playerid, 0xFF0005FF, string2);
  345. SendClientMessage(playerid, COLOR_WHITE, "_________________________");
  346. }
  347. }
  348. }
  349. }
  350. return 1;
  351. }
  352. CMD:bashelp(playerid, params[])
  353. {
  354. SendClientMessage(playerid, COLOR_WHITE,"By Harsimar Singh");
  355. SendClientMessage(playerid, COLOR_WHITE,"/aduty, /admins, /setadmin");
  356. return 1;
  357. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement