Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* Administrator Filterscript: Fostering your administrative needs
- * Created by ~Pawno~
- * Edited and fixed (Bugs + Text) by Jake/Syntax/Dooks
- As a holder of this script, we do not ask that your retain the original author's rights, as we understand that nobody ever listens.
- However, we ask that you please do not re-release the script under your name. Should you wish to release the script
- if it has been edited or re-written, please ask ~Pawno or Syntax beforehand.
- */
- #define FILTERSCRIPT
- ////////////////////
- // INCLUDES ////////
- ////////////////////
- #include <a_samp>
- #include <sscanf2>
- #include <YSI\y_ini>
- #include <YSI\y_commands>
- #include <YSI\y_master>
- #include <cardefines>
- #include <strtok>
- #pragma tabsize 0
- ////////////////////
- // DIALOG DEFINES //
- ////////////////////
- #define DIALOG_REGISTER 1
- #define DIALOG_LOGIN 2
- #define DIALOG_SUCCESS_1 3
- #define DIALOG_SUCCESS_2 4
- ////////////////////
- // OTHER DEFINES ///
- ////////////////////
- #define PATH "/aAdmin/Users/%s.ini"
- ////////////////////
- // COLOUR DEFINES//
- ////////////////////
- #define COL_WHITE 0xFFFFFFFF
- #define COL_GREY "{C3C3C3}"
- #define COL_GREY2 0xC0C0C0AA
- #define COL_GREY3 0xD8D8D8FF
- #define COL_CYAN "{00FFEE}"
- #define COL_PINK "{FFFF00}"
- #define COL_PINK2 0xFF66FFAA
- #define COL_RED "{FF0000}"
- #define COL_RED2 "{FF0000}"
- #define COL_RED3 0xFF0000FF
- #define COL_YELLOWEMBED "{CCCCCC}"
- #define COL_GREEN 0x21DD00FF
- #define COL_PURPLE 0xB360FDFF
- #define COL_BLUE 0x2641FEAA
- #define COL_BLACK 0x000000FF
- #define COL_ORANGE 0xFF830000
- #define COL_YELLOW 0xF5DEB3AA
- #define COL_LIGHTBLUE 0x00C2ECFF
- //////////////////////////////
- // PLAYER POSITION DEFINES //
- //////////////////////////////
- enum PlayerPosition // Primarily here for the use of "/s" and "/r".
- {
- Float:XPos,
- Float:YPos,
- Float:ZPos,
- Float:PAngle,
- SavedPosition
- }
- ///////////////////////
- // PLAYER VARIABLES //
- ///////////////////////
- enum pInfo
- {
- aPass,
- aCash,
- aAdmin,
- aKills,
- aDeaths,
- aBanned,
- aSpawnVehicle,
- HasVehicleSpawned,
- CarFix,
- Heal,
- bool:aCanSpawnVehicle
- }
- ////////////////////////////
- // MISCELLANEOUS DEFINES //
- ////////////////////////////
- new pName[MAX_PLAYER_NAME];
- new IsPlayerAway[MAX_PLAYERS];
- new PPosition[MAX_PLAYERS][PlayerPosition];
- new PlayerInfo[MAX_PLAYERS][pInfo];
- new PMEnabled[MAX_PLAYER_NAME];
- new Float:pX, Float:pY, Float:pZ, Float:pAngle;
- new VehicleNames[212][] = {
- {"Landstalker"},{"Bravura"},{"Buffalo"},{"Linerunner"},{"Perrenial"},{"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 1"},{"Previon"},
- {"Coach"},{"Cabbie"},{"Stallion"},{"Rumpo"},{"RC Bandit"},{"Romero"},{"Packer"},{"Monster"},
- {"Admiral"},{"Squalo"},{"Seasparrow"},{"Pizzaboy"},{"Tram"},{"Trailer 2"},{"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"},{"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"},{"Cropdust"},{"Stunt"},
- {"Tanker"}, {"Roadtrain"},{"Nebula"},{"Majestic"},{"Buccaneer"},{"Shamal"},{"Hydra"},{"FCR-900"},
- {"NRG-500"},{"HPV1000"},{"Cement Truck"},{"Tow Truck"},{"Fortune"},{"Cadrona"},{"FBI Truck"},
- {"Willard"},{"Forklift"},{"Tractor"},{"Combine"},{"Feltzer"},{"Remington"},{"Slamvan"},
- {"Blade"},{"Freight"},{"Streak"},{"Vortex"},{"Vincent"},{"Bullet"},{"Clover"},{"Sadler"},
- {"Firetruck LA"},{"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 Flat"},{"Streak Carriage"},{"Kart"},{"Mower"},{"Duneride"},{"Sweeper"},
- {"Broadway"},{"Tornado"},{"AT-400"},{"DFT-30"},{"Huntley"},{"Stafford"},{"BF-400"},{"Newsvan"},
- {"Tug"},{"Trailer 3"},{"Emperor"},{"Wayfarer"},{"Euros"},{"Hotdog"},{"Club"},{"Freight Carriage"},
- {"Trailer 3"},{"Andromada"},{"Dodo"},{"RC Cam"},{"Launch"},{"Police Car (LSPD)"},{"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"}};
- ///////////////////////////
- // USERNAMES (user.ini) //
- ///////////////////////////
- public LoadUser_data(playerid,name[],value[])
- {
- INI_Int("aPassword",PlayerInfo[playerid][aPass]);
- INI_Int("aCash",PlayerInfo[playerid][aCash]);
- INI_Int("aAdmin",PlayerInfo[playerid][aAdmin]);
- INI_Int("aKills",PlayerInfo[playerid][aKills]);
- INI_Int("aDeaths",PlayerInfo[playerid][aDeaths]);
- INI_Int("aBanned",PlayerInfo[playerid][aBanned]);
- return 1;
- }
- ////////////////////
- // FORWARDS ///////
- ////////////////////
- forward LoadUser_data(playerid,name[],value[]);
- forward MessageToAdmins(color,const string[]);
- forward RandomMessages();
- forward GodUpdate();
- forward GetVehicleModelIDFromName(vname[]);
- forward SendMessageToAdmins(color,const string[]);
- ////////////////////////////
- // STOCKS & MISC PUBLICS //
- ////////////////////////////
- public MessageToAdmins(color,const string[])
- {
- for(new i = 0; i < MAX_PLAYERS; i++)
- {
- if(IsPlayerConnected(i) == 1) if (PlayerInfo[i][aAdmin] > 1) SendClientMessage(i, color, string);
- }
- return 1;
- }
- stock UserPath(playerid)
- {
- new string[128],uPlayername[MAX_PLAYER_NAME];
- GetPlayerName(playerid,uPlayername,sizeof(uPlayername));
- format(string,sizeof(string),PATH,uPlayername);
- return string;
- }
- stock pName3(playerid)
- {
- new name[MAX_PLAYER_NAME];
- GetPlayerName(playerid, name, sizeof(name));
- return name;
- }
- stock PlayerName(playerid)
- {
- new pName[25];
- GetPlayerName(playerid, pName, sizeof(pName));
- return pName;
- }
- stock PlayerName2(playerid) {
- new name[MAX_PLAYER_NAME];
- GetPlayerName(playerid, name, sizeof(name));
- return name;
- }
- stock IsNumeric(string[])
- {
- for (new i = 0, j = strlen(string); i < j; i++)
- {
- if (string[i] > '9' || string[i] < '0') return 0;
- }
- return 1;
- }
- stock ReturnPlayerID(PlayerName[])
- {
- for(new i = 0; i < MAX_PLAYERS; i++)
- {
- if(IsPlayerConnected(i))
- {
- if(strfind(pName3(i),PlayerName,true)!=-1) return i;
- }
- }
- return INVALID_PLAYER_ID;
- }
- ////////////////////
- // WHIRLPOOL //////
- ////////////////////
- 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;
- }
- //////////////////////////////
- // FILTERSCRIPT INITIATION //
- /////////////////////////////
- public OnFilterScriptInit()
- {
- print(" ");
- print("Administration Filterscript:");
- print("Created by ~Pawno, assisted by Jake");
- print(" ");
- SetTimer("ChangeHostName",5000,1);
- SetTimer("RandomMessages", 30000,1);
- return 1;
- }
- public OnPlayerConnect(playerid)
- {
- // For player positions and private messages
- PPosition[playerid][SavedPosition] = 0;
- PlayerInfo[playerid][CarFix] = 0;
- PlayerInfo[playerid][Heal] = 0;
- PMEnabled[playerid] = 1;
- //register & login dialog
- if(fexist(UserPath(playerid)))
- {
- INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
- if(PlayerInfo[playerid][aBanned] == 1) return SendClientMessage(playerid, -1, ""COL_GREY"You are "COL_PINK"banned {FFFFFF}from the server.");
- if(PlayerInfo[playerid][aBanned] == 1) return Ban(playerid);
- ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD,""COL_CYAN"Login","{FFFFFF}Type your password below to login:","Login"," ");
- }
- else
- {
- ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD,""COL_CYAN"Registration","{FFFFFF}Type your password below to register a new account:","Register"," ");
- }
- // Admin colour for level 1 administrators
- if(PlayerInfo[playerid][aAdmin] > 1)
- {
- SetPlayerColor(playerid, 0x00FFEEEE); // CYAN
- }
- return 1;
- }
- // Random script messages
- new randomMessages[][] =
- {
- // It's easy to add more lines, just remember to add a comma (,) at the end of each line, but not the last one.
- ""#COL_PINK"[SERVER] {FFFFFF}If you need any help type /help or ask an admin!",
- ""#COL_PINK"[SERVER]{FFFFFF} Be sure to register on our forums at http://URL.com", // Be sure to edt this appropriately to your forum or website!
- ""#COL_PINK"[SERVER]{FFFFFF} Did you know, you can spawn a car by typing /car [name] instead!",
- ""#COL_PINK"[SERVER]{FFFFFF} Please ensure that you abide by all of the rules",
- ""#COL_PINK"[SERVER]{FFFFFF} Did you know, there are 52 states in all of the United States of America?",
- ""#COL_PINK"[SERVER]{FFFFFF} Please do not spam the game chat: doing so may result in a temporary ban, kick or mute!",
- ""#COL_PINK"[SERVER]{FFFFFF} Welcome to SERVER NAME" // Be sure to edit this to your server/community name!
- // ""#COL_PINK"[SERVER]{FFFFFF} Meeeow!", // Incase you wish to add some more in!
- // ""#COL_PINK"[SERVER]{FFFFFF} Meeeow!",
- // ""#COL_PINK"[SERVER]{FFFFFF} Meeeow!",
- // ""#COL_PINK"[SERVER]{FFFFFF} Meeeow!",
- // ""#COL_PINK"[SERVER]{FFFFFF} MEeeow!" // Just a random one
- };
- public RandomMessages()
- {
- new randomMsg = random(sizeof(randomMessages));
- SendClientMessageToAll(-1, randomMessages[randomMsg]);
- }
- public OnPlayerDisconnect(playerid, reason)
- {
- // SAVING user data:
- new INI:File = INI_Open(UserPath(playerid));
- INI_SetTag(File,"data");
- INI_WriteInt(File,"aCash",GetPlayerMoney(playerid));
- INI_WriteInt(File,"aAdmin",PlayerInfo[playerid][aAdmin]);
- INI_WriteInt(File,"aKills",PlayerInfo[playerid][aKills]);
- INI_WriteInt(File,"aDeaths",PlayerInfo[playerid][aDeaths]);
- INI_WriteInt(File,"aBanned",PlayerInfo[playerid][aBanned]);
- INI_Close(File);
- return 1;
- }
- // Admin Message: Leached from LAdmin, credits to original author.
- public SendMessageToAdmins(color,const string[])
- {
- for(new i = 0; i < MAX_PLAYERS; i++)
- {
- if(IsPlayerConnected(i) == 1)
- if(PlayerInfo[i][aAdmin] > 1)
- SendClientMessage(i, color, string);
- }
- return 1;
- }
- public OnPlayerDeath(playerid, killerid, reason)
- {
- // Updates the killers total kills and the victims total deaths!
- PlayerInfo[killerid][aKills]++;
- PlayerInfo[playerid][aDeaths]++;
- return 1;
- }
- // Primarily for administrative messages:
- public OnPlayerText(playerid, text[])
- {
- if(text[0] == '#' && PlayerInfo[playerid][aAdmin] > 1) {
- new string[128]; GetPlayerName(playerid,string,sizeof(string));
- format(string,sizeof(string),""#COL_PINK"Sig:{FFFFFF} %s "#COL_PINK": %s",string,text[1]); MessageToAdmins(-1,string);
- return 0;
- }
- return 1;
- }
- // For /GOD and /GODCAR commands.
- public GodUpdate()
- {
- for(new i = 0; i < MAX_PLAYERS; i++)
- {
- if(IsPlayerConnected(i) && PlayerInfo[i][Heal] == 1)
- {
- SetPlayerHealth(i,100000);
- }
- if(IsPlayerConnected(i) && PlayerInfo[i][CarFix] == 1 && IsPlayerInAnyVehicle(i))
- {
- RepairVehicle(GetPlayerVehicleID(i));
- }
- }
- }
- //////////////////////
- // COMMANDS BEGIN ////
- //////////////////////
- YCMD:acmds(playerid,params[], help)
- {
- if(PlayerInfo[playerid][aAdmin] > 1)
- {
- SendClientMessage(playerid, -1,""#COL_PINK"[SERVER]{FFFFFF} /promote - /kick - /ban");
- SendClientMessage(playerid, -1,""#COL_PINK"[SERVER]{FFFFFF} /respawncars - /spam - /cardel - /goto");
- SendClientMessage(playerid, -1,""#COL_PINK"[SERVER]{FFFFFF} /admins - # (Admin chat)");
- return 1;
- }
- else SendClientMessage(playerid, -1,""#COL_PINK"[SERVER]{FFFFFF} You have to be an admin to use /acmds!");
- return 1;
- }
- YCMD:afk(playerid, params[], help)
- {
- new string[48];
- GetPlayerName(playerid, pName, sizeof(pName));
- format(string, sizeof(string), "%s is now AFK (Away from Keyboard).", pName);
- SendClientMessageToAll(COL_GREY2, string);
- SetPlayerFacingAngle(playerid,0);
- TogglePlayerControllable(playerid, 0);
- IsPlayerAway[playerid] = 1;
- return 1;
- }
- YCMD:back(playerid, params[], help)
- {
- new string[48];
- GetPlayerName(playerid, pName, sizeof(pName));
- format(string, sizeof(string), "%s has returned.", pName);
- SendClientMessageToAll(COL_GREY2, string);
- SetPlayerFacingAngle(playerid, 264.3768);
- TogglePlayerControllable(playerid, 1);
- IsPlayerAway[playerid] = 0;
- return 1;
- }
- YCMD:pj1(playerid, params[], help)
- {
- if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, -1, ""#COL_PINK"[SERVER] {FFFFFF}You have to be in a vehicle");
- ChangeVehiclePaintjob(GetPlayerVehicleID(playerid),0);
- return 1;
- }
- YCMD:pj2(playerid, params[], help)
- {
- if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, -1, ""#COL_PINK"[SERVER] {FFFFFF}You have to be in a vehicle");
- ChangeVehiclePaintjob(GetPlayerVehicleID(playerid),1);
- return 1;
- }
- YCMD:pj3(playerid, params[], help)
- {
- if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, -1, ""#COL_PINK"[SERVER] {FFFFFF}You have to be in a vehicle");
- ChangeVehiclePaintjob(GetPlayerVehicleID(playerid),2);
- return 1;
- }
- YCMD:pj4(playerid, params[], help)
- {
- if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, -1, ""#COL_PINK"[SERVER] {FFFFFF}You have to be in a vehicle");
- ChangeVehiclePaintjob(GetPlayerVehicleID(playerid),3);
- return 1;
- }
- YCMD:god(playerid, params[], help)
- {
- if(PlayerInfo[playerid][Heal] == 0)
- {
- PlayerInfo[playerid][Heal] = 1;
- SetPlayerHealth(playerid,100000); // Sets your health to 100,000!
- SendClientMessage(playerid,-1,"{FFFFFF}You have enabled Godmode! To go off God mode, type: "#COL_PINK"/god.");
- }
- else
- {
- PlayerInfo[playerid][Heal] = 0;
- SendClientMessage(playerid,-1,"{FFFFFF}You have disabled Godmode! To go back on to God mode, type: "#COL_PINK"/god{FFFFFF}.");
- SetPlayerHealth(playerid, 100);
- }
- return 1;
- }
- YCMD:godcar(playerid, params[], help)
- {
- if(IsPlayerInAnyVehicle(playerid))
- {
- if(PlayerInfo[playerid][CarFix] == 0)
- {
- PlayerInfo[playerid][CarFix] = 1;
- return SendClientMessage(playerid,-1,"{FFFFFF}Godcar turned on,to turn off type "#COL_PINK"/godcar{FFFFFF} again.");
- }
- else
- {
- PlayerInfo[playerid][CarFix] = 0;
- return SendClientMessage(playerid,-1,"{FFFFFF}Godcar turned off,to turn on again type "#COL_PINK"/godcar");
- }
- }
- else
- return SendClientMessage(playerid,-1,""#COL_PINK"ERROR:{FFFFFF} You need to be in a car to use this command");
- }
- YCMD:skin(playerid, params[], help) // Un-tested!
- {
- new id;
- if(sscanf(params,"i",id)) return SendClientMessage(playerid,COL_RED3,""#COL_PINK"[SERVER]{FFFFFF}Command: /skin id");
- if(id<0 || id>299) return SendClientMessage(playerid,COL_RED3,""#COL_PINK"[SERVER]{FFFFFF}Please use IDs from 0 to 299");
- SetPlayerSkin(playerid,id);
- new msg[50];
- format(msg,sizeof(msg),""#COL_PINK"[SERVER]{FFFFFF}Your skin has been set to ID %d",id);
- return SendClientMessage(playerid,-1,msg);
- }
- YCMD:fr(playerid, params[], help)
- {
- new vehicleid=GetPlayerVehicleID(playerid);
- RepairVehicle(vehicleid);
- SendClientMessage(playerid,-1, ""#COL_PINK"[SERVER] {FFFFFF}Your Vehicle has been fixed!");
- return 1;
- }
- YCMD:flip(playerid, params[], help)
- {
- if(IsPlayerInAnyVehicle(playerid))
- {
- new currentveh;
- new Float:angle;
- currentveh = GetPlayerVehicleID(playerid);
- GetVehicleZAngle(currentveh, angle);
- SetVehicleZAngle(currentveh, angle);
- SendClientMessage(playerid, -1, "{FFFFFF}Your vehicle has been flipped.");
- return 1;
- }
- else
- {
- SendClientMessage(playerid, -1, "{FFFFFF}You are not in any vehicle!");
- return 1;
- }
- }
- //=======================================================================================================
- YCMD:me(playerid, params[], help)
- {
- if(!params[2])return SendClientMessage(playerid, -1, "{FFFFFF}Command: /me [action]");
- new str[128];
- GetPlayerName(playerid, str, sizeof(str));
- format(str, sizeof(str), "* %s %s", str, params[0]);
- SendClientMessageToAll(COL_YELLOW, str);
- return 1;
- }
- YCMD:cc(playerid, params[], help) // To change the colour of your vehicle.
- {
- if(IsPlayerInAnyVehicle(playerid))
- {
- new tmp[128], idx;
- new color1, color2;
- tmp = strtok(params, idx);
- if(!strlen(tmp)) return SendClientMessage(playerid, -1, ""#COL_PINK"[SERVER] {FFFFFF}/cc (color1) (color2)");
- color1 = strval(tmp);
- tmp = strtok(params, idx);
- if(!strlen(tmp)) return SendClientMessage(playerid, -1, ""#COL_PINK"[SERVER] {FFFFFF}/cc (color1) (color2)");
- color2 = strval(tmp);
- ChangeVehicleColor(GetPlayerVehicleID(playerid), color1, color2);
- }
- else
- {
- SendClientMessage(playerid, -1, ""#COL_PINK"[SERVER] {FFFFFF}You are not in a vehicle!");
- }
- return 1;
- }
- YCMD:s(playerid, params[], help) // Saves your current position incase you wish to relog.
- {
- new Float:x,Float:y,Float:z,Float:angle;
- if(IsPlayerInAnyVehicle(playerid))
- {
- GetVehiclePos(GetPlayerVehicleID(playerid),x,y,z);
- GetVehicleZAngle(GetPlayerVehicleID(playerid),angle);
- PPosition[playerid][XPos] = x;
- PPosition[playerid][YPos] = y;
- PPosition[playerid][ZPos] = z;
- PPosition[playerid][PAngle] = angle;
- SendClientMessage(playerid,-1, ""#COL_PINK"[SERVER] {FFFFFF}Position saved! Type "#COL_PINK"/r {FFFFFF}to teleport back!");
- }
- else
- {
- GetPlayerPos(playerid,x,y,z);
- GetPlayerFacingAngle(playerid,angle);
- PPosition[playerid][XPos] = x;
- PPosition[playerid][YPos] = y;
- PPosition[playerid][ZPos] = z;
- PPosition[playerid][PAngle] = angle;
- SendClientMessage(playerid,-1, ""#COL_PINK"[SERVER] {FFFFFF}Position saved! Type "#COL_PINK"/r {FFFFFF}to teleport back!");
- }
- PPosition[playerid][SavedPosition] = 1;
- return 1;
- }
- YCMD:r(playerid, params[], help) // Warps you to your previously saved position (/s)
- {
- if(PPosition[playerid][SavedPosition] == 0) return SendClientMessage(playerid,-1, ""#COL_PINK"[SERVER] {FFFFFF}You don't have any position saved! "#COL_PINK"(/s)");
- if(IsPlayerInAnyVehicle(playerid))
- {
- SetVehiclePos(GetPlayerVehicleID(playerid),PPosition[playerid][XPos],PPosition[playerid][YPos],PPosition[playerid][ZPos]);
- SetVehicleZAngle(GetPlayerVehicleID(playerid),PPosition[playerid][PAngle]);
- SendClientMessage(playerid,-1, ""#COL_PINK"[SERVER] {FFFFFF}Position loaded!");
- }
- else
- {
- SetPlayerPos(playerid,PPosition[playerid][XPos],PPosition[playerid][YPos],PPosition[playerid][ZPos]);
- SetPlayerFacingAngle(playerid,PPosition[playerid][PAngle]);
- SendClientMessage(playerid,-1, ""#COL_PINK"[SERVER] {FFFFFF}Position loaded!");
- }
- return 1;
- }
- YCMD:admins(playerid, params[], help)
- {
- new Count[2], i, string[128];
- for(i = 0; i < MAX_PLAYERS; i++) if(IsPlayerConnected(i))
- {
- if(PlayerInfo[i][aAdmin] > 0) Count[0]++;
- if(IsPlayerAdmin(i)) Count[1]++;
- }
- if( (Count[0] == 0 && Count[1] == 0) || (Count[0] == 0 && Count[1] >= 1 && PlayerInfo[playerid][aAdmin] == 0) ) return SendClientMessage(playerid, -1, ""#COL_PINK"[SERVER]{FFFFFF}No admins available at this moment.");
- if(Count[0] == 1) {
- for(i = 0; i < MAX_PLAYERS; i++) if(IsPlayerConnected(i) && PlayerInfo[i][aAdmin] > 0) {
- format(string, sizeof(string), "{FFFFFF}Admin:"COL_CYAN" (%d)%s [%d]", i, PlayerName2(i), PlayerInfo[i][aAdmin] ); SendClientMessage(playerid, COL_GREY2, string);
- }
- }
- if(Count[0] > 1) {
- new x; format(string, sizeof(string), ""#COL_PINK"Admins:{FFFFFF} ");
- for(i = 0; i < MAX_PLAYERS; i++) if(IsPlayerConnected(i) && PlayerInfo[i][aAdmin] > 0)
- {
- format(string,sizeof(string),"{FFFFFF}%s(%d)%s [%d]",string,i,PlayerName2(i),PlayerInfo[i][aAdmin]);
- x++;
- if(x > 5) {
- SendClientMessage(playerid, COL_GREY2, string); format(string, sizeof(string), ""#COL_PINK"Admins:{FFFFFF} "); x = 0;
- }
- else format(string, sizeof(string), "{FFFFFF}%s, ", string);
- }
- if(x <= 4 && x > 0) {
- string[strlen(string)-3] = '.';
- SendClientMessage(playerid, COL_GREY2, string);
- }
- }
- if( (Count[1] == 1) && (PlayerInfo[playerid][aAdmin] > 0) ) {
- for(i = 0; i < MAX_PLAYERS; i++) if(IsPlayerConnected(i) && IsPlayerAdmin(i)) {
- format(string, sizeof(string), ""#COL_PINK"RCON Admin: {FFFFFF}(%d)%s", i, PlayerName2(i)); SendClientMessage(playerid, COL_WHITE, string);
- }
- }
- if(Count[1] > 1) {
- new x; format(string, sizeof(string), ""#COL_PINK"RCON Admins:{FFFFFF} ");
- for(i = 0; i < MAX_PLAYERS; i++) if(IsPlayerConnected(i) && IsPlayerAdmin(i))
- {
- format(string,sizeof(string),"{FFFFFF}%s(%d)%s",string,i,PlayerName2(i));
- x++;
- if(x > 5) {
- SendClientMessage(playerid, COL_WHITE, string); format(string, sizeof(string), ""#COL_PINK"RCON Admins:{FFFFFF} "); x = 0;
- }
- else format(string, sizeof(string), "{FFFFFF}%s, ", string);
- }
- if(x < 4 && x > 0) {
- string[strlen(string)-3] = '.';
- SendClientMessage(playerid, COL_WHITE, string);
- }
- }
- return 1;
- }
- YCMD:promote(playerid, params[], help)
- {
- new id, level;
- if(IsPlayerAdmin(playerid))
- {
- if(sscanf(params, "ud", id, level)) return SendClientMessage(playerid, -1, ""#COL_PINK"[SERVER]{FFFFFF} Command: /promote [playerid/name] [level]");
- else
- {
- if(level > 5) return SendClientMessage(playerid, -1, ""#COL_PINK"[SERVER]{FFFFFF} Only levels 1-5 allowed.");
- else
- {
- PlayerInfo[id][aAdmin] = level;
- }
- }
- }
- else return SendClientMessage(playerid, -1, ""#COL_PINK"[SERVER]{FFFFFF} You must be a member of staff to execute this command.");
- return 1;
- }
- YCMD:report(playerid, params[], help)
- {
- new Target;
- new Reason[128];
- if(!sscanf(params, "us[32]",Target, Reason))
- {
- if(Target == playerid) return SendClientMessage(playerid, -1, ""#COL_PINK"[SERVER]{FFFFFF} Usage: Cant perform this command on yourself!");
- if(!IsPlayerConnected(Target))
- return SendClientMessage(playerid, -1, ""#COL_PINK"[SERVER]{FFFFFF} The chosen player is not currently connected.");
- new tname[MAX_PLAYER_NAME];
- new pname[MAX_PLAYER_NAME];
- GetPlayerName(Target,tname,sizeof(tname));
- GetPlayerName(playerid,pname,sizeof(pname));
- new rstring[256];
- format(rstring,sizeof(rstring),"* Player %s(%d) reported %s(%d)! (Reason: %s)", pname,playerid,tname,Target,Reason);
- SendMessageToAdmins(COL_WHITE,rstring);
- }
- else return SendClientMessage(playerid, -1, ""#COL_PINK"[SERVER]{FFFFFF} Command: /report [Player ID] [Reason]");
- return 1;
- }
- YCMD:t(playerid, params[], help)
- {
- new hour[24];
- new string[128];
- if(!strlen(params))
- {
- SendClientMessage(playerid, -1, ""#COL_PINK"[SERVER] {FFFFFF}/t [0-24]");
- return 1;
- }
- new hour2 = strval(params);
- if(hour2 < 0 || hour2 > 24)
- {
- SendClientMessage(playerid, -1, ""#COL_PINK"[SERVER] {FFFFFF}/t [0-24]");
- return 1;
- }
- SetPlayerTime(playerid, hour2, 0);
- format(string,sizeof(string), ""#COL_PINK"[SERVER] {FFFFFF}You changed your time!", hour);
- SendClientMessage(playerid, -1, string);
- return 1;
- }
- YCMD:w(playerid, params[], help)
- {
- new string[128];
- if(!strlen(params))
- {
- SendClientMessage(playerid, -1, ""#COL_PINK"[SERVER] {FFFFFF}/w [0-45]");
- return 1;
- }
- new weather = strval(params);
- if(weather < 0 || weather > 45)
- {
- SendClientMessage(playerid, -1, ""#COL_PINK"[SERVER] {FFFFFF}/w [0-45]");
- return 1;
- }
- SetPlayerWeather(playerid, weather);
- format(string,sizeof(string), ""#COL_PINK"[SERVER] {FFFFFF}You changed your weather to ID:%d!", weather);
- SendClientMessage(playerid, -1, string);
- return 1;
- }
- YCMD:kick(playerid, params[], help)
- {
- if(PlayerInfo[playerid][aAdmin] > 2)
- {
- new PID;
- new reason[64];
- new str[128];
- new Playername[MAX_PLAYER_NAME], Adminname[MAX_PLAYER_NAME];
- GetPlayerName(playerid, Adminname, sizeof(Adminname));
- GetPlayerName(PID, Playername, sizeof(Playername));
- if(sscanf(params, "us[64]", PID,reason)) return SendClientMessage(playerid, -1, ""#COL_PINK"[SERVER]{FFFFFF} Command: /kick [playerid] [reason]");
- if(!IsPlayerConnected(PID))
- return SendClientMessage(playerid, -1, "{FFFFFF}Player is not connected!");
- format(str, sizeof(str), ""#COL_PINK"'%s' {FFFFFF}has been kicked by administrator "#COL_PINK"'%s'. {FFFFFF}Reason: "#COL_PINK"%s ", Playername, Adminname, reason);
- SendClientMessageToAll(-1, str);
- Kick(PID);
- }
- else
- {
- SendClientMessage(playerid, -1, "You have to be level 3 to use that command!");
- }
- return 1;
- }
- YCMD:ban(playerid, params[], help)
- {
- if(PlayerInfo[playerid][aAdmin] > 3)
- {
- new PID;
- new reason[64];
- new str[128];
- new Playername[MAX_PLAYER_NAME], Adminname[MAX_PLAYER_NAME];
- GetPlayerName(playerid, Adminname, sizeof(Adminname));
- GetPlayerName(PID, Playername, sizeof(Playername));
- if(sscanf(params, "us[64]", PID,reason)) return SendClientMessage(playerid, -1, ""#COL_PINK"[SERVER]{FFFFFF} Command: /ban [playerid] [reason]");
- if(!IsPlayerConnected(PID))
- return SendClientMessage(playerid, -1, "{FFFFFF}Player is not connected!");
- format(str, sizeof(str), ""#COL_PINK"'%s' {FFFFFF}has been banned by administrator "#COL_PINK"'%s'. {FFFFFF}Reason: "#COL_PINK"%s ", Playername, Adminname, reason);
- SendClientMessageToAll(-1, str);
- Ban(PID);
- }
- else
- {
- SendClientMessage(playerid, -1, "You have to be level 3 to use that command!");
- }
- return 1;
- }
- YCMD:goto(playerid, params[], help)
- {
- if(!strlen(params)) return SendClientMessage(playerid,-1,""#COL_PINK"[SERVER]{FFFFFF} /goto [playerid]");
- new player1, string[128];
- if(!IsNumeric(params)) player1 = ReturnPlayerID(params);
- else player1 = strval(params);
- if(IsPlayerConnected(player1) && player1 != INVALID_PLAYER_ID && player1 != playerid)
- {
- new Float:x, Float:y, Float:z; GetPlayerPos(player1,x,y,z); SetPlayerInterior(playerid,GetPlayerInterior(player1));
- SetPlayerVirtualWorld(playerid,GetPlayerVirtualWorld(player1));
- if(GetPlayerState(playerid) == 2)
- {
- SetVehiclePos(GetPlayerVehicleID(playerid),x+3,y,z);
- LinkVehicleToInterior(GetPlayerVehicleID(playerid),
- GetPlayerInterior(player1));
- SetVehicleVirtualWorld(GetPlayerVehicleID(playerid),
- GetPlayerVirtualWorld(player1));
- }
- else SetPlayerPos(playerid,x+2,y,z);
- format(string, sizeof(string), ""#COL_PINK"[SERVER]{FFFFFF}You have teleported to \"%s\"", pName3(player1));
- return SendClientMessage(playerid,-1,string);
- }
- else return SendClientMessage(playerid, -1, ""#COL_PINK"[SERVER] {FFFFFF}Player is not connected or is yourself");
- }
- YCMD:pm(playerid, params[], help)
- {
- if(IsPlayerConnected(playerid))
- {
- new pID, Message[60],zplayername[MAX_PLAYER_NAME],targetName[MAX_PLAYER_NAME],string[128],string2[128];
- if(sscanf(params, "us[60]", pID, Message)) return SendClientMessage(playerid, 0xAFAFAFAA, "Command: /pm [PlayerID/PlayerName] [Message]");
- if(pID == INVALID_PLAYER_ID) return SendClientMessage(playerid, 0xAFAFAFAA, "Invalid Player");
- if(PMEnabled[playerid] == 0) return SendClientMessage(playerid, 0xAFAFAFAA, "PM Is Disabled");
- GetPlayerName(pID, targetName, sizeof(targetName));
- GetPlayerName(playerid, zplayername, sizeof(zplayername));
- format(string, sizeof(string), "Private Message from %s: %s", zplayername, Message);
- format(string2, sizeof(string2), "Private Message sent to %s: %s", targetName, Message);
- SendClientMessage(playerid, 0xFFFF00AA, string2);
- SendClientMessage(pID, 0xFFFF00AA, string);
- }
- return 1;
- }
- YCMD:togpm(playerid, params[], help)
- {
- if(isnull(params)) return SendClientMessage(playerid, 0xFFFFFFFF, "Command: /togpm [on/off]");
- if(strcmp(params, "on", true ) == 0 )
- {
- PMEnabled[playerid] = 1;
- SendClientMessage(playerid, -1, "{FFFFFF}[SERVER]"#COL_PINK" You have unblocked your Personal Messaging arrival.");
- }
- else if( strcmp( params, "off", true ) == 0 )
- {
- PMEnabled[playerid] = 0;
- SendClientMessage(playerid, 0xAA3333AA, "{FFFFFF}[SERVER]"#COL_PINK" You have blocked Personal Messages from arriving.");
- }
- else SendClientMessage(playerid, -1,"{FFFFFF}[SERVER]"#COL_PINK" Command: /togpm [on/off]");
- return 1;
- }
- YCMD:car(playerid, params[], help)
- {
- new Vehicle[32], VehicleID, ColorOne, ColorTwo;
- PlayerInfo[playerid][aCanSpawnVehicle] = true;
- if(sscanf(params, "s[32]D(1)D(1)", Vehicle, ColorOne, ColorTwo))
- {
- PlayerInfo[playerid][aCanSpawnVehicle] = true;
- SendClientMessage(playerid, -1,""#COL_PINK"[SERVER]{FFFFFF}/car [name/id] [colour 1] [colour 2]");
- return 1;
- }
- if(PlayerInfo[playerid][aCanSpawnVehicle])
- {
- VehicleID = GetVehicleModelIDFromName(Vehicle);
- if(VehicleID != 425 && VehicleID != 432 && VehicleID != 447 &&
- VehicleID != 430 && VehicleID != 417 && VehicleID != 435 &&
- VehicleID != 446 && VehicleID != 449 && VehicleID != 450 &&
- VehicleID != 452 && VehicleID != 453 && VehicleID != 454 &&
- VehicleID != 460 && VehicleID != 464 && VehicleID != 465 &&
- VehicleID != 469 && VehicleID != 472 && VehicleID != 473 &&
- VehicleID != 476 && VehicleID != 484 && VehicleID != 487 &&
- VehicleID != 488 && VehicleID != 493 && VehicleID != 497 &&
- VehicleID != 501 && VehicleID != 511 && VehicleID != 512 &&
- /*stuntplane - VehicleID != 513 &&*/ VehicleID != 519 && // hydra - VehicleID != 520 &&
- VehicleID != 537 && VehicleID != 538 && VehicleID != 548 &&
- VehicleID != 553 && VehicleID != 563 && VehicleID != 564 &&
- VehicleID != 569 && VehicleID != 570 && VehicleID != 577 &&
- VehicleID != 584 && VehicleID != 590 && VehicleID != 591 &&
- VehicleID != 592 && VehicleID != 593 && VehicleID != 594 &&
- VehicleID != 595 && VehicleID != 606 && VehicleID != 607 &&
- VehicleID != 608 && VehicleID != 610 && VehicleID != 611) {
- if(VehicleID == -1 )
- {
- VehicleID = strval(Vehicle);
- if(VehicleID < 400 || VehicleID > 611 )
- {
- return SendClientMessage(playerid, -1,""#COL_PINK"[SERVER]{FFFFFF}You entered an invalid vehiclename!");
- }
- }
- GetPlayerPos(playerid, pX, pY, pZ);
- GetPlayerFacingAngle(playerid, pAngle);
- DestroyVehicle(PlayerInfo[playerid][aSpawnVehicle]);
- PlayerInfo[playerid][aSpawnVehicle] = CreateVehicle(VehicleID, pX, pY, pZ+2.0, pAngle, ColorOne, ColorTwo, -1);
- LinkVehicleToInterior(PlayerInfo[playerid][aSpawnVehicle], GetPlayerInterior(playerid));
- PutPlayerInVehicle(playerid, PlayerInfo[playerid][aSpawnVehicle], 0);
- SendClientMessage(playerid, -1, ""#COL_PINK"[SERVER]{FFFFFF}You succesfully spawned this vehicle!");
- }
- }
- return 1;
- }
- YCMD:spam(playerid, params[], help)
- {
- if(PlayerInfo[playerid][aAdmin] > 1)
- {
- new Colour, msg[128],string[128];
- if(sscanf(params, "is[128]", Colour, msg))
- {
- SendClientMessage(playerid, -1, ""#COL_PINK"Command: /spam [Colour] [Text]");
- SendClientMessage(playerid, -1, "{FFFFFF}Colours: [0]Black, [1]White, [2]Red, [3]Orange, [4]Yellow, [5]Green, [6]Blue, [7]Purple, [8]Brown, [9]Pink");
- SendClientMessage(playerid, -1, "{FFFFFF}Function: Will sending the chosen messages in to the chat box with the specified colour.");
- return 1;
- }
- if(Colour > 9) return SendClientMessage(playerid, COL_RED3, "Colours:");
- format(string,sizeof(string),"%s",msg);
- if(Colour == 0) for(new i; i < 50; i++) SendClientMessageToAll(COL_BLACK,string);
- else if(Colour == 1) for(new i; i < 50; i++) SendClientMessageToAll(COL_WHITE,string);
- else if(Colour == 2) for(new i; i < 50; i++) SendClientMessageToAll(COL_RED3,string);
- else if(Colour == 3) for(new i; i < 50; i++) SendClientMessageToAll(COL_ORANGE,string);
- else if(Colour == 4) for(new i; i < 50; i++) SendClientMessageToAll(COL_YELLOW,string);
- else if(Colour == 5) for(new i; i < 50; i++) SendClientMessageToAll(COL_GREEN,string);
- else if(Colour == 6) for(new i; i < 50; i++) SendClientMessageToAll(COL_BLUE,string);
- else if(Colour == 7) for(new i; i < 50; i++) SendClientMessageToAll(COL_PURPLE,string);
- else if(Colour == 8) for(new i; i < 50; i++) SendClientMessageToAll(COL_LIGHTBLUE,string);
- else if(Colour == 9) for(new i; i < 50; i++) SendClientMessageToAll(COL_PINK2,string);
- return 1;
- }
- SendClientMessage(playerid, -1, ""#COL_PINK"[SERVER] "#COL_RED"Fatal Error: You must be a member of staff to execute the given command.");
- return 1;
- }
- ////////////////////
- // COMMANDS END ////
- ////////////////////
- public GetVehicleModelIDFromName(vname[])
- {
- for(new i = 0; i < 211; i++)
- {
- if ( strfind(VehicleNames[i], vname, true) != -1 )
- return i + 400;
- }
- return -1;
- }
- public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
- {
- switch( dialogid )
- {
- case DIALOG_REGISTER:
- {
- if (!response) return Kick(playerid);
- if(response)
- {
- if(!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, ""COL_CYAN"Account Registration:",""COL_PINK"You have specified an invalid password.\n{FFFFFF}Type a valid password below to register:","Register"," ");
- new INI:File = INI_Open(UserPath(playerid));
- INI_SetTag(File,"data");
- INI_WriteInt(File,"aPassword",udb_hash(inputtext));
- INI_WriteInt(File,"aCash",0);
- INI_WriteInt(File,"aAdmin",0);
- INI_WriteInt(File,"aKills",0);
- INI_WriteInt(File,"aDeaths",0);
- INI_Close(File);
- ShowPlayerDialog(playerid, DIALOG_SUCCESS_1, DIALOG_STYLE_MSGBOX,""COL_CYAN"Server Account:","{FFFFFF}Fantastic! You have sucessfully registered.\nWhen you next relog, your statistics will save!","Ok","");
- }
- }
- case DIALOG_LOGIN:
- {
- if ( !response ) return Kick ( playerid );
- if( response )
- {
- if(udb_hash(inputtext) == PlayerInfo[playerid][aPass])
- {
- INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
- GivePlayerMoney(playerid, PlayerInfo[playerid][aCash]);
- ShowPlayerDialog(playerid, DIALOG_SUCCESS_2, DIALOG_STYLE_MSGBOX,""COL_CYAN"Server Account:","{FFFFFF}You have successfully logged in!","Ok","");
- }
- else
- {
- ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD,""COL_CYAN"Account Authorization:",""COL_PINK"You have specified an invalid password.\n{FFFFFF}Type your correct password below to login:","Login"," ");
- }
- return 1;
- }
- }
- }
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment