Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //
- // Simple Admin Command by Joshman543 keep the credits
- //
- #include <a_samp>
- #include <zcmd>
- #include <foreach>
- #include <sscanf2>
- #define FILTERSCRIPT
- // Colors
- #define COLOR_WHITE 0xFFFFFFFF
- #define COLOR_FADE1 0xE6E6E6E6
- #define COLOR_PM1 0xA65FC7FF
- #define COLOR_PM2 0xD35FC7FF
- #define COLOR_FADE2 0xC8C8C8C8
- #define COLOR_FADE3 0xAAAAAAAA
- #define COLOR_FADE4 0x8C8C8C8C
- #define COLOR_FADE5 0x6E6E6E6E
- #define TEAM_GROVE_COLOR 0x00AA00FF
- #define COLOR_OOC 0xE0FFFFFF
- #define COLOR_GREY 0xAFAFAFFF
- #define COLOR_LIGHTGREEN 0xADFF2FFF
- #define COLOR_LIGHTRED 0xFF6347FF
- #define COLOR_ALLDEPT 0xFF8282AA
- #define COLOR_DARKRED 0xAA3333FF
- #define COLOR_RED 0xFF0606FF
- #define TCOLOR_YELLOW 0xFFFF0000
- #define COLOR_TWPINK 0xE75480AA
- #define TEAM_HIT_COLOR 0xFFFFFF00
- #define COLOR_DBLUE 0x2641FEAA
- #define TEAM_CYAN_COLOR 0xFF8282AA
- #define COLOR_LIGHTBLUE 0x33CCFFFF
- #define COLOR_GREEN 0x33AA33FF
- #define COLOR_INDIGO 0x4B00B000
- #define COLOR_PINK 0xFF66FF00
- #define COLOR_BLACK 0x00000000
- #define COLOR_YELLOW 0xFFFF00FF
- #define COLOR_PURPLE 0xC2A2DAFF
- #define COLOR_ORANGE 0xFF9900FF
- #define COLOR_REPORT 0xFFFF91FF
- #define COLOR_RADIO 0x8D8DFFFF
- #define COLOR_DEPTRADIO 0xFFD700FF
- #define COLOR_BLUE 0x2641FEFF
- #define COLOR_MEDIC 0xFF8282FF
- #define COLOR_NEWBIE 0x7DAEFFFF
- #define COLOR_LIME 0x00FF00FF
- #define COLOR_NEWS 0x049C7100
- #define COLOR_CYAN 0x01FCFFFF
- #define COLOR_VIP 0xC93CCEFF
- //Max
- #define MAX_CUSTOM_VEHICLES 200
- public OnFilterScriptInit()
- {
- print("\n--------------------------------------");
- print(" Simple Admin Commands by Josh Loaded");
- print("--------------------------------------\n");
- return 1;
- }
- public OnFilterScriptExit()
- {
- print("\n----------------------------------");
- print(" Simple Admin Commands by Josh Unloaded");
- print("----------------------------------\n");
- return 1;
- }
- public OnPlayerConnect(playerid)
- {
- new string[128];
- format(string,sizeof(string), "Welcome %s. This server run's Joshman543's admin system", RPN(playerid));
- {
- SendClientMessage(playerid, COLOR_BLUE, string);
- }
- format(string,sizeof(string), "If you hack or cheat, admins will ban you.", RPN(playerid));
- {
- SendClientMessage(playerid, COLOR_RED, string);
- }
- return 1;
- }
- CMD:ahelp(playerid, params[])
- {
- if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use this command.");
- SendClientMessage(playerid, COLOR_GREEN, "_____________________________________________________");
- SendClientMessage(playerid, COLOR_YELLOW, "Admin: {FFFFFF}/sethp /sethpall /setarmor /setarmorall /healnear /freezenear /unfreezenear");
- SendClientMessage(playerid, COLOR_YELLOW, "Admin: {FFFFFF}/healall /ann /veh /freeze /unfreeze /ban /kick");
- return 1;
- }
- CMD:sethpall(playerid, params[])
- {
- new amount, string[128];
- if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use this command.");
- if(sscanf(params, "i", amount)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /sethpall [amount]");
- foreach(Player, i)
- {
- if(IsPlayerLoggedIn(i))
- {
- SetPlayerHealth(i, amount);
- }
- }
- SendClientMessage(playerid, COLOR_WHITE, "Everyone's HP Successfully set.");
- format(string, sizeof(string), "AdmCmd: %s has set everyone's HP to .", RPN(playerid), amount);
- SendClientMessageToAll(COLOR_LIGHTRED, string);
- return 1;
- }
- CMD:healnear(playerid, params[])
- {
- new string[128];
- if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use this command.");
- foreach(Player, i)
- {
- if(IsPlayerNearPlayer(playerid, i, 10))
- {
- SetPlayerHealth(i, 100);
- }
- }
- format(string, sizeof(string), "AdmCmd: %s has healed everyone near.", RPN(playerid));
- SendClientMessageToAll(COLOR_LIGHTRED, string);
- return 1;
- }
- CMD:freezenear(playerid, params[])
- {
- new string[128];
- if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use this command.");
- foreach(Player, i)
- {
- if(IsPlayerNearPlayer(playerid, i, 10))
- {
- if(!IsPlayerAdmin(playerid))
- TogglePlayerControllable(i, 0);
- }
- }
- format(string, sizeof(string), "AdmCmd: %s has froze everyone near.", RPN(playerid));
- SendClientMessageToAll(COLOR_LIGHTRED, string);
- return 1;
- }
- CMD:unfreezenear(playerid, params[])
- {
- new string[128];
- if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use this command.");
- foreach(Player, i)
- {
- if(IsPlayerNearPlayer(playerid, i, 10))
- {
- TogglePlayerControllable(i, 1);
- }
- }
- format(string, sizeof(string), "AdmCmd: %s has froze everyone near.", RPN(playerid));
- SendClientMessageToAll(COLOR_LIGHTRED, string);
- return 1;
- }
- CMD:healall(playerid, params[])
- {
- new amount, string[128];
- if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use this command.");
- foreach(Player, i)
- {
- if(IsPlayerLoggedIn(i))
- {
- SetPlayerHealth(i, 100);
- SetPlayerArmour(i, 100);
- }
- }
- format(string, sizeof(string), "AdmCmd: %s has healed the HP & Armor for everyone.", RPN(playerid), amount);
- SendClientMessageToAll(COLOR_LIGHTRED, string);
- return 1;
- }
- CMD:setarmorall(playerid, params[])
- {
- new amount, string[128];
- if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use this command.");
- if(sscanf(params, "i", amount)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /setarmorall [amount]");
- foreach(Player, i)
- {
- if(IsPlayerLoggedIn(i))
- {
- SetPlayerArmour(i, amount);
- }
- }
- format(string, sizeof(string), "AdmCmd: %s has set everybody's armor to %d.", RPN(playerid), amount);
- SendClientMessageToAll(COLOR_LIGHTRED, string);
- return 1;
- }
- CMD:sethp(playerid, params[])
- {
- new playerb, amount, string[128];
- if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use this command.");
- if(sscanf(params, "ui", playerb, amount)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /sethp [playerid] [amount]");
- SetPlayerHealth(playerb, amount);
- format(string, sizeof(string), " Administrator %s has set your health to %d", RPN(playerid), amount);
- SendClientMessage(playerb, COLOR_WHITE, string);
- format(string, sizeof(string), "AdmWarn: %s has set %s's health to %d.", RPN(playerid), RPN(playerb), amount);
- SendClientMessageToAll(COLOR_LIGHTRED, string);
- return 1;
- }
- CMD:setarmor(playerid, params[])
- {
- new playerb, amount, string[128];
- if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
- if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use this command.");
- if(sscanf(params, "ui", playerb, amount)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /setarmor [playerid] [amount]");
- SetPlayerArmour(playerb, amount);
- format(string, sizeof(string), " Administrator %s has set your armor to %d", RPN(playerid), amount);
- SendClientMessage(playerb, COLOR_WHITE, string);
- format(string, sizeof(string), "AdmWarn: %s has set %s's armor to %d.", RPN(playerid), RPN(playerb), amount);
- SendClientMessageToAll(COLOR_LIGHTRED, string);
- return 1;
- }
- CMD:ann(playerid, params[])
- {
- new string[128];
- if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use this command.");
- if(sscanf(params, "s[128]", string)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /cnn [text]");
- format(string, sizeof(string), "%s", string);
- GameTextForAll(string, 10000, 5);
- return 1;
- }
- CMD:unfreeze(playerid, params[])
- {
- new string[128], playerb;
- if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use this command.");
- if(sscanf(params, "u", playerb)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /unfreeze [playerid]");
- TogglePlayerControllable(playerb, 1);
- format(string, sizeof(string), " You have unfreezed %s.", RPN(playerb));
- SendClientMessage(playerid, COLOR_WHITE, string);
- format(string, sizeof(string), " Administrator %s has unfreezed you.", RPN(playerid));
- SendClientMessage(playerb, COLOR_WHITE, string);
- return 1;
- }
- CMD:freeze(playerid, params[])
- {
- new string[128], playerb;
- if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use this command.");
- if(sscanf(params, "u", playerb)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /freeze [playerid]");
- TogglePlayerControllable(playerb, 0);
- format(string, sizeof(string), " You have freezed %s.", RPN(playerb));
- SendClientMessage(playerid, COLOR_WHITE, string);
- format(string, sizeof(string), " Administrator %s has freezed you.", RPN(playerid));
- SendClientMessage(playerb, COLOR_WHITE, string);
- return 1;
- }
- CMD:veh(playerid, params[])
- {
- new id, Float:pos[4], col[2];
- new cVeh[MAX_CUSTOM_VEHICLES];
- if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use this command.");
- if(!strcmp(params, "destroy"))
- {
- if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER) return SendClientMessage(playerid, COLOR_GREY, "You must be inside a vehicle to destroy it.");
- for(new i=0; i<MAX_CUSTOM_VEHICLES; i++)
- {
- if(GetPlayerVehicleID(playerid) == cVeh[i])
- {
- //format(string, sizeof(string), "AdmWarn: %s has destroyed a vehicle model %d.", RPN(playerid), GetVehicleModel(i));
- //SendAdminMessage(COLOR_DARKRED, 1, string);
- DestroyVehicle(cVeh[i]);
- i = MAX_CUSTOM_VEHICLES;
- return 1;
- }
- }
- SendClientMessage(playerid, COLOR_GREY, "You can't destroy this vehicle.");
- return 1;
- }
- if(sscanf(params, "iii", id, col[0], col[1])) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /veh [vehicleid/destroy] [color1] [color2]");
- if(id < 400 || id > 611) return SendClientMessage(playerid, COLOR_GREY, "Vehicles are between 400 and 611.");
- GetPlayerPos(playerid, pos[0], pos[1], pos[2]);
- GetPlayerFacingAngle(playerid, pos[3]);
- for(new i=0; i<MAX_CUSTOM_VEHICLES; i++)
- {
- if(!cVeh[i])
- {
- cVeh[i] = CreateVehicle(id, pos[0], pos[1], pos[2], pos[3], col[0], col[1], 1200);
- i = MAX_CUSTOM_VEHICLES;
- }
- }
- new string[128];
- format(string, sizeof(string), "AdmWarn: %s has spawned a vehicle model %d.", RPN(playerid), id);
- SendClientMessageToAll(COLOR_LIGHTRED, string);
- return 1;
- }
- CMD:kick(playerid, params[])
- {
- new playerb, string[128];
- if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use this command.");
- if(sscanf(params, "us[128]", playerb, params)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /kick [playerid] [reason]");
- if(!IsPlayerConnected(playerb)) return SendClientMessage(playerid, COLOR_GREY, "Invalid player id.");
- if(IsPlayerNPC(playerb)) return SendClientMessage(playerid, COLOR_GREY, "You can't kick NPCs out of the server.");
- if(IsPlayerAdmin(playerb)) return SendClientMessage(playerid, COLOR_GREY, "You can't kick an admin");
- format(string, sizeof(string), "AdmCmd: %s has been kicked by %s, reason: %s", RPN(playerb), RPN(playerid), params);
- SendClientMessageToAll(COLOR_LIGHTRED, string);
- Kick(playerb);
- return 1;
- }
- CMD:ban(playerid, params[])
- {
- new playerb, string[128];
- if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use this command.");
- if(sscanf(params, "us[128]", playerb, params)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /ban [playerid] [reason]");
- if(!IsPlayerLoggedIn(playerb)) return SendClientMessage(playerid, COLOR_GREY, "Invalid player id.");
- if(!IsPlayerAdmin(playerb)) return SendClientMessage(playerid, COLOR_GREY, "You can't ban an admin silly!");
- format(string, sizeof(string), "AdmCmd: %s has been banned by %s, reason: %s", RPN(playerb), RPN(playerid), params);
- SendClientMessageToAll(COLOR_LIGHTRED, string);
- // BanList
- Ban(playerb);
- return 1;
- }
- //Stocks
- stock RPN(playerid)
- {
- new name[MAX_PLAYER_NAME];
- GetPlayerName(playerid,name,sizeof(name));
- for(new i = 0; i < MAX_PLAYER_NAME; i++)
- {
- if(name[i] == '_') name[i] = ' ';
- }
- return name;
- }
- stock IsPlayerNearPlayer(playerid, targetid, Float:radius)
- {
- new Float:x, Float:y, Float:z;
- GetPlayerPos(targetid, x, y, z);
- if(IsPlayerInRangeOfPoint(playerid, radius ,x, y, z))
- {
- return 1;
- }
- return 0;
- }
- stock IsPlayerLoggedIn(playerid)
- {
- if(IsPlayerConnected(playerid))
- {
- {
- return 1;
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement