Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*-----------------------------------*\
- ) Dragon Admin System - Dadmin (
- ) Modify All You Like For Your Server (
- ) Do Not Re-Release Modded Version (
- \*-----------------------------------*/
- #include <a_samp>
- #define FILTERSCRIPT
- #if defined FILTERSCRIPT
- #define green 0x33FF33AA
- #define red 0xFF0000AA
- #define yellow 0xFFFF00AA
- #define blue 0x2641FEAA
- new AdminLvl[MAX_PLAYERS];
- new Wired[MAX_PLAYERS];
- new Jailed[MAX_PLAYERS];
- public OnFilterScriptInit()
- {
- print(" ---------------------------------------------------- ");
- print(" Dragons admin system version one point five loaded ");
- print(" /Acmds for more information ");
- print(" ---------------------------------------------------- ");
- return 1;
- }
- #endif
- public OnPlayerConnect(playerid)
- {
- AdminLvl[playerid] = 0;
- Wired[playerid] = 0;
- Jailed[playerid] = 0;
- return 1;
- }
- public OnPlayerDisconnect(playerid, reason)
- {
- AdminLvl[playerid] = 0;
- Wired[playerid] = 0;
- Jailed[playerid] = 0;
- return 1;
- }
- public OnPlayerText(playerid, text[])
- {
- if(Wired[playerid] == 0)
- {
- return 1;
- }
- else
- {
- return 0;
- }
- }
- public OnPlayerPrivmsg(playerid, recieverid, text[])
- {
- new pname[26];
- new oname[26];
- new str[256];
- GetPlayerName(playerid, pname, sizeof(pname));
- GetPlayerName(recieverid, oname, sizeof(oname));
- format(str, 256, "(( Message from %s to %s: %s ))", pname, oname, text[0]);
- for(new i = 0; i < MAX_PLAYERS; i++)
- {
- if(IsPlayerConnected(i))
- {
- if(AdminLvl[i] == 1)
- {
- SendClientMessage(i, green, str);
- }
- }
- }
- return 1;
- }
- public OnPlayerCommandText(playerid, cmdtext[])
- {
- if(Jailed[playerid] == 1) return SendClientMessage(playerid, red, "You can not use commands");
- new cmd[256], idx;
- cmd = strtok(cmdtext, idx);
- new id;
- new tmp[256];
- new pname[26];
- new oname[26];
- new string[100];
- GetPlayerName(playerid, pname, sizeof(pname));
- if (strcmp("/acmds", cmdtext, true) == 0)
- {
- if(AdminLvl[playerid] == 1)
- {
- AdminLvl[playerid] = 0;
- SendClientMessage(playerid, green, "/kick, /ban, /gmx, /freeze, /unfreeze");
- SendClientMessage(playerid, green, "/goto, /gethere, /v, /ann, /explode, /a");
- SendClientMessage(playerid, green, "/getall, /explodeall, /jail, /unjail");
- SendClientMessage(playerid, green, "/wire, /unwire, /crash, /akill, /an");
- SendClientMessage(playerid, green, "/disable, /reable");
- }
- else return SendClientMessage(playerid, red, "You are not an admin");
- return 1;
- }
- if(!strcmp(cmd, "/admins", true))
- {
- SendClientMessage(playerid, green, "Admins online:");
- for(new i = 0; i < MAX_PLAYERS; i++)
- {
- if(IsPlayerConnected(i))
- {
- if(AdminLvl[i] == 1)
- {
- new str[256];
- new pnamep[24];
- GetPlayerName(i, pnamep, 24);
- format(str, 256, "Admin %s", pnamep);
- SendClientMessage(playerid, green, str);
- }
- }
- }
- return 1;
- }
- if (strcmp("/alogin PASSWORD", cmdtext, true) == 0)
- {
- if(AdminLvl[playerid] == 1) return SendClientMessage(playerid, red, "You are already an admin");
- else if(AdminLvl[playerid] == 0)
- {
- AdminLvl[playerid] = 1;
- SendClientMessage(playerid, yellow, "You have logged into admin");
- format(string, sizeof(string), "%s has loged into admin", pname);
- printf(string);
- }
- return 1;
- }
- if (strcmp("/alogout", cmdtext, true) == 0)
- {
- if(AdminLvl[playerid] == 0) return SendClientMessage(playerid, red, "You are not an admin");
- else if(AdminLvl[playerid] == 1)
- {
- AdminLvl[playerid] = 0;
- SendClientMessage(playerid, yellow, "You have logged out of admin");
- format(string, sizeof(string), "%s has logged out of admin", pname);
- printf(string);
- }
- return 1;
- }
- if(!strcmp(cmd, "/ban", true))
- {
- if(AdminLvl[playerid] == 1)
- {
- tmp = strtok(cmdtext, idx);
- if(!strlen(tmp)) return SendClientMessage(playerid, red, "You didn't put in an id");
- id = strval(tmp);
- GetPlayerName(id, oname, sizeof(oname));
- format(string, sizeof(string), "%s (%d) has been banned from the server by %s", oname, id, pname);
- SendClientMessageToAll(red, string);
- print(string);
- Ban(id);
- }
- else return SendClientMessage(playerid, red, "You are not an admin");
- return 1;
- }
- if(!strcmp(cmd, "/kick", true))
- {
- if(AdminLvl[playerid] == 1)
- {
- tmp = strtok(cmdtext, idx);
- if(!strlen(tmp)) return SendClientMessage(playerid, red, "You didn't put in an id");
- id = strval(tmp);
- GetPlayerName(id, oname, sizeof(oname));
- format(string, sizeof(string), "%s (%d) has been kicked from the server by %s", oname, id, pname);
- SendClientMessageToAll(red, string);
- print(string);
- Kick(id);
- }
- else return SendClientMessage(playerid, red, "You are not an admin");
- return 1;
- }
- if(!strcmp(cmd, "/exit", true))
- {
- if(AdminLvl[playerid] == 1)
- {
- format(string, sizeof(string), "%s has shut down the server", pname);
- SendClientMessageToAll(yellow, string);
- print(string);
- SendRconCommand("exit");
- }
- else return SendClientMessage(playerid, red, "You are not an admin");
- return 1;
- }
- if(!strcmp(cmd, "/gmx", true))
- {
- if(AdminLvl[playerid] == 1)
- {
- format(string, sizeof(string), "%s has restarted the server", pname);
- SendClientMessageToAll(yellow, string);
- print(string);
- SendRconCommand("gmx");
- }
- else return SendClientMessage(playerid, red, "You are not an admin");
- return 1;
- }
- if(!strcmp(cmd, "/freeze", true))
- {
- if(AdminLvl[playerid] == 1)
- {
- tmp = strtok(cmdtext, idx);
- if(!strlen(tmp)) return SendClientMessage(playerid, red, "You didn't put in an id");
- id = strval(tmp);
- GetPlayerName(id, oname, sizeof(oname));
- format(string, sizeof(string), "You have frozen %s (id %d)", oname, id);
- SendClientMessage(playerid, yellow, string);
- SendClientMessage(id, yellow, "You have been frozen");
- TogglePlayerControllable(id, 0);
- format(string, sizeof(string), "%s has frozen %s", pname, oname);
- print(string);
- }
- else return SendClientMessage(playerid, red, "You are not an admin");
- return 1;
- }
- if(!strcmp(cmd, "/unfreeze", true))
- {
- if(AdminLvl[playerid] == 1)
- {
- tmp = strtok(cmdtext, idx);
- if(!strlen(tmp)) return SendClientMessage(playerid, red, "You didn't put in an id");
- id = strval(tmp);
- GetPlayerName(id, oname, sizeof(oname));
- format(string, sizeof(string), "You have frozen %s (id %d)", oname, id);
- SendClientMessage(playerid, yellow, string);
- SendClientMessage(id, yellow, "You have been unfrozen");
- TogglePlayerControllable(id, 1);
- format(string, sizeof(string), "%s has unfrozen %s", pname, oname);
- print(string);
- }
- else return SendClientMessage(playerid, red, "You are not an admin");
- return 1;
- }
- if(!strcmp(cmd, "/goto", true))
- {
- if(AdminLvl[playerid] == 1)
- {
- tmp = strtok(cmdtext, idx);
- if(!strlen(tmp)) return SendClientMessage(playerid, red, "You didn't put in an id");
- id = strval(tmp);
- new Float:x, Float:y, Float:z;
- GetPlayerPos(id, x, y, z);
- SetPlayerPos(playerid, x+1, y, z);
- GetPlayerName(id, oname, sizeof(oname));
- format(string, sizeof(string), "You have teleported to %s (id %d)", oname, id);
- SendClientMessage(playerid, yellow, string);
- format(string, sizeof(string), "%s has teleported to %s", pname, oname);
- print(string);
- }
- else return SendClientMessage(playerid, red, "You are not an admin");
- return 1;
- }
- if(!strcmp(cmd, "/gethere", true))
- {
- if(AdminLvl[playerid] == 1)
- {
- tmp = strtok(cmdtext, idx);
- if(!strlen(tmp)) return SendClientMessage(playerid, red, "You didn't put in an id");
- id = strval(tmp);
- new Float:x, Float:y, Float:z;
- GetPlayerPos(playerid, x, y, z);
- SetPlayerPos(id, x+1, y, z);
- GetPlayerName(id, oname, sizeof(oname));
- format(string, sizeof(string), "You have teleported %s (id %d) to you", oname, id);
- SendClientMessage(playerid, yellow, string);
- SendClientMessage(id, yellow, "You have been teleported to an admin");
- format(string, sizeof(string), "%s has teleported %s to him", pname, oname);
- print(string);
- }
- else return SendClientMessage(playerid, red, "You are not an admin");
- return 1;
- }
- if(!strcmp(cmd, "/v", true))
- {
- if(AdminLvl[playerid] == 1)
- {
- new carid, color1, color2;
- tmp = strtok(cmdtext, idx);
- if(!strlen(tmp)) return SendClientMessage(playerid, red, "You didn't put in any ids");
- carid = strval(tmp);
- if(carid < 400 || carid > 611) return SendClientMessage(playerid, red, "Only vehicle ids above 400 and below 611 are valid");
- tmp = strtok(cmdtext, idx);
- color1 = strval(tmp);
- if(color1 < 0 || color1 > 126) return SendClientMessage(playerid, red, "Only color ids 0 and below 126 are valid");
- tmp = strtok(cmdtext, idx);
- color2 = strval(tmp);
- if(color1 < 0 || color1 > 126) return SendClientMessage(playerid, red, "Only color ids 0 and below 126 are valid");
- new Float:X, Float:Y, Float:Z;
- GetPlayerPos(playerid, X, Y, Z);
- CreateVehicle(carid, X+3, Y, Z, 0 , color1, color2, 0);
- format(string, sizeof(string), "%s has spawned a car with id %d", pname, carid);
- print(string);
- }
- else return SendClientMessage(playerid, red, "You are not an admin");
- return 1;
- }
- if(!strcmp(cmd, "/ann", true))
- {
- if(AdminLvl[playerid] == 1)
- {
- tmp = strtok(cmdtext, idx);
- if(!strlen(tmp)) return SendClientMessage(playerid, red, "You didn't type anything");
- id = strval(tmp);
- format(string, 256, "%s", cmdtext[5]);
- GameTextForAll(string, 5000, 5);
- format(string, sizeof(string), "%s has announced: %s", pname, cmdtext[5]);
- print(string);
- }
- else return SendClientMessage(playerid, red, "You are not an admin");
- return 1;
- }
- if(!strcmp(cmd, "/explode", true))
- {
- if(AdminLvl[playerid] == 1)
- {
- tmp = strtok(cmdtext, idx);
- if(!strlen(tmp)) return SendClientMessage(playerid, red, "You didn't put in an id");
- id = strval(tmp);
- new Float:x, Float:y, Float:z;
- GetPlayerPos(id, x, y, z);
- CreateExplosion(x, y, z, 7, 200);
- GetPlayerName(id, oname, sizeof(oname));
- format(string, sizeof(string), "You exploded %s (id: %d)", oname, id);
- SendClientMessage(playerid, yellow, string);
- SendClientMessage(id, yellow, "You have been exploded");
- format(string, sizeof(string), "%s has exploded %s", pname, oname);
- print(string);
- }
- else return SendClientMessage(playerid, red, "You are not an admin");
- return 1;
- }
- if(!strcmp(cmd, "/a", true))
- {
- if(AdminLvl[playerid] == 1)
- {
- for(new i = 0; i < MAX_PLAYERS; i++)
- {
- if(IsPlayerConnected(i))
- {
- if(AdminLvl[i] == 1)
- {
- new str[256];
- format(str, 256, "(( Admin %s: %s ))", pname, cmdtext[3]);
- SendClientMessage(i, green, str);
- }
- }
- }
- }
- else return SendClientMessage(playerid, red, "You are not an admin");
- return 1;
- }
- if(!strcmp(cmd, "/getall", true))
- {
- if(AdminLvl[playerid] == 1)
- {
- new Float:x, Float:y, Float:z;
- GetPlayerPos(playerid, x, y, z);
- for(new i = 0; i < MAX_PLAYERS; i++)
- SetPlayerPos(i, x, y, z);
- format(string, sizeof(string), "%s has teleported everyone to him", pname);
- SendClientMessageToAll(yellow, string);
- print(string);
- }
- else return SendClientMessage(playerid, red, "You are not an admin");
- return 1;
- }
- if(!strcmp(cmd, "/explodeall", true))
- {
- if(AdminLvl[playerid] == 1)
- {
- format(string, sizeof(string), "%s has blown up everyone", pname);
- SendClientMessageToAll(yellow, string);
- print(string);
- new Float:x, Float:y, Float:z;
- for(new i = 0; i < MAX_PLAYERS; i++)
- {
- GetPlayerPos(i, x, y, z);
- CreateExplosion(x, y, z, 7, 200);
- }
- }
- else return SendClientMessage(playerid, red, "You are not an admin");
- return 1;
- }
- if(!strcmp(cmd, "/jail", true))
- {
- if(AdminLvl[playerid] == 1)
- {
- tmp = strtok(cmdtext, idx);
- if(!strlen(tmp)) return SendClientMessage(playerid, red, "You didn't put in an id");
- id = strval(tmp);
- Jailed[id] = 1;
- SetPlayerInterior(id, 3);
- SetPlayerPos(id, 197.6661, 173.8179, 1003.0234);
- GetPlayerName(id, oname, sizeof(oname));
- format(string, sizeof(string), "You have jailed %s (id: %d)", oname, id);
- SendClientMessage(playerid, yellow, string);
- SendClientMessage(id, yellow, "You have been jailed");
- format(string, sizeof(string), "%s has been jailed by %s", oname, pname);
- print(string);
- }
- else return SendClientMessage(playerid, red, "You are not an admin");
- return 1;
- }
- if(!strcmp(cmd, "/unjail", true))
- {
- if(AdminLvl[playerid] == 1)
- {
- tmp = strtok(cmdtext, idx);
- if(!strlen(tmp)) return SendClientMessage(playerid, red, "You didn't put in an id");
- id = strval(tmp);
- Jailed[id] = 0;
- SetPlayerHealth(id, 0);
- SendClientMessage(id, yellow, "You have been unjailed");
- GetPlayerName(id, oname, sizeof(oname));
- format(string, sizeof(string), "You have unjailed %s (id: %d)", oname, id);
- SendClientMessage(playerid, yellow, string);
- format(string, sizeof(string), "%s has been unjailed by %s", oname, pname);
- print(string);
- }
- else return SendClientMessage(playerid, red, "You are not an admin");
- return 1;
- }
- if(!strcmp(cmd, "/wire", true))
- {
- if(AdminLvl[playerid] == 1)
- {
- tmp = strtok(cmdtext, idx);
- if(!strlen(tmp)) return SendClientMessage(playerid, red, "You didn't put in an id");
- id = strval(tmp);
- Wired[id] = 1;
- GetPlayerName(id, oname, sizeof(oname));
- format(string, sizeof(string), "You have wired %s (id: %d)", oname, id);
- SendClientMessage(playerid, yellow, string);
- SendClientMessage(id, yellow, "You have been wired");
- GetPlayerName(id, oname, sizeof(oname));
- format(string, sizeof(string), "%s has been wired by %s", oname, pname);
- print(string);
- }
- else return SendClientMessage(playerid, red, "You are not an admin");
- return 1;
- }
- if(!strcmp(cmd, "/unwire", true))
- {
- if(AdminLvl[playerid] == 1)
- {
- tmp = strtok(cmdtext, idx);
- if(!strlen(tmp)) return SendClientMessage(playerid, red, "You didn't put in an id");
- id = strval(tmp);
- Wired[id] = 0;
- GetPlayerName(id, oname, sizeof(oname));
- format(string, sizeof(string), "You have unwired %s (id: %d)", oname, id);
- SendClientMessage(playerid, yellow, string);
- SendClientMessage(id, yellow, "You have been unwired");
- GetPlayerName(id, oname, sizeof(oname));
- format(string, sizeof(string), "%s has been unwired by %s", oname, pname);
- print(string);
- }
- else return SendClientMessage(playerid, red, "You are not an admin");
- return 1;
- }
- if(!strcmp(cmd, "/crash", true))
- {
- if(AdminLvl[playerid] == 1)
- {
- tmp = strtok(cmdtext, idx);
- if(!strlen(tmp)) return SendClientMessage(playerid, red, "You didn't put in an id");
- id = strval(tmp);
- Wired[id] = 0;
- GetPlayerName(id, oname, sizeof(oname));
- format(string, sizeof(string), "You have crashed %s (id: %d)", oname, id);
- SendClientMessage(playerid, yellow, string);
- GameTextForPlayer(id, "~n~~", 4000, 3);
- GetPlayerName(id, oname, sizeof(oname));
- format(string, sizeof(string), "%s has crashed %s", pname, oname);
- print(string);
- }
- else return SendClientMessage(playerid, red, "You are not an admin");
- return 1;
- }
- if(!strcmp(cmd, "/akill", true))
- {
- if(AdminLvl[playerid] == 1)
- {
- tmp = strtok(cmdtext, idx);
- if(!strlen(tmp)) return SendClientMessage(playerid, red, "You didn't put in an id");
- id = strval(tmp);
- Wired[id] = 0;
- GetPlayerName(id, oname, sizeof(oname));
- format(string, sizeof(string), "You have killed %s (id: %d)", oname, id);
- SendClientMessage(playerid, yellow, string);
- SendClientMessage(id, yellow, "You have been auto killed");
- SetPlayerHealth(id, 0);
- GetPlayerName(id, oname, sizeof(oname));
- format(string, sizeof(string), "%s has auto killed %s", pname, oname);
- print(string);
- }
- else return SendClientMessage(playerid, red, "You are not an admin");
- return 1;
- }
- if(!strcmp(cmd, "/an", true))
- {
- if(AdminLvl[playerid] == 1)
- {
- tmp = strtok(cmdtext, idx);
- if(!strlen(tmp)) return SendClientMessage(playerid, red, "You didn't type anything");
- id = strval(tmp);
- format(string, 256, "Admin: %s", cmdtext[4]);
- SendClientMessageToAll(blue, string);
- format(string, sizeof(string), "%s has admin announced: %s", pname, cmdtext[4]);
- print(string);
- }
- else return SendClientMessage(playerid, red, "You are not an admin");
- return 1;
- }
- if(!strcmp(cmd, "/disable", true))
- {
- if(AdminLvl[playerid] == 1)
- {
- tmp = strtok(cmdtext, idx);
- if(!strlen(tmp)) return SendClientMessage(playerid, red, "You didn't put in an id");
- id = strval(tmp);
- SendClientMessage(id, yellow, "Your commands have been disabled");
- Jailed[id] = 1;
- GetPlayerName(id, oname, sizeof(oname));
- format(string, sizeof(string), "You have disabled %s's commands (id: %d)", oname, id);
- SendClientMessage(playerid, yellow, string);
- GetPlayerName(id, oname, sizeof(oname));
- format(string, sizeof(string), "%s has disabled %s's commands", pname, oname);
- print(string);
- }
- else return SendClientMessage(playerid, red, "You are not an admin");
- return 1;
- }
- if(!strcmp(cmd, "/reable", true))
- {
- if(AdminLvl[playerid] == 1)
- {
- tmp = strtok(cmdtext, idx);
- if(!strlen(tmp)) return SendClientMessage(playerid, red, "You didn't put in an id");
- id = strval(tmp);
- SendClientMessage(id, yellow, "Your commands have been reabled");
- Jailed[id] = 0;
- GetPlayerName(id, oname, sizeof(oname));
- format(string, sizeof(string), "You have reabled %s's commands (id: %d)", oname, id);
- SendClientMessage(playerid, yellow, string);
- GetPlayerName(id, oname, sizeof(oname));
- format(string, sizeof(string), "%s has reabled %s's commands", pname, oname);
- print(string);
- }
- else return SendClientMessage(playerid, red, "You are not an admin");
- return 1;
- }
- return 0;
- }
- strtok(const string[], &index)
- {
- new length = strlen(string);
- while ((index < length) && (string[index] <= ' '))
- {
- index++;
- }
- new offset = index;
- new result[20];
- while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
- {
- result[index - offset] = string[index];
- index++;
- }
- result[index - offset] = EOS;
- return result;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement