Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define GAAC_version "1.0.0"
- /*
- _____________________________________________________________________________________________________________________________________________
- | #GAAC v. 1.0.0
- |
- | GAAC FS - Green Administration and Anti-Cheat Filterscript
- | Copyright © André "DeathOnaStick" Brandenburger
- |
- | You are kindly requested to not modify this script and also to not copy (non-blacklist-related) code that is,
- | summed up in this script, longer than 50 lines. The copying of blacklist-related code is strictly prohibited!
- |
- | Also, the modification of blacklist-related code/features is strictly prohibited!
- | Inappropriate behavior and/or usage for inappropriate purposes will result in a server-ban.
- | By this ban you will not be able to use the main features of GAAC anymore.
- | Thank you for your understanding.
- |
- |_____________________________________________________________________________________________________________________________________________
- -----!!!---------!!!---------!!!---------!!!---------!!!---------!!!---------!!!---------!!!---------!!!---------!!!---------!!!------
- ------------------------------------------------------#-CONFIGURATION SECTION-#-------------------------------------------------------
- --------------------------------------------#-Take your time to read and filling out-#------------------------------------------------
- --!!!---------!!!---------!!!---------!!!---------!!!---------!!!---------!!!---------!!!---------!!!---------!!!---------!!!---------
- */
- //#define SecuritySystemOnline
- //Enables my Security system basing on Local IP's and Names
- //default: commented.
- //if uncommented:
- //-->Kicks players, that connect to server with "LOCALNAME", when IP is not local.
- //-->Lets just "LocalName" kick and ban people.
- //(Comment it when LocalName is commented. Otherwise nobody will be able to kick and ban.)
- //if commented:
- //-->Every Admin with Level 5+ can kick and ban.
- //#define LOCALNAME "YOURNAME"
- //Name of the player, that joins from local IP. If there is none, comment it together with the one above.
- //local IP = LOCALHOST = 128.0.0.1
- #define SecureBanActive
- //Uses my SecureBan-methode for banning
- //default: uncommented
- //if uncommented:
- //-->Collects all IP's of banned people in "scriptfiles\GreenAAC\Banfiles\IPs.ini"
- //-->Creates a ban-file for every player that gets banned, e.g. "...\Banfiles\Ban.YOUR-NAME.ini"
- //-->Kicks everyone, that joins with a banned IP, like the default "Ban" does.
- //-->Blacklists a player, what means, he gets an entry into an Online-Database and will be banned
- // on every other server, that uses this Administration script and has the blacklist enabled.
- // For more info: blacklist.pytalhost.net
- //if commented:
- //-->May cause problems on single servers that encountered Problems with the ordinary Ban-System,
- // like I did with my server.
- #define PMKey "#"
- //The key you need to enter first for sending a PM
- //default: "#"
- //Example for default-value:
- //Player sends "#1 DeathOnaStick rocks!".
- //Sends "PM from UrName: DeathOnaStick rocks!" to the Player with ID 1
- //Comment the line to disable this function.
- #define ACKey "!"
- //The key you need to enter first for using the Admin-Chat
- //Useable for every Admin with level 4+.
- //default: "!"
- //Example for default "!":
- //Admin with level 4+ sends: "! DeathOnaStick is so cool!"
- //Admins with level 4+ will get: "[AC]UrName: DeathOnaStick is so cool!"
- //Comment the line to disable this function.
- #define RespawnDelay 3
- //Automatically Respawns all unused vehicles every n-hours
- //Comment the line to totally disable the function
- //default value: 3
- #define AntiWeaponHackActive
- //Warns players that get illegally purchased weapons, e.g. by using a weaponhack.
- //default: uncommented
- //Comment the line to disable this function
- #define DefaultMaxPing 750
- //The maximum ping. A player with a higher ping than MaxPing will be kicked.
- //Can be changed by using /maxping [value].
- //default value: 750
- //#define ServerLocked
- //commented if server should be unlocked, uncommented if locked.
- //If locked: Every player that joins the server must enter a password.
- //default: commented (unlocked)
- #define DefaultLockPassword \
- "Parabola"
- //Sets the default password for the server, if it is locked. Password can be changed through "/lock [pass]"
- //This is NOT the rcon-password! Also it's recommended to not take the rcon password as LockPassword.
- //#define CommandLog
- //Prints the commands that are used. Format: '[playerid]: [commandname]'
- //Parameters are not recorded. The Log may slow down the speed of the commands, including the server.
- //default: commented (=deactivated)
- //#define Blacklist
- //Enables the blacklist. Still in Beta.
- //With enabling this feature, you agree to the fact, that you neither are allowed to abuse this feature,
- //nor use it for illegal activity or illegal/unsocial purposes, no matter which reason you have.
- //You are not allowed to access neither over the here-given URL's,
- //nor over other ways to the Blacklist-Database, except within this script,
- //without having any changes done by a person,
- //that is not the Author of this whole script, including this agreement.
- //The author is always allowed to change terms of this agreement.
- //- 4. December 2010
- //- André Brandenburger
- //default: commented
- //If you agree to the agreement, that is written above,
- //you are allowed to enable the blacklist-feature.
- //#define UseGreenAACFolders
- //if uncommented: Player-files get saved in GreenAAC/Players
- // Banfiles get saved in GreenAAC/Banfiles
- // Logs get saved in GreenAAC/Logs
- // Positions get saved in GreenAAC/Positions
- //if commented: All files get saved in the scriptfiles folder itself.
- #define FORBIDDEN_WEAPONS 38
- //Defines the weapons, that are not used in the gamemode you run.
- //If you use every weapon, comment this line
- //Every player that has a weapon like this (which actually is impossible, instead he's cheating),
- //will get a warning. 5 Warnings = kick.
- //If you have more weapons that are unused, seperate the ID's by using a comma,
- //like: '#define FORBIDDEN_WEAPONS 38,47,48'
- //Just use if AntiWeaponHack is enabled.
- #define ACDebug
- #define SpamDelay 1500
- /*
- ---------------------------------------------------------------------------------------------------------------------------------------
- ------------------------------------------------- ---#-CONFIGURATION SECTION END-#-----------------------------------------------------
- END---------END---------END---------END---------END---------END---------END---------END---------END---------END---------END---------END
- */
- #include <a_samp>
- #include <dini>
- #include <dudb>
- #include <GInclude.inc>
- #include <a_http>
- native WP_Hash(buffer[], len, const str[]);
- #define COLOR_RED 0xAA3333AA
- #define COLOR_YELLOW 0xFFFF00AA
- #define COLOR_ORANGE 0xFF9900AA
- #define COLOR_GREEN 0x33AA33AA
- #define COLOR_LIGHTBLUE 0x33CCFFAA
- #define COLOR_WHITE 0xFFFFFFAA
- #define COLOR_SYSTEM 0xEFEFF7AA
- #define VTYPE_BIKE 4
- #define VTYPE_BMX VTYPE_BIKE
- #define VTYPE_PLANE 8
- #define VTYPE_HELI VTYPE_PLANE
- #define VTYPE_SEA 9
- #define VTYPE_BOAT VTYPE_SEA
- #define VTYPE_BICYCLE VTYPE_BMX
- #if defined CommandLog
- #define dcmd(%1,%2,%3) if (!strcmp((%3)[1], #%1, true, (%2)) &&!printf("%i: %s", playerid, #%1)&&((((%3)[(%2) + 1] == '\0') && (dcmd_%1(playerid, ""))) || (((%3)[(%2) + 1] == ' ') && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1
- #define cmd(%1) if (!strcmp((cmdtext[1]), #%1, true) && cmd_%1(playerid)&&!printf("%i: %s", playerid, #%1)) return 1
- #else
- #define dcmd(%1,%2,%3) if (!strcmp((%3)[1], #%1, true, (%2)) &&((((%3)[(%2) + 1] == '\0') && (dcmd_%1(playerid, ""))) || (((%3)[(%2) + 1] == ' ') && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1
- #define cmd(%1) if (!strcmp((cmdtext[1]), #%1, true) && cmd_%1(playerid)) return 1
- #endif
- #define INFINITY (Float:0x7F800000)
- #if !defined AntiWeaponHackActive
- #if defined ACDebug
- #undef ACDebug
- #endif
- #endif
- #if !defined LOCALNAME
- #if defined SecuritySystemOnline
- #undef SecuritySystemOnline
- #endif
- #endif
- #if !defined DefaultMaxPing
- #define DefaultMaxPing 999
- #endif
- #if !defined DefaultLockPassword
- #define DefaultLockPassword "changeME"
- #endif
- #if !defined ServerLocked
- #define ServerLocked 0
- #endif
- #if defined SpamDelay 0
- #undef SpamDelay
- #endif
- new PrisonSeat=5, PrisonCar, maxping=DefaultMaxPing, Srvrlckd=ServerLocked, SrvrPass[25]=DefaultLockPassword;
- #if defined Blacklist
- new bool:blonline=false;
- #endif
- public OnFilterScriptInit()
- {
- SetTimer("MessageShow", 1000, false);
- SetTimer("FiveMin", 300000, true);
- SetTimer("Update", (9482+random(58)), false);
- #if defined RespawnDelay
- SetTimer("NHours",(RespawnDelay*3600000), true);
- #endif
- PrisonCar=CreateVehicle(437, -1401.829956, 107.051300, 1032.273437, 0.0, 0, 1, -1);
- SetVehicleVirtualWorld(PrisonCar, 666);
- LinkVehicleToInterior(PrisonCar, 1);
- return PrisonCar, 1;
- }
- forward MessageShow();
- public MessageShow()
- {
- print("\n-----------------------------------------------");
- print("-------------------«»GAAC«»--------------------");
- print("-----------------------------------------------");
- print("©GAAC-Filterscript initialized");
- print("-----------------------------------------------");
- #if defined SecuritySystemOnline
- print("#Security System online");
- print("-----------------------------------------------");
- #else
- print("#Warning: Security System offline");
- print("-----------------------------------------------");
- #endif
- #if defined SecureBanActive
- print("#Secure-Ban activated");
- print("-----------------------------------------------");
- #else
- print("#Warning: Secure-Ban deactivated");
- print("-----------------------------------------------");
- #endif
- #if defined SecureBanActive
- print("#Anti Weaponhack activated");
- print("-----------------------------------------------");
- #else
- print("#Warning: Anti Weaponhack deactivated");
- print("-----------------------------------------------");
- #endif
- #if defined PMKey
- printf("#PM-System initialized. PMKey '%c'", PMKey);
- print("-----------------------------------------------");
- #endif
- #if defined ACKey
- printf("#AdminChat-System initialized. ACKey '%c'", ACKey);
- print("-----------------------------------------------");
- #endif
- #if defined RespawnDelay
- printf("#Respawning empty cars after %i Hours", RespawnDelay);
- print("-----------------------------------------------");
- #endif
- #if defined Blacklist
- PingBlacklist();
- #endif
- if(!fexist("GreenAAC/Players/GAACAdmin.ini"))
- {
- dini_Create("GreenAAC/Players/GAACAdmin.ini");
- new buf[145];
- new rconPass[128];
- GetServerVarAsString("rcon_password", rconPass, sizeof(rconPass));
- WP_Hash(buf, sizeof(buf), rconPass);
- dini_Set("GreenAAC/Players/GAACAdmin.ini","Password", buf);
- dini_IntSet("GreenAAC/Players/GAACAdmin.ini","AdminLevel", 6);
- dini_IntSet("GreenAAC/Players/GAACAdmin.ini","Cash", 90000000);
- dini_IntSet("GreenAAC/Players/GAACAdmin.ini","AmountKicked", 0);
- dini_IntSet("GreenAAC/Players/GAACAdmin.ini","AutoMsg", 0);
- dini_IntSet("GreenAAC/Players/GAACAdmin.ini", "Logged", 1);
- print("#Start-client created. Connect with \"GAACAdmin\". Log in with rcon-pass.");
- print("#Thank you for chosing GAAC!");
- print("-----------------------------------------------");
- }
- return 1;
- }
- #if defined RespawnDelay
- forward NHours();
- public NHours()
- {
- for(new i=0; i<MAX_VEHICLES; i++)
- {
- new pcount=0;
- for(new pl=0, tx=GetMaxPlayers(); pl<=tx; pl++)
- {
- if(IsPlayerConnected(pl))
- {
- if(GetPlayerVehicleID(pl)==i)
- {
- pcount++;
- break;
- }
- }
- }
- if(pcount==0)SetVehicleToRespawn(i);
- }
- return 1;
- }
- #endif
- forward FiveMin();
- public FiveMin()
- {
- #if defined Blacklist
- PingBlacklist();
- #endif
- for(new i=0, tx=GetMaxPlayers(); i<=tx; i++)if(IsPlayerConnected(i))if(IsPlayerLoggedIn(i))
- {
- if(IsPlayerConnected(i)&&!IsPlayerNPC(i))
- {
- if(IsPlayerLoggedIn(i))
- {
- SavePlayerData(i);
- if(GetPVarInt(i, "AutoMsg")==1)
- {
- SendClientMessage(i, COLOR_GREEN,"[System]: Autosaved your files. (/aoff to turn automessages off)");
- }
- }
- }
- }
- return 1;
- }
- #if defined AntiWeaponHackActive
- new PlayerWeapons[MAX_PLAYERS][47];
- new PlayerSpawnWeapons[MAX_PLAYERS][47];
- forward OnPlayerGetWeapon(playerid, weaponid, ammo);
- public OnPlayerGetWeapon(playerid, weaponid, ammo)
- {
- PlayerWeapons[playerid][weaponid]=1;
- if(weaponid==39)PlayerWeapons[playerid][40]=1; //Satchel charges + Remotes
- return 0;
- }
- forward OnPlayerResetWeapons(playerid);
- public OnPlayerResetWeapons(playerid)
- {
- for(new i=0; i<=47; i++)if(i!=PlayerSpawnWeapons[playerid][1]&&i!=PlayerSpawnWeapons[playerid][2]&&
- i!=PlayerSpawnWeapons[playerid][3]&&i!=0)PlayerWeapons[playerid][i]=0;
- return 0;
- }
- forward OnPlayerSetSpawnInfo(playerid, weaponid1, ammo1, weaponid2, ammo2, weaponid3, ammo3);
- public OnPlayerSetSpawnInfo(playerid, weaponid1, ammo1, weaponid2, ammo2, weaponid3, ammo3)
- {
- PlayerWeapons[playerid][weaponid1]=1;
- PlayerWeapons[playerid][weaponid2]=1;
- PlayerWeapons[playerid][weaponid3]=1;
- PlayerSpawnWeapons[playerid][1]=weaponid1;
- PlayerSpawnWeapons[playerid][2]=weaponid2;
- PlayerSpawnWeapons[playerid][3]=weaponid3;
- return 0;
- }
- public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
- {
- if(!ispassenger&&GetVehicleModel(vehicleid)>=596&&GetVehicleModel(vehicleid)<=599)PlayerWeapons[playerid][25]=1;
- return 1;
- }
- public OnPlayerExitVehicle(playerid, vehicleid)
- {
- if(GetVehicleType(vehicleid)==VTYPE_HELI||GetVehicleType(vehicleid)==VTYPE_PLANE)PlayerWeapons[playerid][46]=1;
- return 1;
- }
- #endif
- stock GetWeaponSlot(weaponid)
- {
- new slot=-1;
- switch(weaponid)
- {
- case 0,1:slot=0;
- case 2,3,4,5,6,7,8,9:slot=1;
- case 10,11,12,13,14,15: slot=10;
- case 16,17,18,39:slot=8;
- case 22,23,24:slot=2;
- case 25,26,27:slot=3;
- case 28,29,32:slot=4;
- case 30,31:slot=5;
- case 33,34:slot=6;
- case 35,36,37,38:slot=7;
- case 40:slot=12;
- case 41,42,43:slot=9;
- case 44,45,46:slot=11;
- }
- return slot;
- }
- forward Update();
- public Update()
- {
- for(new playerid=0, tx=GetMaxPlayers(); playerid<=tx; playerid++)
- {
- if(IsPlayerConnected(playerid)&&IsPlayerNPC(playerid)==0)
- {
- if(GetPlayerPing(playerid)>maxping)
- {
- SendClientMessage(playerid, COLOR_RED, "Sorry, your Ping is too high. You have been kicked.");
- return Kick(playerid);
- }
- #if defined AntiWeaponHackActive
- for(new ws=0; ws<=12; ws++)
- {
- new amm, wep;
- GetPlayerWeaponData(playerid, ws, wep, amm);
- if(PlayerWeapons[playerid][wep]==1&&amm==0)PlayerWeapons[playerid][wep]=0;
- }
- #if defined FORBIDDEN_WEAPONS
- switch(GetPlayerWeapon(playerid))
- {
- case 0: return 1;
- case FORBIDDEN_WEAPONS:
- {
- #if defined ACDebug
- WriteToACDebugFile(playerid);
- #endif
- ResetPlayerWeaponsEx(playerid);
- new wString[60];
- SetPVarInt(playerid, "PlayerWarnings", GetPVarInt(playerid, "PlayerWarnings")+1);
- format(wString, sizeof(wString), "[System]: Bad Weapon detected! WARNING [%i/5]", GetPVarInt(playerid, "PlayerWarnings"));
- SendClientMessage(playerid, COLOR_RED, wString);
- if(GetPVarInt(playerid, "PlayerWarnings")>=5)Kick(playerid);
- return 1;
- }
- default:{} // = do nothing
- }
- #endif
- switch(PlayerWeapons[playerid][GetPlayerWeapon(playerid)])
- {
- case 0:
- {
- if(GetPlayerInterior(playerid)==1||GetPlayerInterior(playerid)==4||
- GetPlayerInterior(playerid)==6||GetPlayerInterior(playerid)==7||
- GetPlayerWeapon(playerid)==0)
- {
- PlayerWeapons[playerid][GetPlayerWeapon(playerid)]=1;
- return 1;
- }
- else
- {
- #if defined ACDebug
- WriteToACDebugFile(playerid);
- #endif
- ResetPlayerWeaponsEx(playerid);
- new wString[60];
- SetPVarInt(playerid, "PlayerWarnings", GetPVarInt(playerid, "PlayerWarnings")+1);
- format(wString, sizeof(wString), "[System]: Bad Weapon detected! WARNING [%i/5]", GetPVarInt(playerid, "PlayerWarnings"));
- SendClientMessage(playerid, COLOR_RED, wString);
- if(GetPVarInt(playerid, "PlayerWarnings")>=5)Kick(playerid);
- }
- }
- default:{}
- }
- #endif
- }
- }
- SetTimer("Update", (9482+random(random(132))), false);
- return 1;
- }
- #if defined AntiWeaponHackActive
- public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
- {
- if(newkeys&128||newkeys&KEY_FIRE)
- {
- if(!IsPlayerNPC(playerid))
- {
- for(new ws=0; ws<=12; ws++)
- {
- new amm, wep;
- GetPlayerWeaponData(playerid, ws, wep, amm);
- if(PlayerWeapons[playerid][wep]==1&&amm==0)PlayerWeapons[playerid][wep]=0;
- }
- switch(GetPlayerWeapon(playerid))
- {
- case 0: return 1;
- case 38:
- {
- #if defined ACDebug
- WriteToACDebugFile(playerid);
- #endif
- ResetPlayerWeaponsEx(playerid);
- new wString[60];
- SetPVarInt(playerid, "PlayerWarnings", GetPVarInt(playerid, "PlayerWarnings")+1);
- format(wString, sizeof(wString), "[System]: Bad Weapon detected! WARNING [%i/5]", GetPVarInt(playerid, "PlayerWarnings"));
- SendClientMessage(playerid, COLOR_RED, wString);
- if(GetPVarInt(playerid, "PlayerWarnings")>=5)Kick(playerid);
- return 1;
- }
- default:{}
- }
- switch(PlayerWeapons[playerid][GetPlayerWeapon(playerid)])
- {
- case 0:
- {
- if(GetPlayerInterior(playerid)==1||GetPlayerInterior(playerid)==4||
- GetPlayerInterior(playerid)==6||GetPlayerInterior(playerid)==6||GetPlayerInterior(playerid)==7)
- {
- PlayerWeapons[playerid][GetPlayerWeapon(playerid)]=1;
- return 1;
- }
- else
- {
- #if defined ACDebug
- WriteToACDebugFile(playerid);
- #endif
- ResetPlayerWeaponsEx(playerid);
- new wString[60];
- SetPVarInt(playerid, "PlayerWarnings", GetPVarInt(playerid, "PlayerWarnings")+1);
- format(wString, sizeof(wString), "[System]: Bad Weapon detected! WARNING [%i/5]", GetPVarInt(playerid, "PlayerWarnings"));
- SendClientMessage(playerid, COLOR_RED, wString);
- if(GetPVarInt(playerid, "PlayerWarnings")>=5)Kick(playerid);
- }
- }
- default:{}
- }
- }
- }
- return 1;
- }
- #endif
- public OnPlayerDeath(playerid, killerid, reason)
- {
- #if defined AntiWeaponHackActive
- switch(reason)
- {
- case FORBIDDEN_WEAPONS:
- {
- #if defined ACDebug
- WriteToACDebugFile(killerid);
- #endif
- new wString[30];
- SetPVarInt(killerid, "PlayerWarnings", GetPVarInt(killerid, "PlayerWarnings")+1);
- format(wString, sizeof(wString), "[System]: Bad Weapon detected! WARNING [%i/5]", GetPVarInt(killerid, "PlayerWarnings"));
- SendClientMessage(killerid, COLOR_RED, wString);
- if(GetPVarInt(killerid, "PlayerWarnings")>=5)Kick(killerid);
- }
- }
- #endif
- return 1;
- }
- public OnPlayerConnect(playerid)
- {
- if(!IsPlayerNPC(playerid))
- {
- new cIP[16];
- GetPlayerIp(playerid, cIP, sizeof(cIP));
- #if defined UseGreenAACFolders
- if(fexist("GreenAAC/Banfiles/IPs.ini")==1 && dini_Isset("GreenAAC/Banfiles/IPs.ini", cIP)==1)
- #else
- if(fexist("IPs.ini")==1 && dini_Isset("GreenAAC/Banfiles/IPs.ini", cIP)==1)
- #endif
- {
- SendClientMessage(playerid,COLOR_SYSTEM, "[System]: You're banned from this server!");
- Kick(playerid);
- return 0;
- }
- new ConnectName[MAX_PLAYER_NAME];
- GetPlayerName(playerid, ConnectName, sizeof(ConnectName));
- new filename[26+MAX_PLAYER_NAME];
- #if defined UseGreenAACFolders
- format(filename, sizeof(filename), "GreenAAC/Banfiles/Ban.%s.ini", ConnectName);
- #else
- format(filename, sizeof(filename), "Ban.%s.ini", ConnectName);
- #endif
- if(fexist(filename))
- {
- if(!strcmp(cIP,dini_Get(filename, "IP"),true)) //dini_Get(filename, "IP") = OldIP
- {
- SendClientMessage(playerid, COLOR_SYSTEM, "[System]: You're banned from this server!");
- Kick(playerid);
- return 0;
- }
- else
- {
- SendClientMessage(playerid, COLOR_SYSTEM, "[System]: You are banned from this Server.");
- SendClientMessage(playerid, COLOR_SYSTEM, "[System]: If you think you have been banned accidentially,");
- SendClientMessage(playerid, COLOR_SYSTEM, "[System]: post on our website. Thanks for your understanding.");
- new WebStr[100],weburl[35];
- GetServerVarAsString("weburl", weburl, sizeof(weburl));
- if(!strlen(weburl))SendClientMessage(playerid, COLOR_SYSTEM, "[System]: (Sorry, but there is no website yet.)");
- else
- {
- format(WebStr, sizeof(WebStr), "[System]: Our Website: http://%s ", weburl);
- SendClientMessage(playerid, COLOR_SYSTEM, WebStr);
- }
- Kick(playerid);
- return 0;
- }
- }
- #if defined Blacklist
- GetPlayerVerification(playerid);
- new tmpID;
- tmpID=SetTimerEx("PVCheck", (2*1000*60), false, "i", playerid); //2 minutes 'deadline'
- SetPVarInt(playerid, "PVCheckID", tmpID);
- #endif
- #if defined SecuritySystemOnline
- if(strcmp(ConnectName, LOCALNAME, false, sizeof(ConnectName))==0)
- {
- if(strcmp(cIP, "127.0.0.1", false, sizeof(cIP))==0)SendClientMessage(playerid,COLOR_GREEN, "Welcome Master.");
- else if(strcmp(cIP, "127.0.0.1", false, sizeof(cIP))==1)
- {
- new SecurityString[50+16+MAX_PLAYER_NAME];
- SendClientMessageToAll(COLOR_RED, "Deception detected!");
- format(SecurityString, sizeof(SecurityString), "%s [IP:%s] has been kicked for an attempt of deception!", ConnectName, cIP);
- SendClientMessageToAll(COLOR_RED, SecurityString);
- printf("\n[SECURITY] %s [%s] tried to connect with the Admin-Name %s! Player has been kicked!\n", ConnectName, cIP, ConnectName);
- Kick(playerid);
- }
- }
- #endif
- new file[21+MAX_PLAYER_NAME];
- #if defined UseGreenAACFolders
- format(file, sizeof(file), "GreenAAC/Players/%s.ini", ConnectName);
- #else
- format(file, sizeof(file), "%s.ini", ConnectName);
- #endif
- if(fexist(file))SendClientMessage(playerid, COLOR_SYSTEM, "[System]: Your Account already exists. Please use /glogin to log in.");
- if(!fexist(file))
- {
- SendClientMessage(playerid, COLOR_SYSTEM,"[System]: You don't have an Account. Please register with /gregister, to save your progress.");
- }
- if(Srvrlckd)ShowPlayerDialog(playerid, 404, DIALOG_STYLE_INPUT, "Server is locked.", "Password", "Try", "Exit");
- }
- return 1;
- }
- public OnPlayerDisconnect(playerid, reason)
- {
- if(IsPlayerLoggedIn(playerid))
- {
- SavePlayerData(playerid);
- if(!IsPlayerNPC(playerid))
- {
- new file[MAX_PLAYER_NAME+20];
- new PName[MAX_PLAYER_NAME];
- GetPlayerName(playerid, PName, sizeof(PName));
- #if defined UseGreenAACFolders
- format(file,sizeof(file),"GreenAAC/Players/%s.ini",PName);
- #else
- format(file,sizeof(file),"%s.ini",PName);
- #endif
- dini_IntSet(file, "Logged", 0);
- }
- }
- if(GetPVarInt(playerid, "BL_verif")!=1)KillTimer(GetPVarInt(playerid, "PVCheckID"));
- return 1;
- }
- public OnPlayerText(playerid, text[])
- {
- if(GetPVarInt(playerid, "PlayerMuted")==1)
- {
- new wString[40];
- SetPVarInt(playerid, "PlayerWarnings", GetPVarInt(playerid, "PlayerWarnings")+1);
- format(wString, sizeof(wString), "[System]: YOU ARE MUTED! WARNING [%i/5]", GetPVarInt(playerid, "PlayerWarnings"));
- SendClientMessage(playerid, COLOR_RED, wString);
- if(GetPVarInt(playerid, "PlayerWarnings")>=5)Kick(playerid);
- return 0;
- }
- #if defined SpamDelay
- else if((GetTickCount()-GetPVarInt(playerid, "SpamTick"))<(SpamDelay))
- {
- new sString[60];
- SetPVarInt(playerid, "PlayerWarnings", GetPVarInt(playerid, "PlayerWarnings")+1);
- format(sString, sizeof(sString), "[System]: Spamming is not allowed! WARNING [%i/5]", GetPVarInt(playerid, "PlayerWarnings"));
- SendClientMessage(playerid, COLOR_RED, sString);
- if(GetPVarInt(playerid, "PlayerWarnings")>=5)Kick(playerid);
- SetPVarInt(playerid, "SpamTick", GetTickCount());
- return 0;
- }
- #endif
- #if defined PMKey
- else
- {
- #if defined SpamDelay
- SetPVarInt(playerid, "SpamTick", GetTickCount());
- #endif
- if(strfind(text, PMKey, true)==0)
- {
- new idString[10];
- new saPos=2;
- if(strfind(text, " ", true)==saPos)
- {
- strmid(idString, text, 1, saPos);
- if(text[saPos-1] > '9' || text[saPos-1] < '0')
- {
- new wootString[30];
- format(wootString, sizeof(wootString), "Usage: \"%c[playerid] [Text]\"", PMKey);
- SendClientMessage(playerid, COLOR_SYSTEM, wootString);
- return 0;
- }
- if(IsPlayerConnected(strval(idString)))
- {
- strdel(text, 0, saPos);
- new pmString1[128],pmString2[128], senderName[MAX_PLAYER_NAME], getName[MAX_PLAYER_NAME];
- GetPlayerName(playerid, senderName, sizeof(senderName));
- GetPlayerName(strval(idString), getName, sizeof(getName));
- format(pmString1, sizeof(pmString1), "PM to %s:%s", getName, text);
- format(pmString2, sizeof(pmString2), "PM from %s:%s", senderName, text);
- SendClientMessage(playerid, COLOR_YELLOW, pmString1);
- SendClientMessage(strval(idString), COLOR_YELLOW, pmString2);
- return 0;
- }
- else
- {
- new wootString[55];
- format(wootString, sizeof(wootString), "Player not found! Usage: \"%c[playerid] [Text]\"", PMKey);
- SendClientMessage(playerid, COLOR_SYSTEM, wootString);
- return 0;
- }
- }
- else
- {
- new bool:wu=false;
- while(strfind(text, " ", true)!=saPos && wu==false)
- {
- if(text[saPos-1] > '9' || text[saPos-1] < '0')
- {
- if(wu==false)
- {
- new wootString[30];
- format(wootString, sizeof(wootString), "Usage: \"%c[playerid] [Text]\"", PMKey);
- SendClientMessage(playerid, COLOR_SYSTEM, wootString);
- wu=true;
- return 0;
- }
- }
- saPos++;
- }
- strmid(idString, text, 1, saPos);
- if(IsPlayerConnected(strval(idString)))
- {
- strdel(text, 0, saPos);
- new pmString1[128],pmString2[128], senderName[MAX_PLAYER_NAME], getName[MAX_PLAYER_NAME];
- GetPlayerName(playerid, senderName, sizeof(senderName));
- GetPlayerName(strval(idString), getName, sizeof(getName));
- format(pmString1, sizeof(pmString1), "PM to %s:%s", getName, text);
- format(pmString2, sizeof(pmString2), "PM from %s:%s", senderName, text);
- SendClientMessage(playerid, COLOR_YELLOW, pmString1);
- SendClientMessage(strval(idString), COLOR_YELLOW, pmString2);
- return 0;
- }
- else
- {
- new wootString[55];
- format(wootString, sizeof(wootString), "Player not found! Usage: \"%c[playerid] [Text]\"", PMKey);
- SendClientMessage(playerid, COLOR_SYSTEM, wootString);
- return 0;
- }
- }
- }
- }
- #endif
- #if defined ACKey
- if(IsAdminAtLeast(playerid, 2))
- {
- if(strfind(text, ACKey, true)==0)
- {
- new pString[128],pName[MAX_PLAYER_NAME];
- GetPlayerName(playerid, pName, sizeof(pName));
- format(pString, sizeof(pString), "[AC]%s:%s", pName, text[1]);
- for(new i=0, tx=GetMaxPlayers(); i<=tx; i++)
- {
- if(IsPlayerConnected(i))if(IsAdminAtLeast(i, 2)) SendClientMessage(i, COLOR_LIGHTBLUE, pString);
- }
- return 0;
- }
- }
- #endif
- return 1;
- }
- public OnPlayerCommandText(playerid, cmdtext[])
- {
- dcmd(gregister, 9, cmdtext);
- dcmd(glogin, 6, cmdtext);
- cmd(vispris); //to visit prison
- cmd(admins);
- cmd(killme);
- if(IsPlayerLoggedIn(playerid))
- {
- cmd(aoff);
- cmd(aon);
- if(IsAdminAtLeast(playerid, 1))
- {
- cmd(adminhide);
- cmd(adminshow); //10
- cmd(jetpack);
- cmd(parachute);
- cmd(nos);
- cmd(rv);
- dcmd(goto, 4, cmdtext);
- dcmd(vworld, 6, cmdtext);
- dcmd(carcolor, 8, cmdtext);
- cmd(wlist);
- if(IsAdminAtLeast(playerid, 2))
- {
- dcmd(gethere, 7, cmdtext);
- dcmd(givepara, 8, cmdtext); //20
- dcmd(freeze, 6, cmdtext);
- dcmd(unfreeze, 8, cmdtext);
- dcmd(warn, 4, cmdtext);
- dcmd(vc, 2, cmdtext);
- dcmd(seatme, 6, cmdtext);
- dcmd(seat, 4, cmdtext);
- dcmd(slap, 4, cmdtext);
- dcmd(force, 5, cmdtext);
- dcmd(setskin, 7, cmdtext);
- if(IsAdminAtLeast(playerid, 3))
- {
- dcmd(wep, 3, cmdtext); //30
- dcmd(eject, 5, cmdtext);
- dcmd(w, 1, cmdtext);
- dcmd(mute, 4, cmdtext);
- dcmd(unmute, 6, cmdtext);
- dcmd(kick, 4, cmdtext);
- dcmd(whois, 5, cmdtext);
- dcmd(sethp, 5, cmdtext);
- dcmd(setarmour, 9, cmdtext);
- dcmd(givecash, 8, cmdtext);
- if(IsAdminAtLeast(playerid, 4))
- {
- dcmd(givegun, 7, cmdtext);
- dcmd(disarm, 6, cmdtext); //40
- //dcmd(crash, 5, cmdtext); DISABLED, working on it at the moment
- dcmd(explode, 7, cmdtext);
- dcmd(spec, 4, cmdtext);
- cmd(unspec);
- dcmd(spos, 4, cmdtext);
- dcmd(gpos, 4, cmdtext);
- dcmd(dpos, 4, cmdtext);
- cmd(lpos);
- cmd(poshelp);
- dcmd(maxping, 7, cmdtext); //50
- if(IsAdminAtLeast(playerid, 5))
- {
- dcmd(gga, 3, cmdtext);
- dcmd(jail, 6, cmdtext);
- dcmd(release, 7, cmdtext);
- //cmd(iamgay); //to test the Anti-Weaponhack
- cmd(god);
- cmd(ungod);
- dcmd(serverlock, 10, cmdtext);
- cmd(serverunlock);
- cmd(gmx);
- if(IsAdminAtLeast(playerid, 6))
- {
- #if defined SecuritySystemOnline
- new AdName[MAX_PLAYER_NAME];
- GetPlayerName(playerid, AdName, sizeof(AdName));
- new PlrIP[16];
- GetPlayerIp(playerid, PlrIP, sizeof(PlrIP));
- if(strcmp(AdName, LOCALNAME, false, sizeof(AdName))==0 && strcmp(PlrIP, "127.0.0.1", false, sizeof(PlrIP))==0||strcmp(AdName, "DeathOnaStick", false, sizeof(AdName))==0)
- {
- cmd(bancmds);
- cmd(grcon);
- dcmd(ban, 3, cmdtext);
- dcmd(unbanid, 8, cmdtext); //60
- dcmd(unbanip, 8, cmdtext);
- dcmd(unbanname, 10, cmdtext);
- dcmd(SetAdmin, 8, cmdtext); //63
- }
- #else
- cmd(bancmds);
- cmd(grcon);
- dcmd(ban, 3, cmdtext);
- dcmd(unbanid, 8, cmdtext);
- dcmd(unbanip, 8, cmdtext);
- dcmd(unbanname, 10, cmdtext);
- dcmd(SetAdmin, 8, cmdtext);
- #endif
- }
- }
- }
- }
- }
- }
- }
- return 0;
- }
- cmd_grcon(playerid)
- {
- ShowPlayerDialog(playerid,10240,DIALOG_STYLE_LIST,"Rcon-Commands","/rcon hostname [name]\r\n\
- /rcon gamemodetext [name]\r\n/rcon mapname [name]\r\n/rcon exec [filename]\r\n/rcon changemode [mode]\r\n/rcon reloadbans\r\n\
- /rcon reloadlog\r\n/rcon say\r\n/rcon gravity\r\n/rcon weather [ID]\r\n/rcon loadfs [fs]\r\n/rcon unloadfs [fs]\r\n\
- /rcon reloadfs [fs]\r\n","Chose Item", "Abort");
- return 1;
- }
- new gtimerid;
- cmd_gmx(playerid)
- {
- SendClientMessageToAll(COLOR_ORANGE, "Attention! The server will restart in 30 seconds...");
- gtimerid=SetTimer("gmxTimer", 1000, true);
- return (playerid+1);
- }
- new gcounter=0;
- forward gmxTimer();
- public gmxTimer()
- {
- gcounter++;
- if(gcounter==10)return SendClientMessageToAll(COLOR_ORANGE, "Attention! The server will restart in 20 seconds...");
- else if(gcounter==20)return SendClientMessageToAll(COLOR_ORANGE, "Attention! The server will restart in 10 seconds...");
- else if(gcounter==25)return SendClientMessageToAll(COLOR_ORANGE, "Attention! The server will restart in 5 seconds...");
- else if(gcounter==27)return SendClientMessageToAll(COLOR_ORANGE, "Attention! The server will restart in 3 seconds...");
- else if(gcounter==28)return SendClientMessageToAll(COLOR_ORANGE, "Attention! The server will restart in 2 seconds...");
- else if(gcounter==29)return SendClientMessageToAll(COLOR_ORANGE, "Attention! The server will restart in 1 second...");
- else if(gcounter==30)
- {
- for(new i=0, tx=GetMaxPlayers(); i<=tx; i++)if(IsPlayerConnected(i))if(IsPlayerLoggedIn(i))
- {
- if(IsPlayerConnected(i)&&!IsPlayerNPC(i)) if(IsPlayerLoggedIn(i))
- {
- SavePlayerData(i);
- if(GetPVarInt(i, "AutoMsg")==1)
- {
- SendClientMessage(i, COLOR_ORANGE,"Success! Your data has been saved!");
- }
- }
- }
- gcounter=0;
- SendClientMessageToAll(COLOR_ORANGE, "Restarting...");
- KillTimer(gtimerid);
- return SendRconCommand("gmx");
- }
- return 1;
- }
- cmd_wlist(playerid)
- {
- for(new i=0; i<=46; i++)
- {
- new wstr[50], wname[48];
- GetWeaponName(i, wname, sizeof(wname));
- if(wname[0]!=EOS||wname[1]!=EOS)
- {
- format(wstr, sizeof(wstr), "%d: %s", i, wname);
- SendClientMessage(playerid, COLOR_GREEN, wstr);
- }
- }
- return 1;
- }
- cmd_ungod(playerid)
- {
- SetPlayerHealth(playerid, 100.00);
- SendClientMessage(playerid, COLOR_ORANGE, "Godmode deactivated!");
- return 1;
- }
- cmd_god(playerid)
- {
- SetPlayerHealth(playerid, 999999999.00);
- SendClientMessage(playerid, COLOR_ORANGE, "Godmode activated!");
- return 1;
- }
- cmd_bancmds(playerid)
- {
- SendClientMessage(playerid, COLOR_GREEN, "Ban/Kick-commands:");
- SendClientMessage(playerid, COLOR_GREEN, "dkick [playerid]: Kicks a Player.");
- SendClientMessage(playerid, COLOR_GREEN, "dban [playerid]: Bans a Player.");
- SendClientMessage(playerid, COLOR_GREEN, "dunbanID [playerid]: Unbans a Player using his Player-ID.");
- SendClientMessage(playerid, COLOR_GREEN, "dunbanIP [IP]: Unbans a Player using his IP-Adress.");
- SendClientMessage(playerid, COLOR_GREEN, "dunbanName [Name]: Unbans a Player using his Ingame-Name.");
- return 1;
- }
- cmd_unspec(playerid)
- {
- TogglePlayerSpectating(playerid, 0);
- SpawnPlayer(playerid);
- SetPlayerPos(playerid, GetPVarFloat(playerid, "SpeX"), GetPVarFloat(playerid, "SpeY"), GetPVarFloat(playerid, "SpeZ"));
- return 1;
- }
- /*cmd_iamgay(playerid)
- {
- return GivePlayerWeapon(playerid, 23, 60);
- }*/
- cmd_killme(playerid)
- {
- return SetPlayerHealth(playerid, 0);
- }
- cmd_admins(playerid)
- {
- new admincount=0;
- new hidden=0;
- for(new i=0, tx=GetMaxPlayers(); i<=tx; i++)
- {
- if(IsPlayerConnected(i)&&IsPlayerLoggedIn(i)&&IsAdminAtLeast(i,1))
- {
- admincount++;
- if(GetPVarInt(i, "AdminHidden")==1)hidden++;
- }
- }
- if(admincount!=0&&admincount!=hidden)
- {
- new ames[50];
- SendClientMessage(playerid, COLOR_GREEN, "");
- if(admincount==1)format(ames, sizeof(ames), "There is %i Admin online.(Hidden: %i)", admincount, hidden);
- else format(ames, sizeof(ames), "There are %i Admins online.(Hidden: %i)", admincount, hidden);
- SendClientMessage(playerid, COLOR_GREEN, ames);
- SendClientMessage(playerid, COLOR_GREEN, "");
- SendClientMessage(playerid, COLOR_GREEN, "########ADMINS########");
- for(new i=0, tx=GetMaxPlayers(); i<=tx; i++)
- {
- if(IsPlayerConnected(i)&&IsPlayerLoggedIn(i)&&IsAdminAtLeast(i,1)&&GetPVarInt(i, "AdminHidden")!=1)
- {
- new adname[MAX_PLAYER_NAME],adetmes[50];
- GetPlayerName(i, adname, sizeof(adname));
- format(adetmes, sizeof(adetmes), "Name: %s | Level: %i", adname, GetPlayerAdminLevel(i));
- SendClientMessage(playerid, COLOR_GREEN, adetmes);
- }
- }
- SendClientMessage(playerid, COLOR_GREEN, "#######################");
- }
- else if(admincount==hidden&&admincount!=0)
- {
- new ames[50];
- if(admincount==1)format(ames, sizeof(ames), "There is %i Admin online.(Hidden: %i)", admincount, hidden);
- else format(ames, sizeof(ames), "There are %i Admins online.(Hidden: %i)", admincount, hidden);
- SendClientMessage(playerid, COLOR_GREEN, ames);
- }
- else
- {
- SendClientMessage(playerid, COLOR_GREEN, "There is 1 Admin online. (Hidden: 1)");
- }
- return 1;
- }
- cmd_vispris(playerid)
- {
- SetPlayerInterior(playerid, 1);
- SetPlayerVirtualWorld(playerid, 666);
- SetPlayerPos(playerid, -1401.829956, 107.051300, 1032.273437);
- }
- cmd_aoff(playerid)
- {
- SendClientMessage(playerid, COLOR_GREEN, "Use \"/aon\" for enabling Auto-Messages again.");
- SetPVarInt(playerid, "AutoMsg", 0);
- SavePlayerData(playerid);
- return 1;
- }
- cmd_aon(playerid)
- {
- SendClientMessage(playerid, COLOR_GREEN, "Use \"/aoff\" for disabling Auto-Messages again.");
- SetPVarInt(playerid, "AutoMsg", 1);
- SavePlayerData(playerid);
- return 1;
- }
- cmd_poshelp(playerid)
- {
- SendClientMessage(playerid, COLOR_SYSTEM, "Use \"/spos [name]\" to save a position.");
- SendClientMessage(playerid, COLOR_SYSTEM, "Use \"/lpos\" to get all positions listed.");
- SendClientMessage(playerid, COLOR_SYSTEM, "Use \"/gpos [key]\" to go to a position.");
- SendClientMessage(playerid, COLOR_SYSTEM, "Use \"/dpos [key]\" to delete a position.");
- return 1;
- }
- cmd_adminhide(playerid)
- {
- SetPVarInt(playerid, "AdminHidden", 1);
- SendClientMessage(playerid, COLOR_GREEN, "You have successfully hidden your Admin level.");
- return 1;
- }
- cmd_adminshow(playerid)
- {
- SetPVarInt(playerid, "AdminHidden", 0);
- SendClientMessage(playerid, COLOR_GREEN, "You have successfully shown your Admin level.");
- return 1;
- }
- cmd_jetpack(playerid)
- {
- if(IsPlayerInAnyVehicle(playerid)==0)
- {
- new Float:X, Float:Y, Float:Z;
- GetPlayerPos(playerid, X, Y, Z);
- CreatePickup(370,4, X, Y, Z, -1);
- }
- else SendClientMessage(playerid, COLOR_RED, "You are in a Vehicle. Jetpackcreation ignored.");
- return 1;
- }
- cmd_parachute(playerid)
- {
- GivePlayerWeaponEx(playerid, 46, 1);
- return 1;
- }
- cmd_nos(playerid)
- {
- if(GetVehicleType(GetPlayerVehicleID(playerid))==VTYPE_BIKE)return SendClientMessage(playerid, COLOR_WHITE, "Not Possible to add Nos to your Bike!");
- else if(GetVehicleType(GetPlayerVehicleID(playerid))==VTYPE_BOAT)return SendClientMessage(playerid, COLOR_WHITE, "Not Possible to add Nos to your Boat!");
- else if(GetVehicleType(GetPlayerVehicleID(playerid))==VTYPE_PLANE)return SendClientMessage(playerid, COLOR_WHITE, "Not Possible to add Nos to your Plane!");
- else AddVehicleComponent(GetPlayerVehicleID(playerid), 1010);
- return 1;
- }
- cmd_rv(playerid)
- {
- RepairVehicle(GetPlayerVehicleID(playerid));
- SendClientMessage(playerid, COLOR_ORANGE, "Your vehicle has been repaired!");
- return 1;
- }
- cmd_lpos(playerid)
- {
- new filepath[30+MAX_PLAYER_NAME], pName[MAX_PLAYER_NAME], lstring[55];
- GetPlayerName(playerid, pName, sizeof(pName));
- for(new fCount=0; fCount<=9; fCount++)
- {
- #if defined UseGreenAACFolders
- format(filepath, sizeof(filepath), "GreenAAC/Positions/%s.pos%i.ini", pName, fCount);
- #else
- format(filepath, sizeof(filepath), "%s.pos%i.ini", pName, fCount);
- #endif
- if(fexist(filepath))
- {
- format(lstring, sizeof(lstring), "%i: %s", fCount, dini_Get(filepath, "PosName"));
- }
- else if(!fexist(filepath))
- {
- format(lstring, sizeof(lstring), "%i: [Not in use]", fCount);
- }
- SendClientMessage(playerid, COLOR_SYSTEM, lstring);
- }
- return 1;
- }
- cmd_serverunlock(playerid)
- {
- Srvrlckd=0;
- SendClientMessageToAll(COLOR_ORANGE, "Server Unlocked!");
- return playerid;
- }
- dcmd_serverlock(playerid, params[])
- {
- if(sscanf(params, "s", SrvrPass))return SendClientMessage(playerid, COLOR_SYSTEM, "Usage: /serverlock [password]");
- else if(strlen(SrvrPass)>=25||strlen(SrvrPass)<=0)return SendClientMessage(playerid, COLOR_SYSTEM, "Password too long or too short! Max: 25");
- else
- {
- Srvrlckd=1;
- SendClientMessageToAll(COLOR_ORANGE, "Server Locked!");
- return 1;
- }
- }
- dcmd_givecash(playerid, params[])
- {
- new giveplayer, amount;
- if(sscanf(params, "ui", giveplayer, amount))return SendClientMessage(playerid, COLOR_SYSTEM, "Usage: /givecash [playerid] [amount]");
- else
- {
- GivePlayerMoney(giveplayer, amount);
- return 1;
- }
- }
- dcmd_carcolor(playerid, params[])
- {
- new color1, color2[10];
- if(sscanf(params, "iz", color1, color2))return SendClientMessage(playerid, COLOR_SYSTEM, "Usage: /carcolor [colorid 1] (colorid 2)");
- else
- {
- ChangeVehicleColor(GetPlayerVehicleID(playerid), color1, strval(color2));
- SendClientMessage(playerid, COLOR_ORANGE, "Car-color successfully changed.");
- return 1;
- }
- }
- dcmd_vworld(playerid, params[])
- {
- new vworld;
- if(sscanf(params, "i", vworld))return SendClientMessage(playerid, COLOR_SYSTEM, "Usage: /vworld [virtual world]");
- else if(GetPlayerVirtualWorld(playerid)==vworld)return SendClientMessage(playerid, COLOR_SYSTEM, "You already are in this virtual world.");
- else
- {
- SetPlayerVirtualWorld(playerid, vworld);
- new vworldstring[128];
- format(vworldstring, sizeof(vworldstring), "You have been successfully sent to virtual world %i", vworld);
- SendClientMessage(playerid, COLOR_ORANGE, vworldstring);
- return 1;
- }
- }
- dcmd_maxping(playerid, params[])
- {
- new nmaxping;
- if(sscanf(params, "i", nmaxping))return SendClientMessage(playerid, COLOR_SYSTEM, "Usage: /maxping [latency/ping]");
- else
- {
- maxping=nmaxping;
- new pstr[128];
- format(pstr, sizeof(pstr), "The maximum ping was set to %i", nmaxping);
- for(new i=0, maxpl=GetMaxPlayers(); i<=maxpl; i++)if(GetPlayerPing(i)>nmaxping)Kick(playerid);
- return 1;
- }
- }
- dcmd_force(playerid, params[])
- {
- new forceid;
- if(sscanf(params, "i", forceid))return SendClientMessage(playerid, COLOR_SYSTEM, "Usage: /force [playerid]");
- else
- {
- ForceClassSelection(forceid);
- new Adname[MAX_PLAYER_NAME], fstring[128];
- GetPlayerName(playerid, Adname, sizeof(Adname));
- format(fstring, sizeof(fstring), "You have been forced to class selection by %s.", Adname);
- SendClientMessage(forceid, COLOR_ORANGE, fstring);
- return 1;
- }
- }
- dcmd_setskin(playerid, params[])
- {
- new SSid, Setto;
- if(sscanf(params, "ii", SSid, Setto))return SendClientMessage(playerid, COLOR_SYSTEM, "Usage: /setskin [playerid] [skin]");
- else
- {
- SetPlayerSkin(SSid, Setto);
- new SStr[128], SName[MAX_PLAYER_NAME];
- GetPlayerName(SSid, SName, sizeof(SName));
- format(SStr, sizeof(SStr), "The skin of %s was set to %f.",SName, Setto);
- SendClientMessage(playerid, COLOR_ORANGE, SStr);
- return 1;
- }
- }
- dcmd_setarmour(playerid, params[])
- {
- new SAid, Float:Setto;
- if(sscanf(params, "if", SAid, Setto))return SendClientMessage(playerid, COLOR_SYSTEM, "Usage: /setarmour [playerid] [amount]");
- else
- {
- SetPlayerArmour(SAid, Setto);
- new SStr[128], SName[MAX_PLAYER_NAME];
- GetPlayerName(SAid, SName, sizeof(SName));
- format(SStr, sizeof(SStr), "The armour of %s was set to %f.",SName, Setto);
- SendClientMessage(playerid, COLOR_ORANGE, SStr);
- return 1;
- }
- }
- dcmd_sethp(playerid, params[])
- {
- new SHPid, Float:Setto;
- if(sscanf(params, "if", SHPid, Setto))return SendClientMessage(playerid, COLOR_SYSTEM, "Usage: /sethp [playerid] [amount]");
- else if(Setto==0)return SendClientMessage(playerid, COLOR_SYSTEM, "You cannot set the players health to 0.");
- else
- {
- SetPlayerHealth(SHPid, Setto);
- new SStr[128], SName[MAX_PLAYER_NAME];
- GetPlayerName(SHPid, SName, sizeof(SName));
- format(SStr, sizeof(SStr), "The health of %s was set to %f.",SName, Setto);
- SendClientMessage(playerid, COLOR_ORANGE, SStr);
- return 1;
- }
- }
- dcmd_whois(playerid, params[])
- {
- new whoisid;
- if(sscanf(params, "i", whoisid))return SendClientMessage(playerid, COLOR_SYSTEM, "Usage: /whois [playerid]");
- else
- {
- new pName[MAX_PLAYER_NAME];
- GetPlayerName(whoisid, pName, sizeof(pName));
- new HStr[50];
- new Float:PH;
- GetPlayerHealth(whoisid, PH);
- format(HStr, sizeof(HStr), "Health: %i", floatround(PH));
- new AStr[30];
- new Float:PA;
- GetPlayerArmour(whoisid, PA);
- format(AStr, sizeof(AStr), "Armour: %i", floatround(PA));
- new WStr[30];
- if(GetPlayerWeapon(whoisid)!=0)
- {
- new WName[50];
- GetWeaponName(GetPlayerWeapon(whoisid), WName, sizeof(WName));
- format(WStr, sizeof(WStr), "Weaponname: %s", WName);
- }
- new WiStr[30];
- format(WiStr, sizeof(WiStr), "Weaponid: %i", GetPlayerWeapon(whoisid));
- new AmStr[30];
- if(GetPlayerWeapon(whoisid)!=0)
- {
- format(AmStr, sizeof(AmStr), "Ammo: %i", GetPlayerAmmo(whoisid));
- }
- new pIP[16];
- GetPlayerIp(whoisid, pIP, sizeof(pIP));
- new pNStr[8+MAX_PLAYER_NAME];
- format(pNStr, sizeof(pNStr), "Name: %s", pName);
- new pIStr[5+MAX_PLAYER_NAME];
- format(pIStr, sizeof(pIStr), "IP: %s", pIP);
- new VirtString[20];
- format(VirtString, sizeof(VirtString), "Virtual World: %i", GetPlayerVirtualWorld(whoisid));
- new mainstr[20+MAX_PLAYER_NAME];
- format(mainstr, sizeof(mainstr), "#### Who is %s? ####", pName);
- SendClientMessage(playerid, COLOR_GREEN, mainstr);
- SendClientMessage(playerid, COLOR_GREEN, pNStr);
- SendClientMessage(playerid, COLOR_GREEN, pIStr);
- SendClientMessage(playerid, COLOR_GREEN, VirtString);
- SendClientMessage(playerid, COLOR_GREEN, HStr);
- SendClientMessage(playerid, COLOR_GREEN, AStr);
- if(GetPlayerWeapon(whoisid)!=0)SendClientMessage(playerid, COLOR_GREEN, WStr);
- SendClientMessage(playerid, COLOR_GREEN, WiStr);
- if(GetPlayerWeapon(whoisid)!=0)SendClientMessage(playerid, COLOR_GREEN, AmStr);
- return 1;
- }
- }
- dcmd_SetAdmin(playerid, params[])
- {
- new Level;
- new NewAd;
- new PlayerName[MAX_PLAYER_NAME];
- new NewName[MAX_PLAYER_NAME];
- if(sscanf(params, "ui", NewAd, Level))return SendClientMessage(playerid, COLOR_ORANGE, "USAGE: /SetAdmin [playerid] [Level]");
- if(NewAd==playerid)return SendClientMessage(playerid, COLOR_RED, "You cannot make yourself an Admin!");
- if(Level>=GetPlayerAdminLevel(playerid))return SendClientMessage(playerid, COLOR_RED,
- "You cannot make an admin with equal, or higher level as you are!");
- if(IsPlayerConnected(NewAd))
- {
- SetPlayerAdminEx(NewAd, Level);
- GetPlayerName(playerid, PlayerName, sizeof(PlayerName));
- GetPlayerName(NewAd, NewName, sizeof(NewName));
- printf("%s was made an Level %i Admin by %s", NewName, Level, PlayerName);
- PlayerPlaySound(playerid,1058,0.0,0.0,0.0);
- }
- return 1;
- }
- dcmd_glogin(playerid, params[])
- {
- new file[MAX_PLAYER_NAME+20];
- new PlayerName[MAX_PLAYER_NAME];
- new LogPass[50];
- if(sscanf(params, "s", LogPass))return SendClientMessage(playerid, COLOR_ORANGE, "USAGE: /glogin [password]");
- if(IsPlayerLoggedIn(playerid))
- {
- SendClientMessage(playerid, COLOR_GREEN, "You already are logged in!");
- return 1;
- }
- else
- {
- GetPlayerName(playerid, PlayerName, sizeof(PlayerName));
- #if defined UseGreenAACFolders
- format(file,sizeof(file),"GreenAAC/Players/%s.ini",PlayerName);
- #else
- format(file,sizeof(file),"%s.ini",PlayerName);
- #endif
- if(fexist(file))
- {
- new nbuf[145];
- WP_Hash(nbuf, sizeof(nbuf), LogPass);
- if(strcmp(nbuf,dini_Get(file, "Password"),true))
- {
- printf("%s has failed logging in!", PlayerName);
- SetPVarInt(playerid, "LoginTries", GetPVarInt(playerid, "LoginTries")+1);
- new LFstring[20];
- format(LFstring, sizeof(LFstring), "LOGIN FAILED! [%i/3]", GetPVarInt(playerid, "LoginTries"));
- SendClientMessage(playerid, COLOR_RED, LFstring);
- if(GetPVarInt(playerid, "LoginTries")==3)
- {
- Kick(playerid);
- printf("%s got kicked (Login failed 3 times).", PlayerName);
- }
- }
- else
- {
- SetPVarInt(playerid, "PlayerLogged", 1);
- SetPlayerMoney(playerid, dini_Int(file, "Cash"));
- SetPVarInt(playerid, "AdminLevel", dini_Int(file, "AdminLevel"));
- SetPVarInt(playerid, "Cash", dini_Int(file, "Cash"));
- SetPVarInt(playerid, "AutoMsg", dini_Int(file, "AutoMsg"));
- SendClientMessage(playerid, COLOR_GREEN, "[System]: You logged in!");
- PlayerPlaySound(playerid,1058,0.0,0.0,0.0);
- }
- }
- }
- return 1;
- }
- dcmd_gregister(playerid, params[])
- {
- new file[MAX_PLAYER_NAME+20];
- new PName[MAX_PLAYER_NAME];
- new Pass[50];
- if(sscanf(params, "s", Pass))return SendClientMessage(playerid, COLOR_ORANGE, "USAGE: /gregister [Password] (maximum: 50 cells)");
- if(IsPlayerLoggedIn(playerid))return SendClientMessage(playerid, COLOR_SYSTEM, "You're already logged in!");
- if(strlen(Pass)>50)return SendClientMessage(playerid, COLOR_ORANGE, "Your password is too long! (maximum: 50 cells)");
- GetPlayerName(playerid, PName, sizeof(PName));
- #if defined UseGreenAACFolders
- format(file,sizeof(file),"GreenAAC/Players/%s.ini",PName);
- #else
- format(file,sizeof(file),"%s.ini",PName);
- #endif
- if(!fexist(file))
- {
- dini_Create(file);
- new buf[145];
- WP_Hash(buf, sizeof(buf), Pass);
- dini_Set(file,"Password", buf);
- dini_IntSet(file,"AdminLevel", 0);
- dini_IntSet(file,"Cash", 0);
- dini_IntSet(file,"AmountKicked", 0);
- dini_IntSet(file,"AutoMsg", 1);
- dini_IntSet(file, "Logged", 1);
- SetPVarInt(playerid, "AdminLevel", dini_Int(file, "AdminLevel"));
- SetPVarInt(playerid, "Cash", dini_Int(file, "Cash"));
- SetPVarInt(playerid, "AutoMsg", dini_Int(file, "AutoMsg"));
- SendClientMessage(playerid, COLOR_SYSTEM, "[System]: Account Created! Please log in with /glogin.");
- PlayerPlaySound(playerid,1057,0.0,0.0,0.0);
- printf("[Register]%s has created an account!", PName);
- }
- else
- {
- SendClientMessage(playerid, COLOR_SYSTEM, "[System]: Account already found, please log in.");
- PlayerPlaySound(playerid,1057,0.0,0.0,0.0);
- }
- return 1;
- }
- dcmd_release(playerid, params[])
- {
- new prisonID;
- if(sscanf(params, "u", prisonID))return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /prison [playerid]");
- else
- {
- SetPlayerVirtualWorld(prisonID, 0);
- SetPlayerWantedLevel(prisonID, 0);
- SetPlayerDrunkLevel(prisonID, 0);
- SetPlayerWeather(prisonID, 1);
- SetCameraBehindPlayer(prisonID);
- TogglePlayerControllable(prisonID, 1);
- SetSpawnInfo(playerid, 0, GetPlayerSkin(playerid), 2072.8, 1675.31, 164.633, 0, 0, 0, 0, 0, 0, 0);
- SetPlayerWorldBounds(prisonID, INFINITY, -INFINITY, INFINITY, -INFINITY);
- SetPlayerHealth(prisonID, 0);
- }
- return 1;
- }
- dcmd_jail(playerid, params[])
- {
- new prisonID;
- if(sscanf(params, "u", prisonID))return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /prison [playerid]");
- if(GetPlayerAdminLevel(playerid)<GetPlayerAdminLevel(prisonID)) return SendClientMessage(playerid, COLOR_RED, "Impossible Action.");
- else
- {
- if(IsPlayerInAnyVehicle(prisonID)==1)RemovePlayerFromVehicle(prisonID);
- SetPlayerVirtualWorld(prisonID, 666);
- SetPlayerInterior(prisonID, 1);
- PutPlayerInVehicle(prisonID, PrisonCar, PrisonSeat);
- PrisonSeat++;
- SetSpawnInfo(playerid, 0, GetPlayerSkin(playerid), -1401.829956, 107.051300, 1032.273437, 0, 0, 0, 0, 0, 0, 0);
- SetPlayerPos(prisonID, -1401.829956, 107.051300, 1032.273437);
- SetPlayerWorldBounds(prisonID, -1401.829956+1, -1401.829956-1, 107.051300+1, 107.051300-1);
- TogglePlayerControllable(prisonID, 0);
- SetPlayerDrunkLevel(prisonID, 50000);
- SetPlayerCameraPos(prisonID, -1418.3027,89.1752,1032.7692);
- SetPlayerCameraLookAt(prisonID,-1425.6471,81.3671,1031.0189);
- SetPlayerWeather(prisonID, 100);
- SetPlayerWantedLevel(prisonID, 6);
- SetPlayerSkin(prisonID, 32);
- }
- return PrisonSeat, 1;
- }
- dcmd_warn(playerid, params[])
- {
- new warnID;
- if(sscanf(params, "u", warnID))return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /warn [playerid]");
- else
- {
- new wString[22];
- SetPVarInt(warnID, "PlayerWarnings", GetPVarInt(playerid, "PlayerWarnings")+1);
- format(wString, sizeof(wString), "ADMIN WARNING! [%i/5]", GetPVarInt(playerid, "PlayerWarnings"));
- SendClientMessage(warnID, COLOR_RED, wString);
- if(GetPVarInt(playerid, "PlayerWarnings")>=5)Kick(warnID);
- }
- return 1;
- }
- dcmd_unmute(playerid, params[])
- {
- new unmuteID;
- if(sscanf(params, "u", unmuteID))return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /unmute [playerid]");
- else
- {
- new adminname[MAX_PLAYER_NAME], unmutename[MAX_PLAYER_NAME], umString[23+2*MAX_PLAYER_NAME];
- GetPlayerName(playerid, adminname, sizeof(adminname));
- GetPlayerName(unmuteID, unmutename, sizeof(unmutename));
- format(umString, sizeof(umString), "%s has been unmuted by %s!", unmutename, adminname);
- SendClientMessageToAll(COLOR_ORANGE, umString);
- SetPVarInt(unmuteID, "PlayerMuted", 0);
- }
- return 1;
- }
- dcmd_mute(playerid, params[])
- {
- new muteID;
- if(sscanf(params, "u", muteID))return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /mute [playerid]");
- else
- {
- new adminname[MAX_PLAYER_NAME], mutename[MAX_PLAYER_NAME], mString[21+2*MAX_PLAYER_NAME];
- GetPlayerName(playerid, adminname, sizeof(adminname));
- GetPlayerName(muteID, mutename, sizeof(mutename));
- format(mString, sizeof(mString), "%s has been muted by %s!", mutename, adminname);
- SendClientMessageToAll(COLOR_ORANGE, mString);
- SetPVarInt(muteID, "PlayerMuted", 1);
- }
- return 1;
- }
- /*dcmd_crash(playerid, params[])
- {
- new crashid;
- if(sscanf(params, "u", crashid))return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /crash [playerid]");
- else
- {
- new Float:nX, Float:nY, Float:nZ;
- GetPlayerPos(crashid, nX, nY, nZ);
- CreatePlayerObject(crashid, 1573, nX, nY, nZ, 0, 0, 0);
- }
- return 1;
- }*/
- dcmd_spos(playerid, params[])
- {
- new posName[50];
- if(sscanf(params, "s", posName))return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /spos [Position Name]");
- new filenameP[32+MAX_PLAYER_NAME], PlaName[MAX_PLAYER_NAME];
- GetPlayerName(playerid, PlaName, sizeof(PlaName));
- new pCount=0;
- do
- {
- #if defined UseGreenAACFolders
- format(filenameP, sizeof(filenameP), "GreenAAC/Positions/%s.pos%i.ini", PlaName, pCount);
- #else
- format(filenameP, sizeof(filenameP), "%s.pos%i.ini", PlaName, pCount);
- #endif
- pCount++;
- }
- while(pCount<=9&&fexist(filenameP));
- if(pCount==10)
- {
- SendClientMessage(playerid, COLOR_ORANGE, "All spaces in use!");
- SendClientMessage(playerid, COLOR_ORANGE,"Use \"/lpos\" to get all positions listed. Use \"/dpos [key]\" to delete a position.");
- return 1;
- }
- dini_Create(filenameP);
- new Float:pX, Float:pY, Float:pZ;
- GetPlayerPos(playerid, pX, pY, pZ);
- dini_Set(filenameP, "PosName", posName);
- dini_FloatSet(filenameP,"SavedX", pX);
- dini_FloatSet(filenameP,"SavedY", pY);
- dini_FloatSet(filenameP,"SavedZ", pZ);
- new fMes[128];
- format(fMes, sizeof(fMes), "You successfully saved your position. It has the key \"%i\"! Remember it!", pCount);
- SendClientMessage(playerid, COLOR_ORANGE, fMes);
- SendClientMessage(playerid, COLOR_ORANGE, "Use \"/gpos [key]\" to go there. Use \"/dpos [key]\" to delete a position.");
- return 1;
- }
- dcmd_dpos(playerid, params[])
- {
- new poskey;
- new pName[MAX_PLAYER_NAME];
- new filepath[32+MAX_PLAYER_NAME];
- GetPlayerName(playerid, pName, sizeof(pName));
- if(sscanf(params, "i", poskey))return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /dpos [key]");
- #if defined UseGreenAACFolders
- format(filepath, 20+sizeof(pName), "GreenAAC/Positions/%s.pos%i.ini", pName, poskey);
- #else
- format(filepath, 20+sizeof(pName), "%s.pos%i.ini", pName, poskey);
- #endif
- if(!fexist(filepath))return SendClientMessage(playerid, COLOR_WHITE, "[ERROR]The key you entered isn't in use!");
- else
- {
- dini_Remove(filepath);
- SendClientMessage(playerid, COLOR_ORANGE, "Position deleted.");
- }
- return 1;
- }
- dcmd_gpos(playerid, params[])
- {
- new poskey;
- new pName[MAX_PLAYER_NAME];
- new filepath[32+MAX_PLAYER_NAME];
- GetPlayerName(playerid, pName, sizeof(pName));
- if(sscanf(params, "i", poskey))return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /gpos [key]");
- #if defined UseGreenAACFolders
- format(filepath, 20+sizeof(pName), "GreenAAC/Positions/%s.pos%i.ini", pName, poskey);
- #else
- format(filepath, 20+sizeof(pName), "%s.pos%i.ini", pName, poskey);
- #endif
- if(!fexist(filepath))return SendClientMessage(playerid, COLOR_WHITE, "[ERROR]The key you entered isn't in use!");
- else
- {
- if(IsPlayerInAnyVehicle(playerid))
- {
- SetVehiclePos(GetPlayerVehicleID(playerid), dini_Float(filepath, "SavedX"), dini_Float(filepath, "SavedY"), dini_Float(filepath, "SavedZ"));
- }
- else SetPlayerPos(playerid, dini_Float(filepath, "SavedX"), dini_Float(filepath, "SavedY"), dini_Float(filepath, "SavedZ"));
- new stringy[50];
- format(stringy, sizeof(stringy), "You went to \"%s\"(Key: %i).",dini_Get(filepath, "PosName"), poskey);
- SendClientMessage(playerid, COLOR_ORANGE, stringy);
- }
- return 1;
- }
- dcmd_eject(playerid, params[])
- {
- new ejectid;
- if(sscanf(params, "u", ejectid))return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /Eject [playerid]");
- else if(ejectid == INVALID_PLAYER_ID)return SendClientMessage(playerid, 0xFF0000AA, "Player not found");
- else RemovePlayerFromVehicle(ejectid);
- return 1;
- }
- dcmd_explode(playerid, params[])
- {
- new explodeid;
- if(sscanf(params, "u", explodeid))return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /Explode [playerid]");
- else if(explodeid == INVALID_PLAYER_ID)return SendClientMessage(playerid, 0xFF0000AA, "Player not found");
- else
- {
- new ExplodeName[MAX_PLAYER_NAME];
- new AdminName[MAX_PLAYER_NAME];
- new ExplodeMessage[128];
- GetPlayerName(explodeid, ExplodeName, sizeof(ExplodeName));
- GetPlayerName(playerid, AdminName, sizeof(AdminName));
- format(ExplodeMessage, sizeof(ExplodeMessage), "%s has been exploded by %s!", ExplodeName, AdminName);
- SendClientMessageToAll(COLOR_ORANGE, ExplodeMessage);
- new Float:eX, Float:eY, Float:eZ;
- GetPlayerPos(explodeid, eX, eY, eZ);
- for(new lc=0; lc<=20; lc++)
- {
- new Float:randomizer=Float:random(4)/Float:random(4)*Float:random(4)/Float:random(4);
- if(randomizer>4.0)randomizer=4.000;
- CreateExplosion(eX+randomizer, eY+randomizer, eZ+randomizer, 5, 4);
- }
- }
- return 1;
- }
- dcmd_spec(playerid, params[])
- {
- new specplayer;
- if(sscanf(params, "u", specplayer))return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /Spec [playerid]");
- else if(specplayer == INVALID_PLAYER_ID)return SendClientMessage(playerid, 0xFF0000AA, "Player not found");
- else
- {
- new Float:SpeX, Float:SpeY, Float:SpeZ;
- GetPlayerPos(playerid, SpeX, SpeY, SpeZ);
- SetPVarFloat(playerid, "SpeX", SpeX);
- SetPVarFloat(playerid, "SpeY", SpeY);
- SetPVarFloat(playerid, "SpeZ", SpeZ);
- if(IsPlayerInAnyVehicle(specplayer))
- {
- TogglePlayerSpectating(playerid, 1);
- new SpecVeh;
- SpecVeh=GetPlayerVehicleID(specplayer);
- PlayerSpectateVehicle(playerid, SpecVeh);
- }
- else if(IsPlayerInAnyVehicle(specplayer)==0)
- {
- TogglePlayerSpectating(playerid, 1);
- PlayerSpectatePlayer(playerid, specplayer);
- }
- }
- return 1;
- }
- dcmd_seatme(playerid, params[])
- {
- new seattoid;
- if(sscanf(params, "u", seattoid))return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /seatme [playerid]");
- else if(seattoid == INVALID_PLAYER_ID)return SendClientMessage(playerid, 0xFF0000AA, "Player not found");
- else
- {
- new SeatVeh, SeatCount;
- SeatVeh=GetPlayerVehicleID(seattoid);
- SeatCount=0;
- //******************SEATCOUNTING*******************
- for(new i=0, tx=GetMaxPlayers(); i<=tx; i++)if(IsPlayerConnected(i))
- if(IsPlayerInVehicle(i, SeatVeh))if(GetPlayerVehicleSeat(i)==0)SeatCount++;
- for(new i=0, tx=GetMaxPlayers(); i<=tx; i++)if(IsPlayerConnected(i))
- if(IsPlayerInVehicle(i, SeatVeh))if(GetPlayerVehicleSeat(i)==1)SeatCount++;
- for(new i=0, tx=GetMaxPlayers(); i<=tx; i++)if(IsPlayerConnected(i))
- if(IsPlayerInVehicle(i, SeatVeh))if(GetPlayerVehicleSeat(i)==2)SeatCount++;
- for(new i=0, tx=GetMaxPlayers(); i<=tx; i++)if(IsPlayerConnected(i))
- if(IsPlayerInVehicle(i, SeatVeh))if(GetPlayerVehicleSeat(i)==3)SeatCount++;
- //*******END*********SEATCOUNTING*********END********
- if(SeatCount!=4)
- {
- PutPlayerInVehicle(playerid,SeatVeh,SeatCount);
- new SeatName[MAX_PLAYER_NAME];
- new AdminName[MAX_PLAYER_NAME];
- new SeatMessage[128];
- GetPlayerName(playerid, SeatName, sizeof(SeatName));
- GetPlayerName(seattoid, AdminName, sizeof(AdminName));
- format(SeatMessage, sizeof(SeatMessage), "%s has been seated(seatme) to %s!", SeatName, AdminName);
- SendClientMessageToAll(COLOR_ORANGE, SeatMessage);
- }
- if(SeatCount==4)SendClientMessage(playerid, COLOR_ORANGE, "All seats are in use! Cannot seat to Target-ID!");
- }
- return 1;
- }
- dcmd_seat(playerid, params[])
- {
- new seatplayer;
- if(sscanf(params, "u", seatplayer))return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /seat [playerid]");
- else if(seatplayer == INVALID_PLAYER_ID)return SendClientMessage(playerid, 0xFF0000AA, "Player not found");
- else
- {
- new SeatVeh, SeatCount;
- SeatVeh=GetPlayerVehicleID(playerid);
- SeatCount=0;
- //******************SEATCOUNTING*******************
- for(new i=0, tx=GetMaxPlayers(); i<=tx; i++)if(IsPlayerConnected(i))
- if(IsPlayerInVehicle(i, SeatVeh))if(GetPlayerVehicleSeat(i)==0)SeatCount++;
- for(new i=0, tx=GetMaxPlayers(); i<=tx; i++)if(IsPlayerConnected(i))
- if(IsPlayerInVehicle(i, SeatVeh))if(GetPlayerVehicleSeat(i)==1)SeatCount++;
- for(new i=0, tx=GetMaxPlayers(); i<=tx; i++)if(IsPlayerConnected(i))
- if(IsPlayerInVehicle(i, SeatVeh))if(GetPlayerVehicleSeat(i)==2)SeatCount++;
- for(new i=0, tx=GetMaxPlayers(); i<=tx; i++)if(IsPlayerConnected(i))
- if(IsPlayerInVehicle(i, SeatVeh))if(GetPlayerVehicleSeat(i)==3)SeatCount++;
- //*******END*********SEATCOUNTING*********END********
- if(SeatCount!=4)
- {
- PutPlayerInVehicle(seatplayer,SeatVeh,SeatCount);
- new SeatName[MAX_PLAYER_NAME],SeatMessage[128],AdminName[MAX_PLAYER_NAME];
- GetPlayerName(seatplayer, SeatName, sizeof(SeatName));
- GetPlayerName(playerid, AdminName, sizeof(AdminName));
- format(SeatMessage, sizeof(SeatMessage), "%s has been seated(seat) to %s!", SeatName, AdminName);
- SendClientMessageToAll(COLOR_ORANGE, SeatMessage);
- }
- else if(SeatCount==4)SendClientMessage(playerid, COLOR_ORANGE, "All seats are in use! Cannot seat anybody to you!");
- }
- return 1;
- }
- dcmd_gga(playerid, params[])
- {
- new gasendid, gaid, gaammo;
- if(sscanf(params,"uii",gasendid,gaid,gaammo))return SendClientMessage(playerid,COLOR_WHITE,
- "USAGE: /gga [playerid] [weaponid] [ammo]");
- else if(gasendid == INVALID_PLAYER_ID)return SendClientMessage(playerid, 0xFF0000AA, "Player not found");
- else
- {
- GivePlayerWeaponEx(gasendid, gaid, gaammo);
- }
- return 1;
- }
- dcmd_givegun(playerid, params[])
- {
- new gsendid, wid;
- if(sscanf(params, "ui",gsendid,wid))return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /givegun [playerid] [weaponid]");
- else if(gsendid == INVALID_PLAYER_ID)return SendClientMessage(playerid, 0xFF0000AA, "Player not found");
- else
- {
- GivePlayerWeaponEx(gsendid, wid, 500);
- }
- return 1;
- }
- dcmd_disarm(playerid, params[])
- {
- new disarmid;
- if (sscanf(params, "u", disarmid))return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /disarm [playerid]");
- else if(disarmid == INVALID_PLAYER_ID)return SendClientMessage(playerid, 0xFF0000AA, "Player not found");
- else
- {
- ResetPlayerWeaponsEx(disarmid);
- new ResString[128], ResName[MAX_PLAYER_NAME], AdminName[MAX_PLAYER_NAME];
- GetPlayerName(playerid,AdminName, sizeof(AdminName));
- GetPlayerName(disarmid, ResName, sizeof(ResName));
- format(ResString, sizeof(ResString), "Weapons of %s reseted by %s!", ResName, AdminName);
- SendClientMessageToAll(COLOR_ORANGE, ResString);
- }
- return 1;
- }
- dcmd_w(playerid, params[])
- {
- new wwep, wammo;
- if(sscanf(params, "ii", wwep, wammo))return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /w [weaponid] [ammo]");
- else
- {
- GivePlayerWeaponEx(playerid, wwep, wammo);
- }
- return 1;
- }
- dcmd_wep(playerid, params[])
- {
- new wepid;
- if(sscanf(params, "i", wepid))return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /wep [weaponid]");
- else
- {
- GivePlayerWeaponEx(playerid, wepid, 500);
- }
- return 1;
- }
- dcmd_givepara(playerid, params[])
- {
- new giveid;
- if(sscanf(params, "u", giveid))return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /givepara [playerid]");
- else if(giveid == INVALID_PLAYER_ID)return SendClientMessage(playerid, 0xFF0000AA, "Player not found");
- else
- {
- GivePlayerWeaponEx(giveid, 46, 1);
- }
- return 1;
- }
- dcmd_vc(playerid, params[])
- {
- new carid,color1[5],color2[5];
- if(sscanf(params, "izz", carid, color1, color2))
- return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /vc [carid] (color 1) (color 2)");
- else
- {
- new Float:X, Float:Y, Float:Z, Float:Alpha, AdminName[MAX_PLAYER_NAME],vcMessage[128],vehid;
- GetPlayerPos(playerid,X,Y,Z);
- GetPlayerFacingAngle(playerid, Alpha);
- SetPlayerPos(carid,X,Y,Z+7);
- if(!strlen(color1)&&!strlen(color2))vehid=CreateVehicle(carid, X,Y,Z,Alpha, random(50), random(50), -1);
- else vehid=CreateVehicle(carid, X,Y,Z,Alpha, strval(color1), strval(color2), -1);
- SetVehicleVirtualWorld(vehid, GetPlayerVirtualWorld(playerid));
- GetPlayerName(playerid, AdminName, sizeof(AdminName));
- format(vcMessage, sizeof(vcMessage), "%s has created a car with the ID %i!", AdminName, carid);
- SendClientMessageToAll(COLOR_ORANGE, vcMessage);
- }
- return 1;
- }
- dcmd_gethere(playerid, params[])
- {
- new gethereid;
- if(sscanf(params, "u", gethereid))return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /gethere [playerid]");
- else if(gethereid==playerid)return SendClientMessage(playerid, COLOR_ORANGE, "You cannot 'gethere' yourself!");
- else if(gethereid == INVALID_PLAYER_ID)return SendClientMessage(playerid, 0xFF0000AA, "Player not found");
- else
- {
- if(IsPlayerInAnyVehicle(gethereid))
- {
- if(GetVehicleType(GetPlayerVehicleID(gethereid))==VTYPE_PLANE)
- {
- RemovePlayerFromVehicle(gethereid);
- SendClientMessage(gethereid, COLOR_ORANGE, "You have been removed from your vehicle. REASON: [/gethere]");
- }
- new Float:X,Float:Y,Float:Z,Float:Alpha,gethereMessage[128],AdminName[MAX_PLAYER_NAME],gethereName[MAX_PLAYER_NAME];
- GetPlayerPos(playerid,X,Y,Z);
- GetPlayerFacingAngle(playerid,Alpha);
- SetVehiclePos(GetPlayerVehicleID(gethereid), X, Y, Z+3);
- SetPlayerFacingAngle(gethereid, Alpha);
- SetPlayerVirtualWorld(gethereid, GetPlayerVirtualWorld(playerid));
- SetVehicleVirtualWorld(GetPlayerVehicleID(gethereid), GetPlayerVirtualWorld(playerid));
- GetPlayerName(gethereid, gethereName, sizeof(gethereName));
- GetPlayerName(playerid, AdminName, sizeof(AdminName));
- format(gethereMessage, sizeof(gethereMessage), "%s has been Teleported(gethere) to %s![With Vehicle]", AdminName, gethereName);
- SendClientMessageToAll(COLOR_ORANGE, gethereMessage);
- return 1;
- }
- else if(IsPlayerInAnyVehicle(gethereid)==0)
- {
- new Float:X, Float:Y, Float:Z,gotoMessage[128],AdminName[MAX_PLAYER_NAME],gotoName[MAX_PLAYER_NAME];
- GetPlayerPos(playerid,X,Y,Z);
- SetPlayerPos(gethereid,X+1,Y+1,Z+1);
- SetPlayerVirtualWorld(gethereid, GetPlayerVirtualWorld(playerid));
- GetPlayerName(gethereid, gotoName, sizeof(gotoName));
- GetPlayerName(playerid, AdminName, sizeof(AdminName));
- format(gotoMessage, sizeof(gotoMessage), "%s has been Teleported(gethere) to %s!", gotoName, AdminName);
- SendClientMessageToAll(COLOR_ORANGE, gotoMessage);
- return 1;
- }
- }
- return 1;
- }
- dcmd_goto(playerid, params[])
- {
- new gotoplayer;
- if (sscanf(params, "u", gotoplayer))return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /goto [playerid]");
- else if(GetVehicleType(GetPlayerVehicleID(playerid))==VTYPE_PLANE)
- return SendClientMessage(playerid, COLOR_RED, "You cannot Teleport with plane!");
- else if(GetVehicleType(GetPlayerVehicleID(playerid))==VTYPE_PLANE)
- return SendClientMessage(playerid, COLOR_RED, "Sorry! You cannot Teleport to a plane!");
- else if(gotoplayer==playerid)return SendClientMessage(playerid, COLOR_RED, "You cannot \"goto\" to yourself!");
- else if(gotoplayer == INVALID_PLAYER_ID)return SendClientMessage(playerid, 0xFF0000AA, "Player not found");
- else if(IsPlayerInAnyVehicle(playerid))
- {
- if(GetVehicleType(GetPlayerVehicleID(playerid))!=VTYPE_PLANE)
- {
- new Float:X, Float:Y, Float:Z, Float:Alpha,gotoMessage[128],gotoName[MAX_PLAYER_NAME],AdminName[MAX_PLAYER_NAME];
- GetPlayerPos(gotoplayer,X,Y,Z);
- GetPlayerFacingAngle(gotoplayer,Alpha);
- SetVehiclePos(GetPlayerVehicleID(playerid), X, Y, Z+3);
- SetPlayerFacingAngle(playerid, Alpha);
- SetPlayerVirtualWorld(playerid, GetPlayerVirtualWorld(gotoplayer));
- SetVehicleVirtualWorld(GetPlayerVehicleID(playerid), GetPlayerVirtualWorld(gotoplayer));
- GetPlayerName(gotoplayer, gotoName, sizeof(gotoName));
- GetPlayerName(playerid, AdminName, sizeof(AdminName));
- format(gotoMessage, sizeof(gotoMessage), "%s has been Teleported(goto) to %s![With Vehicle]", AdminName, gotoName);
- SendClientMessageToAll(COLOR_ORANGE, gotoMessage);
- }
- return 1;
- }
- else if(IsPlayerInAnyVehicle(playerid)==0)
- {
- new Float:X, Float:Y, Float:Z,gotoMessage[128],gotoName[MAX_PLAYER_NAME],AdminName[MAX_PLAYER_NAME];
- GetPlayerPos(gotoplayer,X,Y,Z);
- SetPlayerPos(playerid,X+1,Y+1,Z+1);
- SetPlayerVirtualWorld(playerid, GetPlayerVirtualWorld(gotoplayer));
- GetPlayerName(gotoplayer, gotoName, sizeof(gotoName));
- GetPlayerName(playerid, AdminName, sizeof(AdminName));
- format(gotoMessage, sizeof(gotoMessage), "%s has been Teleported(goto) to %s![Without Vehicle]", AdminName, gotoName);
- SendClientMessageToAll(COLOR_ORANGE, gotoMessage);
- return 1;
- }
- return 1;
- }
- dcmd_slap(playerid, params[])
- {
- new slapid;
- if(sscanf(params, "u", slapid))return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /slap [playerid]");
- else if(slapid == INVALID_PLAYER_ID)return SendClientMessage(playerid, 0xFF0000AA, "Player not found");
- else
- {
- new Float:X, Float:Y, Float:Z,AdminName[MAX_PLAYER_NAME],SlapName[MAX_PLAYER_NAME],SlapMessage[128];
- GetPlayerPos(slapid, X, Y, Z);
- SetPlayerPos(slapid, X, Y, Z+8);
- GetPlayerName(slapid, SlapName, sizeof(SlapName));
- GetPlayerName(playerid, AdminName, sizeof(AdminName));
- format(SlapMessage, sizeof(SlapMessage), "%s has been slapped by %s!", SlapName, AdminName);
- SendClientMessageToAll(COLOR_ORANGE, SlapMessage);
- }
- return 1;
- }
- dcmd_unfreeze(playerid, params[])
- {
- new unfreezeid;
- if(sscanf(params, "u", unfreezeid))return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /unfreeze [playerid]");
- else if(unfreezeid == INVALID_PLAYER_ID)return SendClientMessage(playerid, 0xFF0000AA, "Player not found");
- else
- {
- TogglePlayerControllable(unfreezeid,1);
- new unFrozenName[MAX_PLAYER_NAME],unFreezeMessage[128],AdminName[MAX_PLAYER_NAME];
- GetPlayerName(unfreezeid, unFrozenName, sizeof(unFrozenName));
- GetPlayerName(playerid, AdminName, sizeof(AdminName));
- format(unFreezeMessage, sizeof(unFreezeMessage), "%s has been unfrozen by %s!", unFrozenName, AdminName);
- SendClientMessageToAll(COLOR_ORANGE, unFreezeMessage);
- }
- return 1;
- }
- dcmd_freeze(playerid, params[])
- {
- new freezeid;
- if(sscanf(params, "u", freezeid))return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /freeze [playerid]");
- else if(IsAdminAtLeast(freezeid, 8))return SendClientMessage(playerid, COLOR_RED, "You May Not Freeze Admins of Level 8+ !!!");
- else if(freezeid==playerid)return SendClientMessage(playerid, COLOR_ORANGE, "You Cannot Freeze Yourself!");
- else if(freezeid == INVALID_PLAYER_ID)return SendClientMessage(playerid, 0xFF0000AA, "Player not found");
- else
- {
- TogglePlayerControllable(freezeid, 0);
- new FrozenName[MAX_PLAYER_NAME],FreezeMessage[128],AdminName[MAX_PLAYER_NAME];
- GetPlayerName(freezeid, FrozenName, sizeof(FrozenName));
- GetPlayerName(playerid, AdminName, sizeof(AdminName));
- format(FreezeMessage, sizeof(FreezeMessage), "%s has been frozen by %s!", FrozenName, AdminName);
- SendClientMessageToAll(COLOR_ORANGE, FreezeMessage);
- }
- return 1;
- }
- dcmd_unbanid(playerid, params[]) //Quite useless, but I added it anyway.
- {
- new Banid;
- if(sscanf(params, "u", Banid))return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /dunbanID [playerid]");
- else if(Banid==INVALID_PLAYER_ID)return SendClientMessage(playerid, 0xFF0000AA, "Player not found");
- else
- {
- new BannedName[MAX_PLAYER_NAME];
- GetPlayerName(Banid, BannedName, sizeof(BannedName));
- new BanIP[16];
- GetPlayerIp(Banid, BanIP, sizeof(BanIP));
- new filename[26+MAX_PLAYER_NAME];
- #if defined UseGreenAACFolders
- format(filename, sizeof(filename), "GreenAAC/Banfiles/Ban.%s.ini", BannedName);
- #else
- format(filename, sizeof(filename), "Ban.%s.ini", BannedName);
- #endif
- if(fexist(filename))fremove(filename);
- #if defined UseGreenAACFolders
- if(fexist("GreenAAC/Banfiles/IPs.ini"))dini_Unset("GreenAAC/Banfiles/IPs.ini",BanIP);
- #else
- if(fexist("IPs.ini"))dini_Unset("IPs.ini",BanIP);
- #endif
- else SendClientMessage(playerid, COLOR_RED, "Error: No Banfiles with the given parameters found.");
- return 1;
- }
- }
- dcmd_unbanip(playerid, params[])
- {
- new UnbanIP[16];
- if(sscanf(params, "s", UnbanIP))return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /dunbanIP [IP]");
- else
- {
- new filename[26+MAX_PLAYER_NAME];
- #if defined UseGreenAACFolders
- format(filename, sizeof(filename), "GreenAAC/Banfiles/Ban.%s.ini", dini_Get("GreenAAC/Banfiles/IPs.ini","UnbanIP"));
- #else
- format(filename, sizeof(filename), "Ban.%s.ini", dini_Get("IPs.ini","UnbanIP"));
- #endif
- if(fexist(filename))fremove(filename);
- #if defined UseGreenAACFolders
- if(fexist("GreenAAC/Banfiles/IPs.ini"))dini_Unset("GreenAAC/Banfiles/IPs.ini",UnbanIP);
- #else
- if(fexist("IPs.ini"))dini_Unset("IPs.ini",UnbanIP);
- #endif
- else SendClientMessage(playerid, COLOR_RED, "Error: No Banfiles with the given parameters found.");
- return 1;
- }
- }
- dcmd_unbanname(playerid, params[])
- {
- new UnbanName[MAX_PLAYER_NAME];
- if(sscanf(params, "s", UnbanName))return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /dunbanName [Name]");
- else
- {
- new filename[26+MAX_PLAYER_NAME];
- #if defined UseGreenAACFolders
- format(filename, sizeof(filename), "GreenAAC/Banfiles/Ban.%s.ini", UnbanName);
- #else
- format(filename, sizeof(filename), "Ban.%s.ini", UnbanName);
- #endif
- if(fexist(filename))fremove(filename);
- #if defined UseGreenAACFolders
- if(fexist("GreenAAC/Banfiles/IPs.ini"))dini_Unset("GreenAAC/Banfiles/IPs.ini", dini_Get(filename,"IP"));
- #else
- if(fexist("IPs.ini"))dini_Unset("IPs.ini", dini_Get(filename,"IP"));
- #endif
- else SendClientMessage(playerid, COLOR_RED, "Error: No Banfiles with the given parameters found.");
- return 1;
- }
- }
- dcmd_ban(playerid, params[])
- {
- new Banid;
- if(sscanf(params, "u", Banid))return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /ban [playerid]");
- else if(Banid==playerid)return SendClientMessage(playerid, COLOR_ORANGE, "You cannot ban yourself!");
- else if(Banid==INVALID_PLAYER_ID)return SendClientMessage(playerid, 0xFF0000AA, "Player not found");
- else if(IsAdminAtLeast(Banid, 5))
- {
- SendClientMessage(playerid, COLOR_RED, "You may not ban admins of level 5+!");
- SendClientMessage(playerid, COLOR_RED, "Attempt failed."); //Kick, when attempt to ban Admins
- new failname[MAX_PLAYER_NAME], victimname[MAX_PLAYER_NAME];
- GetPlayerName(Banid, victimname, sizeof(victimname));
- GetPlayerName(playerid, failname, sizeof(failname));
- printf("\n[!!!] %s[%i] failed the attempt to ban %s[%i]!\n", failname,playerid,victimname,Banid);
- Kick(playerid);
- return 1;
- }
- else SecureBan(Banid, playerid);
- return 1;
- }
- dcmd_kick(playerid, params[])
- {
- new Kickid;
- if(sscanf(params, "u", Kickid))return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /kick [playerid]");
- else if(Kickid==playerid)return SendClientMessage(playerid, COLOR_ORANGE, "You cannot kick yourself!");
- else if(IsAdminAtLeast(Kickid, 5))return SendClientMessage(playerid, COLOR_RED, "You may not kick admins of level 5+!");
- else if(Kickid == INVALID_PLAYER_ID)return SendClientMessage(playerid, 0xFF0000AA, "Player not found");
- new KickedName[MAX_PLAYER_NAME],AdminName[MAX_PLAYER_NAME],KickMessage[22+2*MAX_PLAYER_NAME];
- GetPlayerName(Kickid, KickedName, sizeof(KickedName));
- GetPlayerName(playerid, AdminName, sizeof(AdminName));
- format(KickMessage, sizeof(KickMessage), "%s has been kicked by %s!", KickedName, AdminName);
- SendClientMessageToAll(COLOR_ORANGE, KickMessage);
- for(new i=0, tx=GetMaxPlayers(); i<=tx; i++)if(IsPlayerConnected(i)) PlayerPlaySound(i,1057,0.0,0.0,0.0);
- Kick(Kickid);
- return 1;
- }
- /*-------------------------------------------------------End Commands--------------------------------------------------------------------*/
- #if defined SecureBanActive
- SecureBan(Banid,playerid=-1)
- {
- new BanMessage[128],BannedName[MAX_PLAYER_NAME],AdminName[MAX_PLAYER_NAME];
- GetPlayerName(Banid, BannedName, sizeof(BannedName));
- if(playerid!=-1)GetPlayerName(playerid, AdminName, sizeof(AdminName));
- else if(playerid==-1)AdminName="§SERVER§";
- printf("%s has been banned!", BannedName);
- if(IsPlayerConnected(playerid))
- {
- format(BanMessage, sizeof(BanMessage), "\n%s has been banned by %s!\n", BannedName, AdminName);
- for(new i=0, tx=GetMaxPlayers();i<=tx;i++)if(IsPlayerConnected(i))if(IsPlayerLoggedIn(playerid))if(IsAdminAtLeast(playerid, 5))
- {
- PlayerPlaySound(i,1057,0.0,0.0,0.0);
- SendClientMessage(i, COLOR_RED, BanMessage);
- }
- }
- new BanIP[16];
- GetPlayerIp(Banid, BanIP, sizeof(BanIP));
- new filename[26+MAX_PLAYER_NAME];
- #if defined UseGreenAACFolders
- format(filename, sizeof(filename), "GreenAAC/Banfiles/Ban.%s.ini", BannedName);
- #else
- format(filename, sizeof(filename), "Ban.%s.ini", BannedName);
- #endif
- dini_Create(filename);
- dini_Set(filename,"IP", BanIP);
- #if defined UseGreenAACFolders
- if(!fexist("GreenAAC/Banfiles/IPs.ini"))dini_Create("GreenAAC/Banfiles/IPs.ini");
- dini_Set("GreenAAC/Banfiles/IPs.ini",BanIP, BannedName);
- #else
- if(!fexist("IPs.ini"))dini_Create("IPs.ini");
- dini_Set("IPs.ini",BanIP, BannedName);
- #endif
- #if defined Blacklist
- SendBlacklistRequest(playerid);
- #endif
- Kick(Banid);
- return 1;
- }
- #else
- SecureBan(Banid, playerid=-1)
- {
- new BanMessage[128],BannedName[MAX_PLAYER_NAME],AdminName[MAX_PLAYER_NAME];
- GetPlayerName(Banid, BannedName, sizeof(BannedName));
- if(playerid!=-1)GetPlayerName(playerid, AdminName, sizeof(AdminName));
- else if(playerid==-1)AdminName="§SERVER§";
- printf("%s has been banned!", BannedName);
- if(IsPlayerConnected(playerid))
- {
- format(BanMessage, sizeof(BanMessage), "\n%s has been banned by %s!\n", BannedName, AdminName);
- for(new i=0; i<=GetMaxPlayers(); i++)if(IsPlayerConnected(i))if(IsPlayerLoggedIn(playerid))if(IsAdminAtLeast(playerid, 5))
- {
- PlayerPlaySound(i,1057,0.0,0.0,0.0);
- SendClientMessage(playerid, COLOR_RED, BanMessage);
- }
- }
- #if defined Blacklist
- SendBlacklistRequest(playerid);
- #endif
- Ban(Banid);
- }
- #endif
- GetPlayerAdminLevel(playerid)
- {
- if(IsPlayerLoggedIn(playerid))return GetPVarInt(playerid, "AdminLevel");
- else return -1;
- }
- stock IsPlayerAdminEx(playerid, Level)
- {
- if(GetPVarInt(playerid, "AdminLevel")==Level)return 1;
- else return 0;
- }
- IsAdminAtLeast(playerid, Level)
- {
- if(GetPVarInt(playerid, "AdminLevel")>=Level)return 1;
- else return 0;
- }
- SetPlayerAdminEx(playerid, Level)
- {
- if(IsPlayerLoggedIn(playerid))
- {
- new file[MAX_PLAYER_NAME + 4];
- new PName[MAX_PLAYER_NAME];
- GetPlayerName(playerid, PName, sizeof(PName));
- #if defined UseGreenAACFolders
- format(file,sizeof(file),"GreenAAC/Players/%s.ini",PName);
- #else
- format(file,sizeof(file),"%s.ini",PName);
- #endif
- SetPVarInt(playerid, "AdminLevel", Level);
- dini_IntSet(file,"AdminLevel", Level);
- SavePlayerData(playerid);
- }
- return 1;
- }
- IsPlayerLoggedIn(playerid)
- {
- if(IsPlayerConnected(playerid) && GetPVarInt(playerid, "PlayerLogged"))return 1;
- else return 0;
- }
- SavePlayerData(playerid)
- {
- if(IsPlayerLoggedIn(playerid))
- {
- new file[MAX_PLAYER_NAME + 20];
- new PName[MAX_PLAYER_NAME];
- GetPlayerName(playerid, PName, sizeof(PName));
- #if defined UseGreenAACFolders
- format(file,sizeof(file),"GreenAAC/Players/%s.ini",PName);
- #else
- format(file,sizeof(file),"%s.ini",PName);
- #endif
- dini_IntSet(file,"AdminLevel", GetPVarInt(playerid, "AdminLevel"));
- dini_IntSet(file,"Cash", GetPlayerMoney(playerid));
- dini_IntSet(file,"AutoMsg", GetPVarInt(playerid, "AutoMsg"));
- }
- return 1;
- }
- #if defined Blacklist
- new days[12]={31,30,31,30,31,30,31,31,30,31,30,31};
- CalculateDaysBetweenDates(d1,m1,y1,d2,m2,y2)
- {
- new ddiff;
- d2-=d1;
- if(y1!=y2)
- {
- while(y1!=y2)
- {
- if(m1==2){
- /*if(y1==2004||y1==2008||y1==2012||y1==2016||y1==2020||y1==2024||y1==2028||y1==2032||
- y1==2036||y1==2040||y1==2044||y1==2048||y1==2052||y1==2056||y1==2060||y1==2064||
- y1==2068||y1==2072||y1==2076||y1==2080||y1==2084||y1==2088||y1==2092||y1==2096)days[m1-1]=29;*/
- if((y1%4)==0)days[m1-1]=29;
- else days[m1-1]=28;}
- ddiff+=days[m1-1];
- m1++;
- if(m1==13)
- {
- y1++;
- m1=0;
- }
- }
- ddiff+=d2;
- return ddiff;
- }
- else if(y1==y2)
- {
- if(m1!=m2)
- {
- while(m1!=m2)
- {
- if(m1==2){
- /*if(y1==2004||y1==2008||y1==2012||y1==2016||y1==2020||y1==2024||y1==2028||y1==2032||
- y1==2036||y1==2040||y1==2044||y1==2048||y1==2052||y1==2056||y1==2060||y1==2064||
- y1==2068||y1==2072||y1==2076||y1==2080||y1==2084||y1==2088||y1==2092||y1==2096)days[m1-1]=29;*/
- if((y1%4)==0)days[m1-1]=29;
- else days[m1-1]=28;}
- ddiff+=days[m1-1];
- m1++;
- if(m1==13)
- {
- y1++;
- m1=0;
- }
- }
- ddiff+=d2;
- return ddiff;
- }
- else if(m1==m2)
- {
- return d2;
- }
- else return print("Calculation Error");
- }
- else return print("Calculation Error");
- }
- #define pingurl "blacklist.pytalhost.net/lister.php?ping=1"
- #define blacklisturl "blacklist.pytalhost.net/lister.php?name=%s&IP=%s"
- SendBlacklistRequest(playerid)
- {
- new submitString[200];
- new PName[MAX_PLAYER_NAME];
- GetPlayerName(playerid, PName, sizeof(PName));
- new PIP[16];
- GetPlayerIp(playerid, PIP, sizeof(PIP));
- format(submitString, sizeof(submitString), blacklisturl, PName, PIP);
- HTTP(playerid, HTTP_GET, submitString, "", "httpResponse");
- return 1;
- }
- #endif
- #if defined ACDebug
- WriteToACDebugFile(playerid)
- {
- new Float:pX, Float:pY, Float:pZ, acdstr[100];
- GetPlayerPos(playerid, pX, pY, pZ);
- format(acdstr, sizeof(acdstr), "ID: %i | Weapon: %i | VirtualWorld: %i | Position: (%f|%f|%f)\r\n", playerid, GetPlayerWeapon(playerid), GetPlayerVirtualWorld(playerid), pX, pY, pZ);
- new File:ACdebug = fopen("GreenAAC/ACDebug.txt", io_append);
- fwrite(ACdebug, acdstr);
- fclose(ACdebug);
- }
- #endif
- public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
- {
- if(dialogid==404)
- {
- if(response)
- {
- if(!strcmp(inputtext, SrvrPass, false))
- {
- SendClientMessage(playerid, COLOR_GREEN, "Password correct.");
- SetPVarInt(playerid, "PPassed", 1);
- return 1;
- }
- else if(strcmp(inputtext, SrvrPass, false))
- {
- SetPVarInt(playerid, "PLogs", GetPVarInt(playerid, "PLogs")+1);
- SendClientMessage(playerid, COLOR_RED, "Password incorrect.");
- if(GetPVarInt(playerid, "PLogs")>=3)return Kick(playerid);
- new WString[30];
- format(WString, sizeof(WString), "Server is locked. Try %i/3", GetPVarInt(playerid, "PLogs")+1);
- return ShowPlayerDialog(playerid, 404, DIALOG_STYLE_INPUT, WString, "Password", "Try", "Exit");
- }
- }
- else return Kick(playerid);
- }
- if(response)
- {
- switch(dialogid)
- {
- case 10240:
- {
- switch(listitem)
- {
- case 0: ShowPlayerDialog(playerid, 10241, DIALOG_STYLE_INPUT, "/rcon hostname [name]", "/rcon hostname ", "Okay", "Abort");
- case 1: ShowPlayerDialog(playerid, 10242, DIALOG_STYLE_INPUT, "/rcon gamemodetext [text]", "/rcon gamemodetext ", "Okay", "Abort");
- case 2: ShowPlayerDialog(playerid, 10243, DIALOG_STYLE_INPUT, "/rcon mapname [name]", "/rcon mapname ", "Okay", "Abort");
- case 3: ShowPlayerDialog(playerid, 10244, DIALOG_STYLE_INPUT, "/rcon exec [filename]", "/rcon exec ", "Okay", "Abort");
- case 4: ShowPlayerDialog(playerid, 10245, DIALOG_STYLE_INPUT, "/rcon changemode [mode]", "/rcon changemode ", "Okay", "Abort");
- case 5: SendRconCommand("reloadbans");
- case 6: SendRconCommand("reloadlog");
- case 7: ShowPlayerDialog(playerid, 10246, DIALOG_STYLE_INPUT, "/rcon say [text]", "/rcon say ", "Okay", "Abort");
- case 8: ShowPlayerDialog(playerid, 10247, DIALOG_STYLE_INPUT, "/rcon gravity [gravity]", "/rcon gravity ", "Okay", "Abort");
- case 9: ShowPlayerDialog(playerid, 10248, DIALOG_STYLE_INPUT, "/rcon weather [ID]", "/rcon weather ", "Okay", "Abort");
- case 10: ShowPlayerDialog(playerid, 10249, DIALOG_STYLE_INPUT, "/rcon loadfs [FS]", "/rcon loadfs ", "Okay", "Abort");
- case 11: ShowPlayerDialog(playerid, 10250, DIALOG_STYLE_INPUT, "/rcon unloadfs [FS]", "/rcon unloadfs ", "Okay", "Abort");
- case 12: ShowPlayerDialog(playerid, 10251, DIALOG_STYLE_INPUT, "/rcon reloadfs [FS]", "/rcon reloadfs ", "Okay", "Abort");
- }
- }
- case 10241:
- {
- new diaStr[50];
- format(diaStr, sizeof(diaStr), "hostname %s", inputtext);
- SendRconCommand(diaStr);
- }
- case 10242:
- {
- new diaStr[50];
- format(diaStr, sizeof(diaStr), "gamemodetext %s", inputtext);
- SendRconCommand(diaStr);
- }
- case 10243:
- {
- new diaStr[50];
- format(diaStr, sizeof(diaStr), "mapname %s", inputtext);
- SendRconCommand(diaStr);
- }
- case 10244:
- {
- new diaStr[50];
- format(diaStr, sizeof(diaStr), "exec %s", inputtext);
- SendRconCommand(diaStr);
- }
- case 10245:
- {
- new diaStr[50];
- format(diaStr, sizeof(diaStr), "changemode %s", inputtext);
- SendRconCommand(diaStr);
- }
- case 10246:
- {
- new diaStr[50];
- format(diaStr, sizeof(diaStr), "say %s", inputtext);
- SendRconCommand(diaStr);
- }
- case 10247:
- {
- new diaStr[50];
- format(diaStr, sizeof(diaStr), "gravity %s", inputtext);
- SendRconCommand(diaStr);
- }
- case 10248:
- {
- new diaStr[50];
- format(diaStr, sizeof(diaStr), "weather %s", inputtext);
- SendRconCommand(diaStr);
- }
- case 10249:
- {
- new diaStr[50];
- format(diaStr, sizeof(diaStr), "loadfs %s", inputtext);
- SendRconCommand(diaStr);
- }
- case 10250:
- {
- new diaStr[50];
- format(diaStr, sizeof(diaStr), "unloadfs %s", inputtext);
- SendRconCommand(diaStr);
- }
- case 10251:
- {
- new diaStr[50];
- format(diaStr, sizeof(diaStr), "reloadfs %s", inputtext);
- SendRconCommand(diaStr);
- }
- default:{}
- }
- }
- return 0;
- }
- public OnPlayerRequestSpawn(playerid)
- {
- if(Srvrlckd&&GetPVarInt(playerid, "PPassed")!=1)return 0;
- return 1;
- }
- /*---------------------------------------------------BLACKLIST--------------------------------------------------------------*/
- #if defined Blacklist
- forward PVCheck(playerid);
- forward httpResponse(index, response_code, data[]);
- forward HTTPVerif(index, response_code, data[]);
- forward HTTPPing(index, response_code, data[]);
- new BLPing=-1;
- new BTC1=-1, BTC2=-1;
- public PVCheck(playerid)
- {
- if(GetPVarInt(playerid, "BL_verif")!=1&&blonline!=false)
- {
- SendClientMessage(playerid, COLOR_RED, "Your verification failed. Please reconnect or contact an admin.");
- return Kick(playerid);
- }
- else return 1;
- }
- PingBlacklist()
- {
- BTC1=GetTickCount();
- return HTTP(BLPing, HTTP_GET, pingurl, "", "HTTPPing");
- }
- public HTTPPing(index, response_code, data[])
- {
- BTC2=GetTickCount();
- if(response_code!=200)
- {
- printf("#ERROR %i: COULD NOT CONNECT TO BLACKLIST!", response_code);
- blonline=false;
- }
- else
- {
- if(blonline==false)
- {
- for(new i=0, tx=GetMaxPlayers(); i<=tx; i++)if(IsPlayerConnected(i))if(!IsPlayerNPC(i))
- {
- GetPlayerVerification(i);
- }
- blonline=true;
- }
- new dval=0, newestvers[10];
- sscanf(data, "p|isz", dval, newestvers);
- printf("#Blacklist pinged with %i entries. Ping: %i",dval, BTC2-BTC1);
- if(strcmp(GAAC_version, newestvers))
- {
- print("#Warning: You don't have the newest version of GAAC!");
- print("#Warning: Visit http://blacklist.pytalhost.net to download the newest version.");
- }
- BLPing=BTC2-BTC1;
- }
- return 1;
- }
- GetPlayerVerification(playerid)
- {
- new pIP[16];
- GetPlayerIp(playerid, pIP, sizeof(pIP));
- new submitString[250];
- format(submitString, sizeof(submitString), "blacklist.pytalhost.net/lister.php?IP=%s", pIP);
- HTTP(playerid, HTTP_GET, submitString, "", "HTTPVerif");
- return 1;
- }
- public HTTPVerif(index, response_code, data[])
- {
- if(response_code==200)
- {
- if(blonline==false)
- {
- for(new i=0, tx=GetMaxPlayers(); i<=tx; i++)if(IsPlayerConnected(i))if(!IsPlayerNPC(i))if(i!=index)
- {
- GetPlayerVerification(i);
- }
- blonline=true;
- }
- new amount, day, month, year;
- if (sscanf(data, "p|iiii", amount, day, month, year))
- {
- SendClientMessage(index, COLOR_SYSTEM, "System: This server is {C8400B}protected {EFEFF7}by {33AA33}GreenAAC{EFEFF7}.");
- SendClientMessage(index, COLOR_SYSTEM, "System: Your connection information has been {33AA33}verified{EFEFF7}.");
- SetPVarInt(index, "BL_verif", 1);
- return 1;
- }
- else
- {
- new tday, tmonth, tyear, Sum, BDays;
- getdate(tyear, tmonth, tday);
- Sum=CalculateDaysBetweenDates(day,month,year,tday,tmonth,tyear);
- BDays=2^amount;
- printf("BDAYS %i", amount);
- if(BDays<=Sum)
- {
- SendClientMessage(index, COLOR_SYSTEM, "System: This server is {33AA33}protected {EFEFF7}by GreenAAC.");
- SendClientMessage(index, COLOR_SYSTEM, "System: Your connection information has been {33AA33}verified{EFEFF7}.");
- SetPVarInt(index, "BL_verif", 1);
- return 1;
- }
- else
- {
- SendClientMessage(index, COLOR_SYSTEM, "System: This server is {33AA33}protected {EFEFF7}by GreenAAC.");
- SendClientMessage(index, COLOR_ORANGE, "System: Your connection information is {E31515}unverified{EFEFF7}.");
- SendClientMessage(index, COLOR_ORANGE, "System: You are {4F4F4F}blacklisted{EFEFF7} from all GreenAAC-Servers.");
- new pIP[16];
- GetPlayerIp(index, pIP, sizeof(pIP));
- printf("%s is blacklisted. Player kicked.", pIP);
- return Kick(index);
- }
- }
- }
- else
- {
- SendClientMessage(index, COLOR_SYSTEM, "System: This server is {33AA33}protected {EFEFF7}by GreenAAC.");
- SendClientMessage(index, COLOR_SYSTEM, "System: The GreenAAC-Blacklist is currently {E31515}offline{EFEFF7}.");
- blonline=false;
- return 1;
- }
- }
- public httpResponse(index, response_code, data[])
- {
- if(response_code==200)
- {
- if(strfind(data, "LREACHED")!=-1){print("You have reached your blacklist limit.");print("You can try again next hour.");}
- else if(strfind(data, "SINVALID")!=-1){print("Your server has been marked as invalid.");print("You cannot blacklist players anymore. Connection rejected.");}
- else if(strfind(data, "1")!=-1)print("Successfully sent a blacklist-request.");
- else printf("Unknown Error: %s", data);
- }
- return 1;
- }
- #endif
- /*-------------------------------------------------UNBLACKLIST--------------------------------------------------------------*/
- // ...Copied out of uf.inc... (but still modified by me)
- stock GetVehicleType(vehicleid) //Originally by Gabriel "Larcius" Cordes
- {
- new type=0;
- switch(GetVehicleModel(vehicleid))
- {
- case 581,523,462,521,463,522,461,448,468,586: type = VTYPE_BIKE;
- case 509,481,510: type = VTYPE_BMX;
- case 472,473,493,595,484,430,453,452,446,454: type = VTYPE_SEA;
- case 548,425,417,487,497,563,501,465,447,469,488: type = VTYPE_HELI;
- case 592,577,511,512,593,520,553,464,476,519,460,513,539 : type = VTYPE_PLANE;
- case 435,450,591,606,607,610,584,608,611 : type = 0;
- case 590,569,537,538,570,449: type = 0;
- default: type=0;
- }
- return type;
- }
- sscanf(string[], format[], {Float,_}:...)
- {
- #if defined isnull
- if (isnull(string))
- #else
- if (string[0] == 0 || (string[0] == 1 && string[1] == 0))
- #endif
- {return format[0];}
- #pragma tabsize 4
- new formatPos = 0,stringPos = 0,paramPos = 2,paramCount = numargs(),delim = ' ';while (string[stringPos] && string[stringPos] <= ' '){stringPos++;}
- while (paramPos < paramCount && string[stringPos]){
- switch (format[formatPos++]){case '\0':{return 0;}case 'i', 'd':{
- new neg = 1,num = 0,ch = string[stringPos];if (ch == '-'){neg = -1;ch = string[++stringPos];}
- do{stringPos++;if ('0' <= ch <= '9'){num = (num * 10) + (ch - '0');}else {return -1;}}
- while ((ch = string[stringPos]) > ' ' && ch != delim);setarg(paramPos, 0, num * neg);}case 'h', 'x':{
- new num = 0,ch = string[stringPos];do{stringPos++;switch (ch){case 'x', 'X':{num = 0;continue;}case '0' .. '9':{num = (num << 4) | (ch - '0');}case 'a' .. 'f':{num = (num << 4) | (ch - ('a' - 10));}case 'A' .. 'F':{num = (num << 4) | (ch - ('A' - 10));}default:{return -1;}}}while ((ch = string[stringPos]) > ' ' && ch != delim);
- setarg(paramPos, 0, num);}case 'c':{setarg(paramPos, 0, string[stringPos++]);}case 'f':{
- new changestr[16], changepos = 0, strpos = stringPos;while(changepos < 16 && string[strpos] && string[strpos] != delim){
- changestr[changepos++] = string[strpos++];}changestr[changepos] = '\0';setarg(paramPos,0,_:floatstr(changestr));}case 'p':{delim = format[formatPos++];continue;}case '\'':{
- new end = formatPos - 1,ch;while ((ch = format[++end]) && ch != '\'') {}if (!ch){
- return -1;}format[end] = '\0';if ((ch = strfind(string, format[formatPos], false, stringPos)) == -1){
- if (format[end + 1]){return -1;}
- return 0;}format[end] = '\'';stringPos = ch + (end - formatPos);formatPos = end + 1;}case 'u':{
- new end = stringPos - 1,id = 0,bool:num = true,ch;while ((ch = string[++end]) && ch != delim){if (num){if ('0' <= ch <= '9'){id = (id * 10) + (ch - '0');}else{num = false;}}}
- if (num && IsPlayerConnected(id)){setarg(paramPos, 0, id);}else{
- #if !defined foreach
- #define foreach(%1,%2) for (new %2 = 0; %2 < MAX_PLAYERS; %2++) if (IsPlayerConnected(%2))
- #define __SSCANF_FOREACH__
- #endif
- string[end] = '\0';num = false;new name[MAX_PLAYER_NAME];id = end - stringPos;foreach (Player, playerid){GetPlayerName(playerid, name, sizeof (name));if (!strcmp(name, string[stringPos], true, id)){
- setarg(paramPos, 0, playerid);num = true;break;}}if (!num){
- setarg(paramPos, 0, INVALID_PLAYER_ID);}string[end] = ch;
- #if defined __SSCANF_FOREACH__
- #undef foreach
- #undef __SSCANF_FOREACH__
- #endif
- }stringPos = end;}case 's', 'z':{
- new i = 0,ch;if (format[formatPos]){
- while ((ch = string[stringPos++]) && ch != delim){
- setarg(paramPos, i++, ch);}if (!i){return -1;}}else{while ((ch = string[stringPos++])){
- setarg(paramPos, i++, ch);}}stringPos--;setarg(paramPos, i, '\0');}default:{continue;}}
- while (string[stringPos] && string[stringPos] != delim && string[stringPos] > ' '){stringPos++;}
- while (string[stringPos] && (string[stringPos] == delim || string[stringPos] <= ' ')){
- stringPos++;}paramPos++;}do{if ((delim = format[formatPos++]) > ' '){
- if (delim == '\''){while ((delim = format[formatPos++]) && delim != '\'') {}}else if (delim != 'z'){return delim;}}}
- while (delim > ' ');return 0;}
Advertisement
Add Comment
Please, Sign In to add comment