Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Filterscript powered by BeesSi
- // Credits to KUSH for his registration system
- // Credits to the owner of KickEx include as i copied his for my BannEx.
- // Credits to gtakillerIV for his offline BAN and UNBAN Tutorial
- // All the credits will be listed here .
- // Original Filterscript by BeesSi. Feel free to edit it and rerelease.
- #include <a_samp>
- #include <YSI\y_ini>
- #include <zcmd>
- #include <sscanf2>
- #include <foreach>
- #include <streamer>
- #include <KickEx>
- // Includes down here belongs to BeesSi
- #include <BannEx>
- /* Defines */
- #define DIALOG_REGISTER 1
- #define DIALOG_LOGIN 2
- #define DIALOG_SUCCESS_1 3
- #define DIALOG_SUCCESS_2 4
- #define PATH "/Users/%s.ini"
- #define COL_WHITE "{FFFFFF}"
- forward SendAdminMessage(color, string[]);
- forward BroadCast(color,string[]);
- #define COL_RED "{F81414}"
- #define COL_GREEN "{00FF22}"
- #pragma tabsize 0
- #define COL_LIGHTBLUE "{00CED1}"
- #define TEAM_HIT_COLOR 0xFFFFFF00
- #define COLOR_BRIGHTRED 0xFF0000AA
- #define COLOR_TWWHITE 0xFFFFFFAA
- #define DIALOG_SHOW_INFO 13337
- #define DIALOG_SHOW_INFO1 124
- #define DIALOG_SHOW_INFO2 125
- #define COLOR_TWYELLOW 0xFFFF00AA
- #define COLOR_TWPINK 0xE75480AA
- #define COLOR_TWRED 0xFF0000AA
- #define COLOR_TWBROWN 0x654321AA
- #define COLOR_TWGRAY 0x808080AA
- #define COLOR_TWOLIVE 0x808000AA
- #define COLOR_TWPURPLE 0x800080AA
- #define COLOR_TWTAN 0xD2B48CAA
- #define COLOR_TWAQUA 0x00FFFFAA
- #define COLOR_TWORANGE 0xFF8C00AA
- #define COLOR_TWAZURE 0x007FFFAA
- #define COLOR_TWGREEN 0x008000AA
- #define COLOR_TWBLUE 0x0000FFAA
- #define COLOR_TWBLACK 0x000000AA
- #define GetVehicleName(%0) VehicleName[GetVehicleModel(%0)-400]
- #define COLOR_HTWWHITE "FFFFFF"
- #define COLOR_HTWYELLOW "FFFF00"
- #define COLOR_HTWPINK "E75480"
- #define COLOR_HTWRED "FF0000"
- #define COLOR_HTWBROWN "654321"
- #define COLOR_HTWGRAY "808080"
- #define COLOR_HTWOLIVE "808000"
- #define COLOR_HTWPURPLE "800080"
- #define COLOR_HTWTAN "D2B48C"
- #define COLOR_HTWAQUA "00FFFF"
- #define COLOR_HTWORANGE "FF8C00"
- #define COLOR_HTWAZURE "007FFF"
- #define COLOR_HTWGREEN "008000"
- #define COLOR_HTWBLUE "0000FF"
- #define COLOR_HTWBLACK "000000"
- new playersonline=0;
- new CreatedCars[100];
- #define COLOR_ORANGE 0xFF8000FF
- #define COLOR_GRAD1 0xB4B5B7FF
- #define COLOR_GRAD2 0xBFC0C2FF
- #define COLOR_GRAD3 0xCBCCCEFF
- #define COLOR_GRAD4 0xD8D8D8FF
- #define COLOR_GRAD5 0xE3E3E3FF
- #define COLOR_GRAD6 0xF0F0F0FF
- #define COLOR_HACHAT 0x642EFAAA
- #define COLOR_GREY 0xAFAFAFAA
- #define COLOR_GREEN 0x33AA33AA
- #define COLOR_RED 0xFF0000
- #define COLOR_GRAVE 0xFF0000FF
- #define COLOR_REALRED 0xFF0606FF
- #define COLOR_LIGHTRED 0xFF6347AA
- #define COLOR_LIGHTBLUE 0x33CCFFAA
- #define COLOR_LIGHTGREEN 0x9ACD32AA
- #define COLOR_LIME 0xB7FF00AA
- #define COLOR_YELLOW 0xFFFF00AA
- #define COLOR_VIP 0xC93CCE00
- #define COLOR_YELLOW2 0xF5DEB3AA
- #define COLOR_WHITE 0xFFFFFFAA
- #define COLOR_FADE1 0xE6E6E6E6
- #define COLOR_FADE2 0xC8C8C8C8
- #define COLOR_FADE3 0xAAAAAAAA
- #define COLOR_FADE4 0x8C8C8C8C
- #define COLOR_FADE5 0x6E6E6E6E
- #define COLOR_PURPLE 0xC2A2DAAA
- #define COLOR_PINK 0xFF66FFAA
- #define COLOR_DBLUE 0x2641FEAA
- #define COLOR_ALLDEPT 0xFF8282AA
- #define COLOR_BLACK 0x000000AA
- #define TEAM_SFPD 0x0099FF00
- #define TEAM_SASD 0xCC993300
- #define TEAM_LAJS 0xFF8C00AA
- #define COLOR_NEWS 0xFFA500AA
- #define COLOR_OOC 0xE0FFFFAA
- #define COLOR_NG 0x9ACD3200
- #define COLOR_USCG 0x9ACD3200
- #define COLOR_TR2 0xCC000000
- #define COLOR_TR 0x56B9B900
- #define COLOR_FBI 0x8D8DFFFF
- #define PUBLICRADIO_COLOR 0x6DFB6DFF
- #define TEAM_CYAN 1
- #define TEAM_BLUE 2
- #define TEAM_GREEN 3
- #define TEAM_ORANGE 4
- #define TEAM_COR 5
- #define TEAM_BAR 6
- #define TEAM_TAT 7
- #define TEAM_CUN 8
- #define TEAM_STR 9
- #define TEAM_HIT 10
- #define TEAM_ADMIN 11
- #define OBJECTIVE_COLOR 0x64000064
- #define PAINTBALL_TEAM_RED 0xFF780000
- #define PAINTBALL_TEAM_BLUE 0x56B9B900
- #define WANTED_COLOR 0xFF0000FF
- #define FIND_COLOR 0xB90000FF
- #define TACTICAL1 0xCAD6A3FF
- #define TACTICAL2 0xFF9A00FF
- #define COLOR_1RED 0xFF0000FF
- #define COLOR_1GREY 0xC0C0C0FF
- #define COLOR_1GREEN 0x008000FF
- #define COLOR_1YELLOW 0xFFFF00FF
- #define COLOR_1WHITE 0xFFFFFFFF
- #define COLOR_1BLUE 0x0000FFFF
- #define MIN_VEHI_ID 400
- #define MAX_VEHI_ID 611
- new Float:TelePos[MAX_PLAYERS][6];
- new Float: fVehSpeed[MAX_PLAYERS];
- new Spectate[MAX_PLAYERS];
- new Spectating[MAX_PLAYERS];
- new GettingSpectated[MAX_PLAYERS];
- new aDuty[MAX_PLAYERS];
- new Godmode[MAX_PLAYERS];
- static const VehicleName[212][] = {
- "Landstalker","Bravura","Buffalo","Linerunner","Perennial","Sentinel","Dumper","Firetruck","Trashmaster","Stretch",
- "Manana","Infernus","Voodoo","Pony","Mule","Cheetah","Ambulance","Leviathan","Moonbeam","Esperanto","Taxi",
- "Washington","Bobcat","Mr Whoopee","BF Injection","Hunter","Premier","Enforcer","Securicar","Banshee","Predator",
- "Bus","Rhino","Barracks","Hotknife","Trailer","Previon","Coach","Cabbie","Stallion","Rumpo","RC Bandit", "Romero",
- "Packer","Monster","Admiral","Squalo","Seasparrow","Pizzaboy","Tram","Trailer","Turismo","Speeder","Reefer","Tropic","Flatbed",
- "Yankee","Caddy","Solair","Berkley's RC Van","Skimmer","PCJ-600","Faggio","Freeway","RC Baron","RC Raider",
- "Glendale","Oceanic","Sanchez","Sparrow","Patriot","Quad","Coastguard","Dinghy","Hermes","Sabre","Rustler",
- "ZR-350","Walton","Regina","Comet","BMX","Burrito","Camper","Marquis","Baggage","Dozer","Maverick","News Chopper",
- "Rancher","FBI Rancher","Virgo","Greenwood","Jetmax","Hotring Racer","Sandking","Blista Compact","Police Maverick",
- "Boxville","Benson","Mesa","RC Goblin","Hotring Racer A","Hotring Racer B","Bloodring Banger","Rancher","Super GT",
- "Elegant","Journey","Bike","Mountain Bike","Beagle","Cropduster","Stuntplane","Tanker","Road Train","Nebula","Majestic",
- "Buccaneer","Shamal","Hydra","FCR-900","NRG-500","HPV-1000","Cement Truck","Tow Truck","Fortune","Cadrona","FBI Truck",
- "Willard","Forklift","Tractor","Combine","Feltzer","Remington","Slamvan","Blade","Freight","Streak","Vortex","Vincent",
- "Bullet","Clover","Sadler","Firetruck","Hustler","Intruder","Primo","Cargobob","Tampa","Sunrise","Merit","Utility",
- "Nevada","Yosemite","Windsor","Monster A","Monster B","Uranus","Jester","Sultan","Stratum","Elegy","Raindance","RC Tiger",
- "Flash","Tahoma","Savanna","Bandito","Freight","Trailer","Kart","Mower","Duneride","Sweeper","Broadway",
- "Tornado","AT-400","DFT-30","Huntley","Stafford","BF-400","Newsvan","Tug","Trailer","Emperor","Wayfarer",
- "Euros","Hotdog","Club","Trailer","Trailer","Andromada","Dodo","RCCam","Launch","Police Car (LAPD)","Police Car (SFPD)",
- "Police Car (LVPD)","Police Ranger","Picador","S.W.A.T. Van","Alpha","Phoenix","Glendale","Sadler","Luggage Trailer A",
- "Luggage Trailer B","Stair Trailer","Boxville","Farm Plow","Utility Trailer"
- };
- enum pInfo
- {
- pPassword,
- pAdmin,
- pMoney,
- pVW,
- pBanned,
- BannedIP[22]
- }
- new PlayerInfo[MAX_PLAYERS][pInfo];
- public OnFilterScriptInit()
- {
- for(new i = 0; i < sizeof(CreatedCars); i++)
- {
- CreatedCars[i] = INVALID_VEHICLE_ID;
- }
- return 1;
- }
- public OnFilterScriptExit()
- {
- return 1;
- }
- public OnPlayerRequestClass(playerid, classid)
- {
- if(PlayerInfo[playerid][pBanned] == 1)
- {
- Ban(playerid);
- }
- 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)
- {
- if(fexist(UserPath(playerid)))
- {
- INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
- ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,""COL_WHITE"Login",""COL_WHITE"Type your password below to login.","Login","Quit");
- }
- else
- {
- ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT,""COL_WHITE"Registering...",""COL_WHITE"Type your password below to register a new account.","Register","Quit");
- }
- new string[520];
- playersonline++;
- new Name[MAX_PLAYER_NAME];
- GetPlayerName(playerid, Name, MAX_PLAYER_NAME);
- format(string,sizeof string,"{00FFFF}%s{FF0000} (ID: {00FFFF}%d{FF0000}) has joined the server!.There are currently {00FFFF}%d {FF0000}players online.",Name, playerid, playersonline);
- SendClientMessageToAll(COLOR_GREEN, string);
- return 1;
- }
- public OnPlayerDisconnect(playerid, reason)
- {
- new INI:File = INI_Open(UserPath(playerid));
- INI_SetTag(File,"data");
- INI_WriteInt(File,"Money",GetPlayerMoney(playerid));
- INI_WriteInt(File,"Admin",PlayerInfo[playerid][pAdmin]);
- INI_WriteInt(File,"pVW",PlayerInfo[playerid][pVW]);
- INI_WriteInt(File,"Banned",PlayerInfo[playerid][pBanned]);
- INI_Close(File);
- new string[128];
- playersonline--;
- new pName[MAX_PLAYER_NAME];
- GetPlayerName(playerid, pName, MAX_PLAYER_NAME);
- format(string, sizeof(string), "{04FBE2}%s {B004FB}has left the server. See you soon.", pName);
- SendClientMessageToAll(COLOR_GREEN, string);
- return 1;
- }
- public OnPlayerSpawn(playerid)
- {
- return 1;
- }
- forward LoadUser_data(playerid,name[],value[]);
- public LoadUser_data(playerid,name[],value[])
- {
- INI_Int("Password",PlayerInfo[playerid][pPassword]);
- INI_Int("pVW",PlayerInfo[playerid][pVW]);
- INI_Int("Admin",PlayerInfo[playerid][pAdmin]);
- INI_Int("Money",PlayerInfo[playerid][pMoney]);
- INI_Int("Banned", PlayerInfo[playerid][pBanned]);
- 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;
- }
- /*---------STOCKS----------*/
- stock GetName(playerid)
- {
- new
- pName[MAX_PLAYER_NAME];
- GetPlayerName(playerid, pName, MAX_PLAYER_NAME);
- return pName;
- }
- stock ErrorMessages(playerid, errorID)
- {
- if(errorID == 1) return SendClientMessage(playerid,COLOR_GREY,"You are not authorized to use this command.");
- return 1;
- }
- stock CreateVehicleEx(modelid, Float:x, Float:y, Float:z, Float:angle, color1, color2, respawn_delay, playerid = INVALID_PLAYER_ID)
- {
- new string[128];
- format(string, sizeof(string), "(%d, %f, %f, %f, %f, %d, %d, %d) (%s)", modelid, x, y, z, angle, color1, color2, respawn_delay, GetPlayerNameEx(playerid));
- new id = CreateVehicle(modelid, x, y, z, angle, color1, color2, respawn_delay);
- format(string, sizeof(string), "-> [%d]", id);
- return id;
- }
- public BroadCast(color,string[])
- {
- SendClientMessageToAll(color, string);
- return 1;
- }
- IsNumeric(const string[])
- {
- for (new i = 0, j = strlen(string); i < j; i++)
- {
- if (string[i] > '9' || string[i] < '0') return 0;
- }
- return 1;
- }
- GetVehicleModelIDFromName(vname[])
- {
- for(new i = 0; i < 211; i++)
- {
- if ( strfind(VehicleName[i], vname, true) != -1 )
- return i + MIN_VEHI_ID;
- }
- return -1;
- }
- stock ABroadCastEx(color,string[])
- {
- foreach(Player, i)
- {
- if (PlayerInfo[i][pAdmin] >= 2)
- {
- SendClientMessage(i, color, string);
- //printf("%s", string);
- }
- }
- return 1;
- }
- stock ABroadCast(color,string[],level)
- {
- foreach(Player, i)
- {
- if (PlayerInfo[i][pAdmin] >= level)
- {
- SendClientMessage(i, color, string);
- //printf("%s", string);
- }
- }
- return 1;
- }
- stock Error(playerid, text[])
- {
- return SendClientMessage(playerid, COLOR_GRAD2, text);
- }
- stock Syntax(playerid, command[], params[])
- {
- new string[128];
- format(string, sizeof(string), "USAGE: /%s %s", command, params);
- return SendClientMessage(playerid, COLOR_GRAD2, string);
- }
- stock IsAdmin(playerid)
- {
- if(PlayerInfo[playerid][pAdmin] >= 1)
- return 1;
- else
- return 0;
- }
- stock UserPath(playerid)
- {
- new string[128],playername[MAX_PLAYER_NAME];
- GetPlayerName(playerid,playername,sizeof(playername));
- format(string,sizeof(string),PATH,playername);
- return string;
- }
- stock GetPlayerNameEx(playerid)
- {
- new pName[25];
- GetPlayerName(playerid, pName, sizeof(pName));
- return pName;
- }
- stock udb_hash(buf[]) {
- new length=strlen(buf);
- new s1 = 1;
- new s2 = 0;
- new n;
- for (n=0; n<length; n++)
- {
- s1 = (s1 + buf[n]) % 65521;
- s2 = (s2 + s1) % 65521;
- }
- return (s2 << 16) + s1;
- }
- 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[])
- {
- switch( dialogid )
- {
- case DIALOG_REGISTER:
- {
- if (!response) return Kick(playerid);
- if(response)
- {
- new IP[22];
- GetPlayerIp(playerid, IP, sizeof(IP));
- if(!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, ""COL_WHITE"Registering...",""COL_RED"You have entered an invalid password.\n"COL_WHITE"Type your password below to register a new account.","Register","Quit");
- new INI:File = INI_Open(UserPath(playerid));
- INI_SetTag(File,"data");
- INI_WriteInt(File,"Password",udb_hash(inputtext));
- INI_WriteInt(File,"Money",0);
- INI_WriteInt(File,"pVW",0);
- INI_WriteString(File, "Ip", IP);
- INI_WriteInt(File,"Admin",0);
- INI_Close(File);
- }
- }
- case DIALOG_LOGIN:
- {
- if ( !response ) return Kick ( playerid );
- if( response )
- {
- if(udb_hash(inputtext) == PlayerInfo[playerid][pPassword])
- {
- INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
- GivePlayerMoney(playerid, PlayerInfo[playerid][pMoney]);
- ShowPlayerDialog(playerid, DIALOG_SUCCESS_2, DIALOG_STYLE_MSGBOX,""COL_WHITE"Success!",""COL_GREEN"You have successfully logged in!","Ok","");
- }
- else
- {
- ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,""COL_WHITE"Login",""COL_RED"You have entered an incorrect password.\n"COL_WHITE"Type your password below to login.","Login","Quit");
- }
- return 1;
- }
- }
- }
- return 1;
- }
- public OnPlayerClickPlayer(playerid, clickedplayerid, source)
- {
- return 1;
- }
- CMD:setadmin(playerid, params[])
- {
- new victimname[MAX_PLAYER_NAME], adminname[MAX_PLAYER_NAME], admlvl, id;
- if(PlayerInfo[playerid][pAdmin] >= 4)
- {
- if (sscanf(params, "ui", id, admlvl)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /setadmin [id] [level]");
- if (id == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_RED, "Player was not found.");
- if (admlvl > 4 || admlvl < 0) return SendClientMessage(playerid, COLOR_RED,"Invalid Level , Available : 1-4");
- PlayerInfo[id][pAdmin] = admlvl;
- GetPlayerName(id, victimname, sizeof(victimname));
- GetPlayerName(playerid, adminname, sizeof(adminname));
- new string[128];
- format(string, sizeof(string), "%s has made %s a level %d admin", adminname, victimname, admlvl);
- ABroadCast(COLOR_YELLOW, string, 2);
- format(string,128,"%s has set your admin level to %i",adminname, admlvl);
- SendClientMessage(id,0xFF0000C8,string);
- return 1;
- }
- return SendClientMessage(playerid,COLOR_GREY,"You are not authorized to use this command");
- }
- CMD:rconadmin(playerid, params[])
- {
- new victimname[MAX_PLAYER_NAME], adminname[MAX_PLAYER_NAME], admlvl, id;
- if(IsPlayerAdmin(playerid))
- {
- if (sscanf(params, "ui", id, admlvl)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /rconadmin [id] [level]");
- if (id == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_RED, "Player was not found.");
- if (admlvl > 4 || admlvl < 0) return SendClientMessage(playerid, COLOR_RED,"Invalid Level , Available : 1-4");
- PlayerInfo[id][pAdmin] = admlvl;
- GetPlayerName(id, victimname, sizeof(victimname));
- GetPlayerName(playerid, adminname, sizeof(adminname));
- new string[128];
- format(string, sizeof(string), "%s has made %s a level %d admin with the rcon password", adminname, victimname, admlvl);
- ABroadCast(COLOR_YELLOW, string, 2);
- format(string,128,"%s has set your admin level to %i with the rcon password",adminname, admlvl);
- SendClientMessage(id,0xFF0000C8,string);
- return 1;
- }
- return SendClientMessage(playerid,COLOR_GREY,"You are not authorized to use this command");
- }
- forward LoadIP_data(playerid, name[], value[]);
- public LoadIP_data(playerid, name[], value[]) //Creating a new Public function for use later.
- {
- INI_String("Ip", PlayerInfo[ playerid ][ BannedIP ], 33); //Loading the string "Ip", and assigning it to our string "BannedIP", with the maximum size of 33.
- return 1; //Returning 1 for it to work.
- }
- CMD:a(playerid, params[])
- {
- if(PlayerInfo[playerid][pAdmin] >= 1)
- {
- if(!isnull(params))
- {
- new szMessage[128];
- if(PlayerInfo[playerid][pAdmin] == 1)
- {
- SendClientMessage(playerid, COLOR_GREY, "Junior Admins can't use the admin chat.");
- format(szMessage, sizeof(szMessage), "Junior Admin %s has tried to use /a : %s", GetPlayerNameEx(playerid), params);
- ABroadCastEx(COLOR_GREEN, szMessage);
- }
- else if(PlayerInfo[playerid][pAdmin] == 2)
- {
- format(szMessage, sizeof(szMessage), "*{B300FF} General Admin {00FFFF}%s: {FFFFFF}%s", GetPlayerNameEx(playerid), params);
- ABroadCast(COLOR_GREEN, szMessage, 2);
- }
- else if(PlayerInfo[playerid][pAdmin] == 3)
- {
- format(szMessage, sizeof(szMessage), "*{DFF709} Head Admin {00FFFF}%s: {FFFFFF}%s", GetPlayerNameEx(playerid), params);
- ABroadCast(COLOR_GREEN, szMessage, 2);
- }
- else if(PlayerInfo[playerid][pAdmin] == 4)
- {
- format(szMessage, sizeof(szMessage), "*{FF0000} Director {00FFFF}%s: {FFFFFF}%s", GetPlayerNameEx(playerid), params);
- ABroadCast(COLOR_GREEN, szMessage, 2);
- }
- else SendClientMessage(playerid, COLOR_WHITE, "USAGE: (/a)dmin [admin chat]");
- }
- return 1;
- }
- return 1;
- }
- public SendAdminMessage(color, string[])
- {
- foreach(Player, i)
- {
- if(PlayerInfo[i][pAdmin] >= 1)
- {
- SendClientMessage(i, color, string);
- }
- }
- }
- CMD:am(playerid, params[])
- {
- if(IsAdmin(playerid))
- {
- new toid, message[128];
- if(sscanf(params, "is[128]", toid, message)) return Syntax(playerid, "[a]dmin[m]essage", "[playerid] [message]");
- if(strlen(message) > 128) return Error(playerid, "Your message cannot be longer than 128 characters.");
- if(!IsPlayerConnected(toid)) return Error(playerid, "That player is not connected!");
- new string[128];
- format(string, sizeof(string), "Admin message from %s: %s", GetPlayerNameEx(playerid), message);
- SendClientMessage(toid, COLOR_GREEN, string);
- format(string, sizeof(string), "Admin %s [%d] > %s [%d]: %s", GetPlayerNameEx(playerid), playerid, GetPlayerNameEx(toid), toid, message);
- SendAdminMessage(COLOR_GREEN,string);
- }
- else
- {
- new message[80];
- if(sscanf(params, "s[80]", message)) return Syntax(playerid, "[a]dmin[m]essage", "[message]");
- if(strlen(message) > 80) return Error(playerid, "Your message cannot be longer than 80 characters.");
- //if(strfind(message, "Falling", true) != -1) return Error(playerid, "Type (/falling) and a administrative person will be there to assist you right away!");
- new string[128];
- format(string, sizeof(string), "Admin message from %s [%d]: %s", GetPlayerNameEx(playerid), playerid, message);
- SendAdminMessage(COLOR_GREEN,string);
- format(string, sizeof(string), "Your message, %s, has been sent.", message);
- SendClientMessage(playerid, COLOR_GREEN, string);
- format(string, sizeof(string), "Player %s [%d] > Admins: %s", GetPlayerNameEx(playerid), playerid, message);
- }
- return 1;
- }
- CMD:god(playerid, params[])
- {
- if(PlayerInfo[playerid][pAdmin] >= 1)
- {
- switch(Godmode[playerid]) {
- case 0: {
- Godmode[playerid] = 1;
- new string[128];
- SetPlayerHealth(playerid, 500000);
- SetPlayerArmour(playerid, 500000);
- new pName[MAX_PLAYER_NAME];
- GetPlayerName(playerid, pName, MAX_PLAYER_NAME);
- format(string, sizeof(string), "(GODMODE): %s!", pName);
- SetPlayerChatBubble(playerid,string,COLOR_WHITE,60.0,10000000000000);
- SendClientMessage(playerid, COLOR_RED, "You just activated god mode");
- }
- case 1: {
- Godmode[playerid] = 0;
- SetPlayerHealth(playerid, 100);
- SetPlayerArmour(playerid, 100);
- SendClientMessage(playerid, COLOR_RED, "You just deactivated god mode");
- SetPlayerChatBubble(playerid,"GODMODE: OFF" ,COLOR_WHITE,60.0,1);
- }
- }
- }
- else return SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use this command");
- {
- return 1;
- }
- }
- CMD:ah(playerid, params[])
- {
- new str[1200];
- if(IsPlayerAdmin(playerid))
- if(PlayerInfo[playerid][pAdmin] >= 1)
- {
- strcat(str, "*** {04FBCA}Junior Admin {FFFFFF}*** /ah, /am, /a, /god, /aduty, /veh, /o, kick\n");
- if(PlayerInfo[playerid][pAdmin] >= 2)
- {
- strcat(str, "*** {B300FF}General Admin {FFFFFF}*** /gotoid, /get, /spec\n");
- }
- if(PlayerInfo[playerid][pAdmin] >= 3)
- {
- strcat(str, "*** {DFF709}Head Admin {FFFFFF}*** /ban, /oban, /unban\n");
- }
- if(PlayerInfo[playerid][pAdmin] >= 4) {
- strcat(str, "*** {FF0000}Director {FFFFFF}*** All CMD's Below and /setadmin\n");
- }
- if (PlayerInfo[playerid][pAdmin] >= 1)
- {
- ShowPlayerDialog(playerid, DIALOG_SHOW_INFO, DIALOG_STYLE_MSGBOX, "{33AA33}Administration Commands", str, "Ok", "Cancel");
- }
- return 1;
- }
- return 1;
- }
- CMD:ban(playerid, params[])
- {
- new id, reason[50], string[128], banned[MAX_PLAYER_NAME];
- if(PlayerInfo[playerid][pAdmin] >= 3)
- {
- if(sscanf(params, "uz", id, reason)) return SendClientMessage(playerid, COLOR_GREY, "USAGE: /ban [playerid] [reason(optional)]");
- GetPlayerName(id, banned, sizeof(banned));
- format(string, sizeof(string), "AdmCmd: %s has been banned by %s, reason: %s", banned, GetName(playerid), reason);
- SendClientMessageToAll(0xFF0000C8, string);
- new str[3500];
- new year, month, day;
- getdate(year, month, day);
- format(str,128,"{FFFFFF}You have been banned by {00FFF2}%s {FFFFFF}for {7C44EB}%s {FFFFFF}on [%d/%d/%d].\nIf you think you were banned unfairly please appeal at www.Your-Web.com.\nIf you think you were bugged please relog.\nTake a screenshot of this and post at the appeal , you are required to do this.",GetName(playerid), reason, day, month, year);
- ShowPlayerDialog(id, DIALOG_SHOW_INFO2, DIALOG_STYLE_MSGBOX, "{FF0000}Banned", str, "Ok", "Cancel");
- SetPlayerChatBubble(id,"Banned Player" ,COLOR_RED,60.0,999999999999999);
- SendClientMessage(id, COLOR_GREY, "Server Closed Connection");
- TogglePlayerControllable(id,0);
- PlayerInfo[id][pBanned] = 1;
- }
- else SendClientMessage(playerid,COLOR_GREY,"You are not authorized to use this command");
- return 1;
- }
- CMD:kick(playerid, params[])
- {
- new id, reason[50], string[128], kicked[MAX_PLAYER_NAME];
- if(PlayerInfo[playerid][pAdmin] >= 1)
- {
- if(sscanf(params, "uz", id, reason)) return SendClientMessage(playerid, COLOR_GREY, "USAGE: /kick [playerid] [reason(optional)]");
- GetPlayerName(id, kicked, sizeof(kicked));
- format(string, sizeof(string), "AdmCmd: %s has been kicked by %s, reason: %s", kicked, GetName(playerid), reason);
- SendClientMessageToAll(0xFF0000C8, string);
- new stringg[128];
- format(stringg, sizeof(stringg), "You have been kicked by %s for %s", GetName(playerid), reason);
- ShowPlayerDialog(id, DIALOG_SHOW_INFO2, DIALOG_STYLE_MSGBOX, "Kicked", stringg, "Ok", "Cancel");
- KickEx(id, reason);
- }
- else SendClientMessage(playerid,COLOR_GREY,"You are not authorized to use this command");
- return 1;
- }
- CMD:gotoid(playerid, params[])
- {
- new giveplayerid;
- if(sscanf(params, "u", giveplayerid))
- return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /gotoid [playerid/partofname]");
- new Float:plocx,Float:plocy,Float:plocz;
- if(IsPlayerConnected(giveplayerid))
- {
- if(PlayerInfo[playerid][pAdmin] >= 2)
- {
- if(GetPlayerState(giveplayerid) == PLAYER_STATE_SPECTATING)
- {
- SendClientMessage(playerid, COLOR_GREY, "That player is spectating someone.");
- return 1;
- }
- if(GetPlayerState(playerid) == PLAYER_STATE_SPECTATING)
- {
- SendClientMessage(playerid, COLOR_GREY, "You can't do this while spectating.");
- return 1;
- }
- GetPlayerPos(giveplayerid, plocx, plocy, plocz);
- Streamer_UpdateEx(playerid, plocx, plocy, plocz);
- if(GetPlayerState(playerid) == 2)
- {
- new tmpcar = GetPlayerVehicleID(playerid);
- SetVehiclePos(tmpcar, plocx, plocy+4, plocz);
- TelePos[playerid][0] = 0.0;TelePos[playerid][1] = 0.0;
- fVehSpeed[playerid] = 0.0;
- }
- else
- {
- SetPlayerPos(playerid,plocx,plocy+2, plocz);
- }
- SetPlayerInterior(playerid, GetPlayerInterior(giveplayerid));
- SetPlayerVirtualWorld(playerid, GetPlayerVirtualWorld(giveplayerid));
- new giveplayeridvw = GetPlayerVirtualWorld(giveplayerid);
- PlayerInfo[playerid][pVW] = giveplayeridvw;
- SendClientMessage(playerid, COLOR_WHITE, "You have been teleported!");
- }
- else
- {
- SendClientMessage(playerid, COLOR_GREY, "You're not authorized to use that command!");
- }
- }
- else SendClientMessage(playerid, COLOR_GREY, "Invalid player specified.");
- return 1;
- }
- CMD:get(playerid, params[])
- {
- new giveplayerid;
- if(sscanf(params, "u", giveplayerid)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /gethere [playerid/partofname]");
- new Float:plocx,Float:plocy,Float:plocz;
- if(IsPlayerConnected(giveplayerid))
- {
- if(PlayerInfo[playerid][pAdmin] >= 2)
- {
- if(GetPlayerState(giveplayerid) == PLAYER_STATE_SPECTATING)
- {
- SendClientMessage(playerid, COLOR_GREY, "That player is spectating someone.");
- return 1;
- }
- GetPlayerPos(playerid, plocx, plocy, plocz);
- Streamer_UpdateEx(giveplayerid, plocx, plocy, plocz);
- SetPVarInt(playerid, "BeingTeleported", 1);
- if(GetPlayerState(giveplayerid) == 2)
- {
- TelePos[giveplayerid][0] = 0.0;
- TelePos[giveplayerid][1] = 0.0;
- fVehSpeed[giveplayerid] = 0.0;
- new tmpcar = GetPlayerVehicleID(giveplayerid);
- SetVehiclePos(tmpcar, plocx, plocy+4, plocz);
- LinkVehicleToInterior(GetPlayerVehicleID(giveplayerid), GetPlayerInterior(playerid));
- SetPlayerInterior(giveplayerid, GetPlayerInterior(playerid));
- SetVehicleVirtualWorld(GetPlayerVehicleID(giveplayerid), GetPlayerVirtualWorld(playerid));
- SetPlayerVirtualWorld(giveplayerid, GetPlayerVirtualWorld(playerid));
- }
- else
- {
- SetPlayerPos(giveplayerid,plocx,plocy+2, plocz);
- }
- SetPlayerInterior(giveplayerid, GetPlayerInterior(playerid));
- SetPlayerVirtualWorld(giveplayerid, GetPlayerVirtualWorld(playerid));
- new playeridvw = GetPlayerVirtualWorld(playerid);
- PlayerInfo[giveplayerid][pVW] = playeridvw;
- SendClientMessage(giveplayerid, COLOR_WHITE, "You have been teleported!");
- }
- else
- {
- SendClientMessage(playerid, COLOR_GREY, "You're not authorized to use that command!");
- }
- }
- else SendClientMessage(playerid, COLOR_GREY, "Invalid player specified.");
- return 1;
- }
- CMD:spec(playerid, params[])
- {
- if(PlayerInfo[playerid][pAdmin] < 1)
- {
- SendClientMessage(playerid, COLOR_GREY, "You're not authorized to use that command!");
- return 1;
- }
- if(strcmp(params, "off", true) == 0)
- {
- if(Spectating[playerid] > 0 && PlayerInfo[playerid][pAdmin] >= 1)
- {
- GettingSpectated[Spectate[playerid]] = 999;
- Spectating[playerid] = 0;
- Spectate[playerid] = 999;
- SetPVarInt(playerid, "SpecOff", 1);
- TogglePlayerSpectating(playerid, false);
- SetCameraBehindPlayer(playerid);
- return 1;
- }
- else
- {
- SendClientMessage(playerid, COLOR_GREY, "You're not spectating anyone.");
- return 1;
- }
- }
- if(strcmp(params, "o", true) == 0)
- {
- if(Spectating[playerid] > 0 && PlayerInfo[playerid][pAdmin] >= 1)
- {
- GettingSpectated[Spectate[playerid]] = 999;
- Spectating[playerid] = 0;
- Spectate[playerid] = 999;
- SetPVarInt(playerid, "SpecOff", 1);
- TogglePlayerSpectating(playerid, false);
- SetCameraBehindPlayer(playerid);
- return 1;
- }
- else
- {
- SendClientMessage(playerid, COLOR_GREY, "You're not spectating anyone.");
- return 1;
- }
- }
- new giveplayerid;
- if(sscanf(params, "u", giveplayerid)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /spec (player/off)");
- if(IsPlayerConnected(giveplayerid))
- {
- if(Spectating[playerid] == 0)
- {
- new Float: pPositions[ 3 ];
- GetPlayerPos(playerid, pPositions[0], pPositions[1], pPositions[2]);
- SetPVarFloat(playerid, "SpecPosX", pPositions[0]);
- SetPVarFloat(playerid, "SpecPosY", pPositions[1]);
- SetPVarFloat(playerid, "SpecPosZ", pPositions[2]);
- SetPVarInt(playerid, "SpecInt", GetPlayerInterior(playerid));
- SetPVarInt(playerid, "SpecVW", GetPlayerVirtualWorld(playerid));
- if(IsPlayerInAnyVehicle(giveplayerid))
- {
- TogglePlayerSpectating(playerid, true);
- new carid = GetPlayerVehicleID(giveplayerid);
- PlayerSpectateVehicle(playerid, carid);
- SetPlayerInterior(playerid, GetPlayerInterior(giveplayerid));
- SetPlayerVirtualWorld(playerid, GetPlayerVirtualWorld(giveplayerid));
- }
- else
- {
- TogglePlayerSpectating(playerid, true);
- PlayerSpectatePlayer(playerid, giveplayerid);
- SetPlayerInterior(playerid, GetPlayerInterior(giveplayerid));
- SetPlayerVirtualWorld(playerid, GetPlayerVirtualWorld(giveplayerid));
- }
- GettingSpectated[giveplayerid] = playerid;
- Spectate[playerid] = giveplayerid;
- Spectating[playerid] = 1;
- }
- else
- {
- if(IsPlayerInAnyVehicle(giveplayerid))
- {
- TogglePlayerSpectating(playerid, true);
- new carid = GetPlayerVehicleID(giveplayerid);
- PlayerSpectateVehicle(playerid, carid);
- SetPlayerInterior(playerid, GetPlayerInterior(giveplayerid));
- SetPlayerVirtualWorld(playerid, GetPlayerVirtualWorld(giveplayerid));
- }
- else
- {
- TogglePlayerSpectating(playerid, true);
- PlayerSpectatePlayer(playerid, giveplayerid);
- SetPlayerInterior(playerid, GetPlayerInterior(giveplayerid));
- SetPlayerVirtualWorld(playerid, GetPlayerVirtualWorld(giveplayerid));
- }
- GettingSpectated[Spectate[playerid]] = 999;
- GettingSpectated[giveplayerid] = playerid;
- Spectate[playerid] = giveplayerid;
- Spectating[playerid] = 1;
- }
- }
- else
- {
- SendClientMessage(playerid, COLOR_WHITE, "Invalid Player");
- }
- return 1;
- }
- CMD:aduty(playerid, params[]) {
- if(PlayerInfo[playerid][pAdmin] >= 1)
- {
- new string[128];
- switch(aDuty[playerid]) {
- case 0: {
- aDuty[playerid] = 1;
- SetPlayerHealth(playerid, 500000);
- SetPlayerArmour(playerid, 500000);
- format(string, sizeof(string), "{AA3333}AdmWarning{FFFF00}: %s is now on administrative duty.", GetPlayerNameEx(playerid));
- BroadCast(COLOR_GREEN, " An administrative team member is now on duty.");
- SetPlayerChatBubble(playerid,"Admin Duty" ,COLOR_GREEN,60.0,999999999999999);
- SetPlayerColor(playerid,COLOR_GREEN);
- ABroadCast(COLOR_YELLOW, string, 4);
- }
- case 1: {
- aDuty[playerid] = 0;
- SetPlayerHealth(playerid, 100);
- SetPlayerArmour(playerid, 100);
- format(string, sizeof(string), "{AA3333}AdmWarning{FFFF00}: %s is now off administrative duty.", GetPlayerNameEx(playerid));
- SetPlayerColor(playerid,TEAM_HIT_COLOR);
- SetPlayerChatBubble(playerid,"Admin Duty OFF" ,COLOR_GREEN,60.0,1);
- ABroadCast(COLOR_YELLOW, string, 4);
- }
- }
- }
- else
- {
- return Error(playerid, "You are not authorized to use this command.");
- }
- return 1;
- }
- CMD:oban(playerid, params[])
- {
- if(PlayerInfo[playerid][pAdmin] >= 3)
- {
- new targetname[24], filestring[79];
- if(sscanf(params, "s[24]", targetname)) return SendClientMessage(playerid, COLOR_GREY, "Usage: /oban [Player's Name]");
- format(filestring, sizeof(filestring), "/Users/%s.ini", targetname);
- if(!fexist(filestring)) return SendClientMessage(playerid, -COLOR_GREY, "Player was not found!");
- else
- {
- new INI:File = INI_Open(filestring);
- INI_SetTag(File, "data");
- INI_WriteInt(File, "Banned", 1);
- INI_Close(File);
- new done[128];
- new string[128];
- format(done, sizeof(done), "You have offline banned %s", targetname);
- format(string, sizeof(string), "{AA3333}AdmWarning{FFFF00}: %s has offline banned %s's account.", GetPlayerNameEx(playerid), targetname);
- ABroadCast(COLOR_YELLOW, string, 4);
- SendClientMessage(playerid,-1 , done);
- }
- }
- return 1;
- }
- CMD:unban(playerid, params[])
- {
- if(PlayerInfo[playerid][pAdmin] >= 3)
- {
- new tname[24];
- if(sscanf(params, "s[24]", tname)) return SendClientMessage(playerid,COLOR_GREY,"Usage: /unban [Player Name] ");
- new filestring[79];
- format(filestring, sizeof(filestring), "/Users/%s.ini", tname);
- if(!fexist(filestring)) return SendClientMessage(playerid, COLOR_GREY, "Invalid Offline Player.");
- else
- {
- new INI:File = INI_Open(filestring);
- INI_SetTag(File, "data");
- INI_WriteInt(File, "Banned",0);
- INI_Close(File);
- INI_ParseFile(filestring, "LoadIP_%s", .bExtra = true , .extra = playerid);
- new cmdstring[44];
- format(cmdstring, sizeof(cmdstring), "unbanip %s", PlayerInfo[playerid][BannedIP]);
- SendRconCommand(cmdstring);
- SendRconCommand("reloadbans");
- new done[128];
- format(done, sizeof(done),"You have successfully unbanned %s", tname);
- SendClientMessage(playerid, -1,done);
- new string[128];
- format(string, sizeof(string), "{AA3333}AdmWarning{FFFF00}: %s has unbanned %s's account.", GetPlayerNameEx(playerid), tname);
- ABroadCast(COLOR_YELLOW, string, 4);
- }
- }
- return 1;
- }
- CMD:veh(playerid, params[]) {
- if (PlayerInfo[playerid][pAdmin] >= 1) {
- new iColors[2], vName[32];
- if(!sscanf(params, "s[32]ii", vName, iColors[0], iColors[1]))
- {
- new idx;
- if (!IsNumeric(vName))
- {
- idx = GetVehicleModelIDFromName(vName);
- }
- else
- {
- idx = strval(vName);
- }
- if( idx != -1 )
- {
- if(idx > MIN_VEHI_ID && idx < MAX_VEHI_ID)
- {
- if(!(0 <= iColors[0] <= 255 && 0 <= iColors[1] <= 255)) {
- SendClientMessage(playerid, COLOR_GRAD2, "Invalid colour specified (IDs start at 0, and end at 255).");
- }
- else for(new iIterator; iIterator < sizeof(CreatedCars); iIterator++) if(CreatedCars[iIterator] == INVALID_VEHICLE_ID) {
- new
- Float: fVehPos[4], string[128];
- GetPlayerPos(playerid, fVehPos[0], fVehPos[1], fVehPos[2]);
- GetPlayerFacingAngle(playerid, fVehPos[3]);
- CreatedCars[iIterator] = CreateVehicleEx(idx, fVehPos[0], fVehPos[1], fVehPos[2], fVehPos[3], iColors[0], iColors[1], -1);
- LinkVehicleToInterior(CreatedCars[iIterator], GetPlayerInterior(playerid));
- format(string, sizeof(string), "Successfully spawned a %s (Vehicle Model: %d, Vehicle ID: %d, Color 1: %d, Color 2: %d)", VehicleName[idx - MIN_VEHI_ID], idx, CreatedCars[iIterator], iColors[0], iColors[1]);
- return SendClientMessage(playerid, COLOR_GREY, string);
- }
- }
- else
- {
- SendClientMessage(playerid, COLOR_GRAD2, " Invalid Model Name/ID");
- }
- }
- else
- {
- SendClientMessage(playerid, COLOR_GRAD2, " Invalid Model Name/ID!");
- }
- }
- else
- {
- SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /veh [Model ID/Name] [color 1] [color 2]");
- return 1;
- }
- }
- else SendClientMessage(playerid, COLOR_GRAD1, "You are not authorized to use that command!");
- return 1;
- }
- CMD:o(playerid, params[])
- {
- new string[258];
- if(PlayerInfo[playerid][pAdmin] >= 1)
- {
- if(isnull(params))
- return SendClientMessage(playerid, COLOR_WHITE, "USAGE: (/o) [Text]");
- }
- else SendClientMessage(playerid, COLOR_GRAD1, "You are not authorized to use that command!");
- {
- if(PlayerInfo[playerid][pAdmin] == 1)
- {
- format(string, sizeof(string), "{B7B748}Junior Admin: {FF0000}%s: {FFFFFF}%s", GetName(playerid), params);
- SendClientMessageToAll(COLOR_RED, string);
- }
- if(PlayerInfo[playerid][pAdmin] == 2)
- {
- format(string, sizeof(string), "{B7B748}General Admin: {FF0000}%s: {FFFFFF}%s", GetName(playerid), params);
- SendClientMessageToAll(COLOR_RED, string);
- }
- if(PlayerInfo[playerid][pAdmin] == 3)
- {
- format(string, sizeof(string), "{B7B748}Head Admin: {FF0000}%s: {FFFFFF}%s", GetName(playerid), params);
- SendClientMessageToAll(COLOR_RED, string);
- }
- if(PlayerInfo[playerid][pAdmin] == 4)
- {
- format(string, sizeof(string), "[OOC]{B7B748}Director: {FF0000}%s: {FFFFFF}%s", GetName(playerid), params);
- SendClientMessageToAll(COLOR_RED, string);
- }
- }
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement