Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- BASIC ADMIN SYSTEM...
- Version: 1.0
- This a Basic structure of an Admin System. You have to edit everything there is nothing set up.
- */
- #include <a_samp>
- #include <sscanf2>
- #include <zcmd>
- #define COLOR_WHITE 0xFFFFFFFF
- enum pInfo
- {
- pAdmin,
- pAdminDuty,
- }
- new PlayerInfo[MAX_PLAYERS][pInfo];
- new Levels[6][24] =
- {
- {
- "ADMIN LEVEL 1" //ADD THE NAME OF RANK 1 ADMIN
- },
- {
- "ADMIN LEVEL 2" //ADD THE NAME OF RANK 2 ADMIN
- },
- {
- "ADMIN LEVEL 3" //ADD THE NAME OF RANK 3 ADMIN
- },
- {
- "ADMIN LEVEL 4" //ADD THE NAME OF RANK 4 ADMIN
- },
- {
- "ADMIN LEVEL 5" //ADD THE NAME OF RANK 5 ADMIN
- },
- {
- "ADMIN LEVEL 6" //ADD THE NAME OF RANK 6 ADMIN
- }
- };
- //NOTE: You can add more Rank names in it.
- #if defined FILTERSCRIPT
- public OnFilterScriptInit()
- {
- print("\n--------------------------------------");
- print("Basic Admin System Loaded by: Harsimar Singh.");
- print("--------------------------------------\n");
- return 1;
- }
- public OnFilterScriptExit()
- {
- return 1;
- }
- #else
- main()
- {
- print("\n----------------------------------");
- print("Basic Admin system unloaded by: Harsimar Singh.");
- print("----------------------------------\n");
- }
- #endif
- public OnPlayerRequestClass(playerid, classid)
- {
- SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
- SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
- SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
- return 1;
- }
- public OnPlayerConnect(playerid)
- {
- SendClientMessage(playerid, COLOR_WHITE,"Basic Admin System by: Harsimar Singh. Type /bashelp");
- return 1;
- }
- public OnPlayerDisconnect(playerid, reason)
- {
- return 1;
- }
- public OnPlayerSpawn(playerid)
- {
- return 1;
- }
- public OnPlayerDeath(playerid, killerid, reason)
- {
- return 1;
- }
- public OnVehicleSpawn(vehicleid)
- {
- return 1;
- }
- public OnVehicleDeath(vehicleid, killerid)
- {
- return 1;
- }
- public OnPlayerText(playerid, text[])
- {
- return 1;
- }
- public OnPlayerCommandText(playerid, cmdtext[])
- {
- if (strcmp("/mycommand", cmdtext, true, 10) == 0)
- {
- // Do something here
- return 1;
- }
- return 0;
- }
- public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
- {
- return 1;
- }
- public OnPlayerExitVehicle(playerid, vehicleid)
- {
- return 1;
- }
- public OnPlayerStateChange(playerid, newstate, oldstate)
- {
- return 1;
- }
- public OnPlayerEnterCheckpoint(playerid)
- {
- return 1;
- }
- public OnPlayerLeaveCheckpoint(playerid)
- {
- return 1;
- }
- public OnPlayerEnterRaceCheckpoint(playerid)
- {
- return 1;
- }
- public OnPlayerLeaveRaceCheckpoint(playerid)
- {
- return 1;
- }
- public OnRconCommand(cmd[])
- {
- return 1;
- }
- public OnPlayerRequestSpawn(playerid)
- {
- return 1;
- }
- public OnObjectMoved(objectid)
- {
- return 1;
- }
- public OnPlayerObjectMoved(playerid, objectid)
- {
- return 1;
- }
- public OnPlayerPickUpPickup(playerid, pickupid)
- {
- return 1;
- }
- public OnVehicleMod(playerid, vehicleid, componentid)
- {
- return 1;
- }
- public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
- {
- return 1;
- }
- public OnVehicleRespray(playerid, vehicleid, color1, color2)
- {
- return 1;
- }
- public OnPlayerSelectedMenuRow(playerid, row)
- {
- return 1;
- }
- public OnPlayerExitedMenu(playerid)
- {
- return 1;
- }
- public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
- {
- return 1;
- }
- public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
- {
- return 1;
- }
- public OnRconLoginAttempt(ip[], password[], success)
- {
- return 1;
- }
- public OnPlayerUpdate(playerid)
- {
- return 1;
- }
- public OnPlayerStreamIn(playerid, forplayerid)
- {
- return 1;
- }
- public OnPlayerStreamOut(playerid, forplayerid)
- {
- return 1;
- }
- public OnVehicleStreamIn(vehicleid, forplayerid)
- {
- return 1;
- }
- public OnVehicleStreamOut(vehicleid, forplayerid)
- {
- return 1;
- }
- public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
- {
- return 1;
- }
- public OnPlayerClickPlayer(playerid, clickedplayerid, source)
- {
- return 1;
- }
- //______________________________________________________________________________
- /* COMMANDS */
- CMD:setadmin(playerid, params[])
- {
- new victimname[MAX_PLAYER_NAME], adminname[MAX_PLAYER_NAME], admlvl, id;
- if(IsPlayerAdmin(playerid) || PlayerInfo[playerid][pAdmin] >= 5) {
- if (sscanf(params, "ui", id, admlvl)) return SendClientMessage(playerid, COLOR_WHITE, "Usage: /setadmin [id] [adminlevel]");
- if (id == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_WHITE, "Invalid Player.");
- if (admlvl > 6 || admlvl < 0) return SendClientMessage(playerid, COLOR_WHITE,"Levels only from 1 - 6");
- PlayerInfo[id][pAdmin] = admlvl;
- GetPlayerName(id, victimname, sizeof(victimname));
- GetPlayerName(playerid, adminname, sizeof(adminname));
- new str[128];
- format(str,128,"You have gave admin level %i to %s[ID %d]", admlvl, victimname, id);
- SendClientMessage(playerid, COLOR_WHITE, str);
- format(str,128,"Admin %s[ID %d] gave you admin level %i", adminname, playerid, admlvl);
- SendClientMessage(id, COLOR_WHITE, str);
- format(str,128,"Admin %s[ID %d] has set %s [ID %d] admin level to %i",adminname, playerid, victimname, id, admlvl);
- SendClientMessageToAll(COLOR_WHITE,str);
- return 1;
- }
- else return SendClientMessage(playerid,COLOR_WHITE,"You are not authorized to use that command.");
- }
- CMD:aduty(playerid, params[])
- {
- new status[4];
- new name[MAX_PLAYER_NAME], string[128];
- if(PlayerInfo[playerid][pAdmin] < 1) return SendClientMessage(playerid, COLOR_WHITE,"You are not authorized to use that command.");
- if(sscanf(params,"s[4]",status))return SendClientMessage(playerid, COLOR_WHITE, "Usage: /a[dmin]duty [On/Off]");
- if(strcmp(status, "on", true) == 0) {
- if(PlayerInfo[playerid][pAdminDuty] == 0) {
- PlayerInfo[playerid][pAdminDuty] = 1;
- SetPlayerColor(playerid, COLOR_WHITE);
- GetPlayerName(playerid, name, sizeof(name));
- format(string, sizeof(string),"Admin %s is now on duty", name);
- SendClientMessageToAll(COLOR_WHITE, string);
- return SendClientMessage(playerid, COLOR_WHITE, "You are now admin duty On.");
- }
- else return SendClientMessage(playerid, COLOR_WHITE, "You are not off duty admin.");
- }
- if(strcmp(status, "off", true) == 0) {
- if(PlayerInfo[playerid][pAdminDuty] == 1) {
- PlayerInfo[playerid][pAdminDuty] = 0;
- SetPlayerColor(playerid, COLOR_WHITE);
- GetPlayerName(playerid, name, sizeof(name));
- format(string, sizeof(string),"Admin %s is now off duty", name);
- SendClientMessageToAll(COLOR_WHITE, string);
- return SendClientMessage(playerid, COLOR_WHITE, "You are now admin duty Off");
- }
- else return SendClientMessage(playerid, COLOR_WHITE, "You are not a on duty admin.");
- }
- return 1;
- }
- CMD:admins(playerid, params[])
- {
- new pName[24],string2[128];
- SendClientMessage(playerid, COLOR_WHITE,"__________________________");
- SendClientMessage(playerid, COLOR_WHITE,"Admin online:");
- for(new i = 0; i < MAX_PLAYERS; i++) {
- if(IsPlayerConnected(i)) {
- if(PlayerInfo[i][pAdmin] > 0) {
- GetPlayerName(i, pName, MAX_PLAYERS);
- format(string2, sizeof(string2), "%s: %s[ID %d] - %s",Levels[PlayerInfo[i][pAdmin]-1],pName,i,PlayerInfo[i][pAdminDuty] ? ("On Duty") : ("Off Duty"));
- if(PlayerInfo[i][pAdminDuty] == 0) {
- SendClientMessage(playerid, COLOR_WHITE, string2);
- }
- else {
- SendClientMessage(playerid, 0xFF0005FF, string2);
- SendClientMessage(playerid, COLOR_WHITE, "_________________________");
- }
- }
- }
- }
- return 1;
- }
- CMD:bashelp(playerid, params[])
- {
- SendClientMessage(playerid, COLOR_WHITE,"By Harsimar Singh");
- SendClientMessage(playerid, COLOR_WHITE,"/aduty, /admins, /setadmin");
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement