Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * Copyright (C) 2012 Mellnik
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
- /*________________________________________________________________________________
- MellAdmin - Advanced Account System
- --------------------------------------
- (¯`·._.·MELLNIK·._.·´¯)
- VERSION: 1.2 (11/13/2012)
- --------------------------------------
- ________________________________________________________________________________
- Special thanks to,
- --------------------------------------
- Y_Less for sscanf and the MD5 include
- BlueG (G-Stylezzzz) for MySQL
- DracoBlue for DINI
- ZeeX for ZCMD
- -------------------------------------
- ________________________________________________________________________________
- Forum thread: http://forum.sa-mp.com/showthread.php?t=372212
- ================================================================================
- Includes
- ===============================================================================*/
- #include <a_samp>
- #include <dini> //remove this line if you use MySQL (USE_MYSQL)
- #include <a_mysql> //remove this line if you use DINI (USE_MYSQL)
- #include <md5> //remove this line if you use MySQL [MD5 will be still used (MD5 is implemented in MySQL)] (USE_MYSQL)
- #include <sscanf2>
- #include <zcmd>
- #pragma dynamic 2400
- /*==============================================================================
- Saving Options
- ===============================================================================*/
- #define USE_MYSQL (false) //true = mysql_R7 by BlueG | false = dini_1.6 by DracoBlue
- #define DINI_PATH "Account" //The dini path if you use DINI
- //You dont need this if you use dini
- #if USE_MYSQL == true
- #define MYSQL_HOST "127.0.0.1" //mysql server address | if mysql server is running on the same machine as samp use "localhost" or "127.0.0.1"
- #define MYSQL_USER "root" //mysql user
- #define MYSQL_PASS "" //mysql password
- #define MYSQL_DB "samp" //mysql database
- #define MYSQL_TABLE "Account" //The table name where to save
- #endif
- /*==============================================================================
- Colors
- ===============================================================================*/
- #define RED (0xFF0A00FF)
- #define DARK_RED (0x910000FF)
- #define GREEN (0x73FF00FF)
- #define LIGHT_GREEN (0x9BFF00FF)
- #define BLUE (0x00A5FFFF)
- #define DARK_BLUE (0x0000FFFF)
- #define ORANGE (0xFF8200FF)
- #define YELLOW (0xFFFA00FF)
- #define GREY (0xAAAAAAFF)
- #define BLACK (0x000000FF)
- #define PURPLE (0xA000FFFF)
- #define WHITE (0xF0F0F0FF)
- #define red "{E10000}"
- #define orange "{FF7E19}"
- #define yellow "{FF9E00}"
- #define blue "{0087FF}"
- #define white "{FFFFFF}"
- #define green "{00FF28}"
- #define grey "{969696}"
- /*==============================================================================
- General Settings
- (true|false|
- ===============================================================================*/
- #define SERVER_NAME "my awesome server name" //your server name
- #define MAX_ADMIN_LEVEL (10) //Max. admin level
- #define MAX_VIP_LEVEL (3) //Max. VIP level
- #define USE_AUTO_LOGIN (false) //true = enable false = disable
- #define MAX_WARNINGS (3) //Max. Warnings before player gets kicked
- #define MAX_REPORTS (10) //max. reports
- #define MAX_BAD_RCON_ATTEMPS (2) //Max. bad rcon attemps
- #define ENABLE_SPECATE (true) //Enabling the specsystem
- #define USE_PM_SYSTEM (true) //Enabling the PM SYSTEM
- #define MAX_FAIL_LOGINS (3)
- #define VERSION "1.2" //define version
- #define MIN_PASS_LEN (3) //min. password lengh
- #define MAX_PASS_LEN (32) //max. password lengh
- #define USE_VIP_SYSTEM (true) //true = enable false = disable
- #define USE_CHAT_BUBBELS (true) //true = enable false = disable
- #define USE_ID_MESSAGES (true) //eg.: "Mellnik(ID 42): Hello there!"
- #define ENABLE_ADMIN_CHAT (true) //true = enable false = disable
- #define USE_RANDOM_MSGS (true) //true = enable false = disable
- #define RAND_MSG_INTERVAL (60) //random messages interval in seconds
- #define USE_ANTI_ADS (true) //anti advertising true|false (anti ip in chat)
- #define MAX_PING (350) //max. allowed ping | only works if you enable
- #define PINGCHECK_TIME (2) //ping check interval in seconds
- #define MAX_EXCEEDS (3) //how many times it is allowed to exceed the ping limit
- #define OPC_DELAY (4) //if you set USE_OPC_DELAY to true, you change the delay until the checktimer for the player will be executed (no need to change this)
- #define USE_OPC_DELAY (true) //when a player connect he always has a high ping true= player will be checked after he connected (5 seconds) false= player will be checked immediately after he connected (not recommend)
- #define IS_ADMIN_IMMUNE (true) //is an admin immune against the ping kicker (true|false)
- #define SEND_MSG_BYKICK (true) //send a message to all when a player gets kicked cause of high ping (true|false)
- #define SEND_ADM_BYEXCEED (true) //send message to admin when player exceeds the ping limit (true|false)
- #define SEND_PMSG_BYEXCEED (true) //send a message to player when he exceeds the ping limit (true|false)
- #define PRINT_BYKICK (true) //print message in server logs when player gets kicked (true|false)
- #define LOAD_PLAYER_POS (true) //Should the player pos be be loaded by first spawn?
- #define LOAD_PLAYER_HA (true) //load player health and armour by login? (true|false|
- #define NO_PERM "Insufficient permissions" //this is the message which will be send to the player if he hasnt the needed adminlevel
- /*==============================================================================
- MySQL Threads - no need to change
- ===============================================================================*/
- #if USE_MYSQL == true
- #define _THREAD_LOAD_PLAYER (0)
- #define _THREAD_SAVE_PLAYER (1)
- #define _THREAD_CREATE_PLAYER (2)
- #define _THREAD_ACCOUNT_EXIST (3)
- #define _FETCH_PLAYER_INFO (4)
- #define _FETCH_BAN_STAT (5)
- #define _UPDATE_PLAYER_PW (6)
- #define _THREAD_IS_BANNED (7)
- #define _CHECK_PASSWORD (8)
- #define _THREAD_BAN_USER (9)
- #define _CHECK_AUTO_LOGIN (10)
- #define _THREAD_PLAYER_LOGIN (11)
- #define _THREAD_PLAYER_LOGOUT (12)
- #define _THREAD_GET_AKA (13)
- #endif
- /*==============================================================================
- Dialog IDs - Be sure that they are not already used in other of your scritps
- ===============================================================================*/
- #define LOGIN_DIALOG (10000)
- #define REGISTER_DIALOG (10100)
- #define BAN_DIALOG (10200)
- #define VEHICLE_DIALOG (10300)
- #define WEAPON_DIALOG (10400)
- #define STATS_DIALOG (10500)
- #define ADMINHELP_DIALOG (10600)
- #define VTOYS_DIALOG (10700)
- #define VIPS_DIALOG (10800)
- #define AKA_DIALOG (10900)
- /*==============================================================================
- Other Defines - No need to change them
- ================================================================================*/
- #define UpperToLower(%1) for(new ToLowerChar; ToLowerChar < strlen( %1 ); ToLowerChar ++ ) if ( %1[ ToLowerChar ]> 64 && %1[ ToLowerChar ] < 91 ) %1[ ToLowerChar ] += 32
- #define ADMIN_SPEC_TYPE_NONE (0)
- #define ADMIN_SPEC_TYPE_PLAYER (1)
- #define ADMIN_SPEC_TYPE_VEHICLE (2)
- /*==============================================================================
- command permissions - set the level which is needed for these commands
- !!! >>>> "LEVEL_" is not a part of the command its just for the defines <<<< !!!
- Setting it to 0 will make the command available for everyone
- Players with a higher adminlevel than needed for a command can still use all commands which
- are lower than their level
- Do not set the need adminlevel higher than MAX_ADMIN_LEVEL or they get interrupted
- command: adminlevel at least: what the command does:
- ================================================================================*/
- #define LEVEL_togping (10) //command for enable/disabling ping kicker
- #define LEVEL_reports (1) //command which shows all written reports
- #define LEVEL_spec (1) //cmd for specing someone
- #define LEVEL_onduty (3) //same level is for /offduty
- #define LEVEL_enable (10) //server settings
- #define LEVEL_disable (10) //server settings
- #define LEVEL_adminhelp (1) //see all available commad
- #define LEVEL_mytime (1)
- #define LEVEL_eject (3) //ject someone from a vehicle
- #define LEVEL_burn (3)
- #define LEVEL_crash (4) //crash the game of a player
- #define LEVEL_ip (3)
- #define LEVEL_asay (1)
- #define LEVEL_announce (7) //gametext msg to every player
- #define LEVEL_goto (5) //goto a player
- #define LEVEL_get (8)
- #define LEVEL_kick (5)
- #define LEVEL_mute (4)
- #define LEVEL_unmute (4)
- #define LEVEL_ban (8)
- #define LEVEL_warn (2) //just a kick warning, by 3 warns player gets kicked
- #define LEVEL_slap (2)
- #define LEVEL_setadminlevel (10)
- #define LEVEL_setviplevel (10)
- #define LEVEL_richlist (1)
- #define LEVEL_unfreeze (5)
- #define LEVEL_freeze (5)
- #define LEVEL_clearchat (9)
- #define LEVEL_move (8)
- #define LEVEL_healall (10)
- #define LEVEL_armourall (10)
- #define LEVEL_setallweather (6)
- #define LEVEL_setalltime (9)
- #define LEVEL_cashfall (10) //will give everyone 100 score
- #define LEVEL_scorefall (10) //will give everyone $50,000
- #define LEVEL_jail (5)
- #define LEVEL_unjail (5)
- #define LEVEL_wanteds (2)
- #define LEVEL_jailed (2)
- #define LEVEL_frozen (2)
- #define LEVEL_akill (4)
- #define LEVEL_showguns (1)
- #define LEVEL_morning (1)
- #define LEVEL_miniguns (1)
- #define LEVEL_muted (1)
- #define LEVEL_killall (9)
- #define LEVEL_kickall (9)
- #define LEVEL_setallwanted (9)
- #define LEVEL_disarmall (10)
- #define LEVEL_ejectall (8)
- #define LEVEL_giveallweapon (7)
- #define LEVEL_spawnveh (3)
- #define LEVEL_setmoney (4)
- #define LEVEL_setscore (4)
- #define LEVEL_setwanted (4)
- #define LEVEL_aka (7)
- #define LEVEL_sethealth (5)
- #define LEVEL_setarmour (5)
- /*==============================================================================
- VIP COMMANDS:
- write a ! before your text ingame to enter vip chat
- "VIP_" is not part of the command
- command: needed level:
- ================================================================================*/
- #define VIP_vsay (2)
- #define VIP_mycolor (3)
- #define VIP_myweather (1)
- #define VIP_vtoys (2)
- /*==============================================================================
- NON-ADMIN COMMANDS:
- /vips /pay /admins /time /pm /stats /report /changepass /flip
- ================================================================================
- ================================================================================
- Enums
- ===============================================================================*/
- enum PlayerData
- {
- Float:XPos,
- Float:YPos,
- Float:ZPos,
- Float:Health,
- Float:Armour,
- bool:Logged,
- AdminLevel,
- Kills,
- Deaths,
- Hours,
- Minutes,
- Seconds,
- TotalTime,
- ConnectTime,
- Warnings,
- Vehicle,
- FailLogins,
- bool:Muted,
- MuteTimer,
- bool:Jailed,
- JailTime,
- JailTimer,
- PingExceeds,
- PingTimer,
- bool:Frozen,
- VIPLevel,
- #if ENABLE_SPECATE == true
- SpecID,
- SpecType,
- #endif
- RconAttempt,
- LastSkin,
- FailLogin,
- bool:AdminOnDuty,
- RegDate[16],
- ReportCount,
- SpawnCount,
- KickCount
- }
- enum ServerData
- {
- bool:AutoLogin,
- bool:NoCaps,
- bool:ConnectMessages,
- bool:PingSystem,
- bool:EnableChat
- }
- /*==============================================================================
- Global Variables
- ===============================================================================*/
- new ServerInfo[ServerData];
- new PlayerInfo[MAX_PLAYERS][PlayerData];
- new Reports[MAX_REPORTS][128];
- new Text3D:adminlabel[MAX_PLAYERS];
- #if ENABLE_SPECATE == true
- new Float:Pos[MAX_PLAYERS][4];
- #endif
- #if USE_MYSQL == true
- new gSQL;
- #endif
- #if USE_RANDOM_MSGS == true
- new RandMSGS;
- new RandomMessages[][] =
- {
- ">> Saw a cheater? Use /report [id] [reason]",
- ">> Follow the server rules! /rules",
- ">> Our TeamSpeak³ Address: 127.0.0.1",
- ">> Visit our forum! www.my-forum.com"
- };
- #endif
- /*==============================================================================
- Public forwards
- ===============================================================================*/
- #if USE_RANDOM_MSGS == true
- forward RandomClientMessage();
- #endif
- #if USE_MYSQL == true
- forward OnQueryFinish(query[], resultid, extraid, connectionHandle);
- #endif
- forward Kick_Delay(playerid);
- forward ConnectedPlayers();
- forward unmute(playerid);
- forward AdminMSG(color,const string[]);
- forward VIPMSG(color,const string[]);
- forward CheckPlayerPing(playerid);
- forward Jail1(playerid);
- forward Jail2(playerid);
- forward Jail3(playerid);
- forward JailPlayer(playerid);
- forward UnjailPlayer(playerid);
- #if USE_OPC_DELAY == true
- forward ExecCheckTimerForPlayer(playerid);
- #endif
- public OnFilterScriptInit()
- {
- #if USE_MYSQL == true
- ConnectToDatabase();
- //mysql_debug(1);
- #endif
- #if USE_RANDOM_MSGS == true
- RandMSGS = SetTimer("RandomClientMessage",RAND_MSG_INTERVAL*1000,true);
- #endif
- if(!dini_Exists("/aka.txt")) dini_Create("/aka.txt");
- // (true|false]
- ServerInfo[EnableChat] = true;
- ServerInfo[AutoLogin] = true;
- ServerInfo[NoCaps] = true;
- ServerInfo[ConnectMessages] = true;
- ServerInfo[PingSystem] = true;
- ServerInfo[EnableChat] = true;
- for(new i = 1; i < MAX_REPORTS; i++) Reports[i] = "<none>";
- print("=======================================================================");
- print(" >> MellAdmin - Advanced Account System V."#VERSION" loaded! ");
- print("=======================================================================");
- return 1;
- }
- public OnFilterScriptExit()
- {
- #if USE_RANDOM_MSGS == true
- KillTimer(RandMSGS);
- #endif
- print("=======================================================================");
- print(" << MellAdmin - Advanced Account System V."#VERSION" unloaded! ");
- print("=======================================================================");
- return 1;
- }
- public OnPlayerConnect(playerid)
- {
- PlayerInfo[playerid][XPos] = 0.0;
- PlayerInfo[playerid][YPos] = 0.0;
- PlayerInfo[playerid][ZPos] = 0.0;
- PlayerInfo[playerid][Health] = 100.0;
- PlayerInfo[playerid][Armour] = 0.0;
- PlayerInfo[playerid][FailLogin] = 0;
- PlayerInfo[playerid][Logged] = false;
- PlayerInfo[playerid][AdminLevel] = 0;
- PlayerInfo[playerid][Kills] = 0;
- PlayerInfo[playerid][Deaths] = 0;
- PlayerInfo[playerid][Warnings] = 0;
- PlayerInfo[playerid][Vehicle] = -1;
- PlayerInfo[playerid][FailLogins] = 0;
- PlayerInfo[playerid][Frozen] = false;
- PlayerInfo[playerid][Muted] = false;
- PlayerInfo[playerid][MuteTimer] = -1;
- PlayerInfo[playerid][Jailed] = false;
- PlayerInfo[playerid][JailTime] = 0;
- PlayerInfo[playerid][JailTimer] = -1;
- PlayerInfo[playerid][VIPLevel] = 0;
- PlayerInfo[playerid][Hours] = 0;
- PlayerInfo[playerid][Minutes] = 0;
- PlayerInfo[playerid][Seconds] = 0;
- PlayerInfo[playerid][TotalTime] = 0;
- #if ENABLE_SPECATE == true
- PlayerInfo[playerid][SpecID] = 0;
- PlayerInfo[playerid][SpecType] = 0;
- #endif
- PlayerInfo[playerid][LastSkin] = 0;
- PlayerInfo[playerid][FailLogin] = 0;
- PlayerInfo[playerid][AdminOnDuty] = false;
- PlayerInfo[playerid][ReportCount] = 0;
- PlayerInfo[playerid][SpawnCount] = 0;
- PlayerInfo[playerid][KickCount] = 0;
- PlayerInfo[playerid][RconAttempt] = 0;
- PlayerInfo[playerid][ConnectTime] = gettime();
- ExistAccount(playerid);
- if(ServerInfo[ConnectMessages] == true)
- {
- new string[128];
- format(string,sizeof(string),">> Player %s (ID: %d) has joined the server", GetName(playerid), playerid);
- SendClientMessageToAll(GREY, string);
- }
- SetPlayerColor(playerid, WHITE);
- PlayerInfo[playerid][PingExceeds] = 0;
- PlayerInfo[playerid][PingTimer] = -1;
- if(!IsPlayerNPC(playerid) && ServerInfo[PingSystem] == true)
- {
- #if USE_OPC_DELAY == false
- PlayerInfo[playerid][PingTimer] = SetTimerEx("CheckPlayerPing", PINGCHECK_TIME*1000, true, "d", playerid); //Starting the timer which will call the CheckPlayerPing function
- #else
- SetTimerEx("ExecCheckTimerForPlayer", OPC_DELAY*1000, false, "d", playerid);
- #endif
- }
- return 1;
- }
- public OnPlayerDisconnect(playerid, reason)
- {
- if(PlayerInfo[playerid][Logged] == true)
- {
- SavePlayer(playerid);
- LogPlayerOut(playerid);
- if(PlayerInfo[playerid][AdminOnDuty] == true)
- {
- Delete3DTextLabel(adminlabel[playerid]);
- }
- if(PlayerInfo[playerid][Vehicle] != -1) DestroyVehicle(PlayerInfo[playerid][Vehicle]);
- #if ENABLE_SPECATE == true
- for(new x=0; x<MAX_PLAYERS; x++)
- if(GetPlayerState(x) == PLAYER_STATE_SPECTATING && PlayerInfo[x][SpecID] == playerid)
- AdvanceSpectate(x);
- #endif
- }
- if((PlayerInfo[playerid][PingTimer] != -1) && (!IsPlayerNPC(playerid)))
- {
- KillTimer(PlayerInfo[playerid][PingTimer]);
- }
- return 1;
- }
- public OnPlayerCommandReceived(playerid, cmdtext[])
- {
- if(PlayerInfo[playerid][Logged] != true)
- {
- SendClientMessage(playerid, GREY, "You need to login to use commands");
- return 0;
- }
- if(PlayerInfo[playerid][Frozen] == true)
- {
- SendClientMessage(playerid, RED, "You can´t use commands now");
- return 0;
- }
- return 1;
- }
- public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
- {
- if(response)
- {
- switch(dialogid)
- {
- case LOGIN_DIALOG :
- {
- if(strlen(inputtext) < MIN_PASS_LEN || strlen(inputtext) > MAX_PASS_LEN || strlen(inputtext) == 0)
- {
- SendClientMessage(playerid, RED, "Invalid password lengh!");
- ShowPlayerLoginDialog(playerid);
- }
- else CheckPlayerPassword(playerid, inputtext);
- return 1;
- }
- case REGISTER_DIALOG :
- {
- if(strlen(inputtext) < MIN_PASS_LEN || strlen(inputtext) > MAX_PASS_LEN || strlen(inputtext) == 0)
- {
- SendClientMessage(playerid, RED, "Invalid password lengh!");
- ShowPlayerRegisterDialog(playerid);
- }
- else CreateAccount(playerid, inputtext);
- return 1;
- }
- case VEHICLE_DIALOG :
- {
- switch (listitem)
- {
- case 0 : ShowPlayerDialog( playerid, VEHICLE_DIALOG+1, DIALOG_STYLE_LIST, "Airplanes", "Andromada\nAT-400\nBeagle\nCropduster\nDodo\nNevada\nRustler\nShamal\nSkimmer\nStuntplane", "Select", "Back" );
- case 1 : ShowPlayerDialog( playerid, VEHICLE_DIALOG+2, DIALOG_STYLE_LIST, "Helicopters", "Cargobob\nLeviathan\nMaverick\nNews Maverick\nPolice Maverick\nRaindance\nSeasparrow\nSparrow", "Select", "Back" );
- case 2 : ShowPlayerDialog( playerid, VEHICLE_DIALOG+3, DIALOG_STYLE_LIST, "Bikes", "BF-400\nBike\nBMX\nFaggio\nFCR-900\nFreeway\nMountain Bike\nNRG-500\nPCJ-600\nPizzaboy\nQuad\nSanchez\nWayfarer", "Select", "Back" );
- case 3 : ShowPlayerDialog( playerid, VEHICLE_DIALOG+4, DIALOG_STYLE_LIST, "Convertibles", "Comet\nFeltzer\nStallion\nWindsor", "Select", "Back" );
- case 4 : ShowPlayerDialog( playerid, VEHICLE_DIALOG+5, DIALOG_STYLE_LIST, "Industrial", "Benson\nBobcat\nBurrito\nBoxville\nBoxburg\nCement Truck\nDFT-30\nFlatbed\nLinerunner\nMule\nNewsvan\nPacker\nPetrol Tanker\nPony\nRoadtrain\nRumpo\nSadler\nSadler Shit\nTopfun\nTractor\nTrashmaster\nUtility Van\nWalton\nYankee\nYosemite", "Select", "Back" );
- case 5 : ShowPlayerDialog( playerid, VEHICLE_DIALOG+6, DIALOG_STYLE_LIST, "Lowriders", "Blade\nBroadway\nRemington\nSavanna\nSlamvan\nTahoma\nTornado\nVoodoo", "Select", "Back" );
- case 6 : ShowPlayerDialog( playerid, VEHICLE_DIALOG+7, DIALOG_STYLE_LIST, "Off Road", "Bandito\nBF Injection\nDune\nHuntley\nLandstalker\nMesa\nMonster\nMonster A\nMonster B\nPatriot\nRancher A\nRancher B\nSandking", "Select", "Back" );
- case 7 : ShowPlayerDialog( playerid, VEHICLE_DIALOG+8, DIALOG_STYLE_LIST, "Public Service Vehicles", "Ambulance\nBarracks\nBus\nCabbie\nCoach\nCop Bike (HPV-1000)\nEnforcer\nFBI Rancher\nFBI Truck\nFiretruck\nFiretruck LA\nPolice Car (LSPD)\nPolice Car (LVPD)\nPolice Car (SFPD)\nRanger\nRhino\nS.W.A.T\nTaxi", "Select", "Back" );
- case 8 : ShowPlayerDialog( playerid, VEHICLE_DIALOG+9, DIALOG_STYLE_LIST, "Saloons", "Admiral\nBloodring Banger\nBravura\nBuccaneer\nCadrona\nClover\nElegant\nElegy\nEmperor\nEsperanto\nFortune\nGlendale Shit\nGlendale\nGreenwood\nHermes\nIntruder\nMajestic\nManana\nMerit\nNebula\nOceanic\nPicador\nPremier\nPrevion\nPrimo\nSentinel\nStafford\nSultan\nSunrise\nTampa\nVincent\nVirgo\nWillard\nWashington", "Select", "Back" );
- case 9 : ShowPlayerDialog( playerid, VEHICLE_DIALOG+10, DIALOG_STYLE_LIST, "Sport Vehicles", "Alpha\nBanshee\nBlista Compact\nBuffalo\nBullet\nCheetah\nClub\nEuros\nFlash\nHotring Racer\nHotring Racer A\nHotring Racer B\nInfernus\nJester\nPhoenix\nSabre\nSuper GT\nTurismo\nUranus\nZR-350", "Select", "Back" );
- case 10 : ShowPlayerDialog( playerid, VEHICLE_DIALOG+11, DIALOG_STYLE_LIST, "Station Wagons", "Moonbeam\nPerenniel\nRegina\nSolair\nStratum", "Select", "Back" );
- case 11 : ShowPlayerDialog( playerid, VEHICLE_DIALOG+12, DIALOG_STYLE_LIST, "Boats", "Coastguard\nDinghy\nJetmax\nLaunch\nMarquis\nPredator\nReefer\nSpeeder\nSquallo\nTropic", "Select", "Back" );
- case 12 : ShowPlayerDialog( playerid, VEHICLE_DIALOG+13, DIALOG_STYLE_LIST, "Trailers", "Article Trailer\nArticle Trailer 2\nArticle Trailer 3\nBaggage Trailer A\nBaggage Trailer B\nFarm Trailer\nPetrol Trailer\nStairs Trailer\nUtility Trailer", "Select", "Back" );
- case 13 : ShowPlayerDialog( playerid, VEHICLE_DIALOG+14, DIALOG_STYLE_LIST, "Unique Vehicles", "Baggage\nBrownstreak (Train)\nCaddy\nCamper\nCamper A\nCombine Harvester\nDozer\nDumper\nForklift\nFreight (Train)\nHotknife\nHustler\nHotdog\nKart\nMower\nMr Whoopee\nRomero\nSecuricar\nStretch\nSweeper\nTram\nTowtruck\nTug\nVortex", "Select", "Back" );
- case 14 : ShowPlayerDialog( playerid, VEHICLE_DIALOG+15, DIALOG_STYLE_LIST, "RC Vehicles", "RC Bandit\nRC Baron\nRC Raider\nRC Goblin\nRC Tiger\nRC Cam", "Select", "Back" );
- }
- }
- case VEHICLE_DIALOG+1 :
- {
- if (listitem > 9)
- {
- ShowPlayerVehicleSpawnDialog(playerid);
- return 1;
- }
- if(PlayerInfo[playerid][Vehicle] != -1) DestroyVehicle(PlayerInfo[playerid][Vehicle]);
- new
- model_array[] = { 592, 577, 511, 512, 593, 553, 476, 519, 460, 513 };
- CarSpawner(playerid, model_array[listitem]);
- return 1;
- }
- case VEHICLE_DIALOG+2 :
- {
- if ( listitem > 7 )
- {
- ShowPlayerVehicleSpawnDialog(playerid);
- return 1;
- }
- if(PlayerInfo[playerid][Vehicle] != -1) DestroyVehicle(PlayerInfo[playerid][Vehicle]);
- new
- model_array[] = { 548, 417, 487, 488, 497, 563, 447, 469 };
- CarSpawner(playerid, model_array[listitem]);
- return 1;
- }
- case VEHICLE_DIALOG+3 :
- {
- if ( listitem > 12 )
- {
- ShowPlayerVehicleSpawnDialog(playerid);
- return 1;
- }
- if(PlayerInfo[playerid][Vehicle] != -1) DestroyVehicle(PlayerInfo[playerid][Vehicle]);
- new
- model_array[] = { 581, 509, 481, 462, 521, 463, 510, 522, 461, 448, 471, 468, 586 };
- CarSpawner(playerid, model_array[listitem]);
- return 1;
- }
- case VEHICLE_DIALOG+4 :
- {
- if ( listitem > 3)
- {
- ShowPlayerVehicleSpawnDialog(playerid);
- return 1;
- }
- if(PlayerInfo[playerid][Vehicle] != -1) DestroyVehicle(PlayerInfo[playerid][Vehicle]);
- new
- model_array[] = { 480, 533, 439, 555 };
- CarSpawner(playerid, model_array[listitem]);
- return 1;
- }
- case VEHICLE_DIALOG+5 :
- {
- if ( listitem > 24 )
- {
- ShowPlayerVehicleSpawnDialog(playerid);
- return 1;
- }
- if(PlayerInfo[playerid][Vehicle] != -1) DestroyVehicle(PlayerInfo[playerid][Vehicle]);
- new
- model_array[] = { 499, 422, 482, 498, 609, 524, 578, 455, 403, 414, 582, 443, 514, 413, 515, 440, 543, 605, 459, 531, 408, 552, 478, 456, 554 };
- CarSpawner(playerid, model_array[listitem]);
- return 1;
- }
- case VEHICLE_DIALOG+6 :
- {
- if ( listitem > 7 )
- {
- ShowPlayerVehicleSpawnDialog(playerid);
- return 1;
- }
- if(PlayerInfo[playerid][Vehicle] != -1) DestroyVehicle(PlayerInfo[playerid][Vehicle]);
- new
- model_array[] = { 536, 575, 534, 567, 535, 566, 576, 412 };
- CarSpawner(playerid, model_array[listitem]);
- return 1;
- }
- case VEHICLE_DIALOG+7 :
- {
- if ( listitem > 12 )
- {
- ShowPlayerVehicleSpawnDialog(playerid);
- return 1;
- }
- if(PlayerInfo[playerid][Vehicle] != -1) DestroyVehicle(PlayerInfo[playerid][Vehicle]);
- new
- model_array[] = { 568, 424, 573, 579, 400, 500, 444, 556, 557, 470, 489, 505, 495 };
- CarSpawner(playerid, model_array[listitem]);
- return 1;
- }
- case VEHICLE_DIALOG+8 :
- {
- if ( listitem > 17 )
- {
- ShowPlayerVehicleSpawnDialog(playerid);
- return 1;
- }
- if(PlayerInfo[playerid][Vehicle] != -1) DestroyVehicle(PlayerInfo[playerid][Vehicle]);
- new
- model_array[] = { 416, 433, 431, 438, 437, 523, 427, 490, 528, 407, 544, 596, 598, 597, 599, 432, 601, 420 };
- CarSpawner(playerid, model_array[listitem]);
- return 1;
- }
- case VEHICLE_DIALOG+9 :
- {
- if ( listitem > 33 )
- {
- ShowPlayerVehicleSpawnDialog(playerid);
- return 1;
- }
- if(PlayerInfo[playerid][Vehicle] != -1) DestroyVehicle(PlayerInfo[playerid][Vehicle]);
- new
- model_array[] = { 445, 504, 401, 518, 527, 542, 507, 562, 585, 419, 526, 604, 466, 492, 474, 546, 517, 410, 551, 516, 467, 600, 426, 436, 547, 405, 580, 560, 550, 549, 540, 491, 529, 421 };
- CarSpawner(playerid, model_array[listitem]);
- return 1;
- }
- case VEHICLE_DIALOG+10 :
- {
- if ( listitem > 19 )
- {
- ShowPlayerVehicleSpawnDialog(playerid);
- return 1;
- }
- if(PlayerInfo[playerid][Vehicle] != -1) DestroyVehicle(PlayerInfo[playerid][Vehicle]);
- new
- model_array[] = { 602, 429, 496, 402, 541, 415, 589, 587, 565, 494, 502, 503, 411, 559, 603, 475, 506, 451, 558, 477 };
- CarSpawner(playerid, model_array[listitem]);
- return 1;
- }
- case VEHICLE_DIALOG+11 :
- {
- if ( listitem > 4 )
- {
- ShowPlayerVehicleSpawnDialog(playerid);
- return 1;
- }
- if(PlayerInfo[playerid][Vehicle] != -1) DestroyVehicle(PlayerInfo[playerid][Vehicle]);
- new
- model_array[] = { 418, 404, 479, 458, 561 };
- CarSpawner(playerid, model_array[listitem]);
- return 1;
- }
- case VEHICLE_DIALOG+12 :
- {
- if ( listitem > 9 )
- {
- ShowPlayerVehicleSpawnDialog(playerid);
- return 1;
- }
- if(PlayerInfo[playerid][Vehicle] != -1) DestroyVehicle(PlayerInfo[playerid][Vehicle]);
- new
- model_array[] = { 472, 473, 493, 595, 484, 430, 453, 452, 446, 454 };
- CarSpawner(playerid, model_array[listitem]);
- return 1;
- }
- case VEHICLE_DIALOG+13 :
- {
- if ( listitem > 8 )
- {
- ShowPlayerVehicleSpawnDialog(playerid);
- return 1;
- }
- if(PlayerInfo[playerid][Vehicle] != -1) DestroyVehicle(PlayerInfo[playerid][Vehicle]);
- new
- model_array[] = { 435, 450, 591, 606, 607, 610, 584, 608, 611 };
- CarSpawner(playerid, model_array[listitem]);
- return 1;
- }
- case VEHICLE_DIALOG+14 :
- {
- if ( listitem > 23 )
- {
- ShowPlayerVehicleSpawnDialog(playerid);
- return 1;
- }
- if(PlayerInfo[playerid][Vehicle] != -1) DestroyVehicle(PlayerInfo[playerid][Vehicle]);
- new
- model_array[] = { 485, 537, 457, 483, 508, 532, 486, 406, 530, 538, 434, 545, 588, 571, 572, 423, 442, 428, 409, 574, 449, 525, 583, 539 };
- CarSpawner(playerid, model_array[listitem]);
- return 1;
- }
- case VEHICLE_DIALOG+15 :
- {
- if ( listitem > 5 ) return ShowPlayerVehicleSpawnDialog( playerid );
- if(PlayerInfo[playerid][Vehicle] != -1) DestroyVehicle(PlayerInfo[playerid][Vehicle]);
- new
- model_array[] = { 441, 464, 465, 501, 564, 594 };
- CarSpawner(playerid, model_array[listitem]);
- return 1;
- }
- #if USE_VIP_SYSTEM == true
- case VTOYS_DIALOG :
- {
- switch( listitem )
- {
- case 0:
- {
- for(new i = 0; i < 5; i++)
- if(IsPlayerAttachedObjectSlotUsed(playerid, i))
- RemovePlayerAttachedObject(playerid, i);
- SetPlayerAttachedObject(playerid, 1, 19086, 8, -0.049768, -0.014062, -0.108385, 87.458297, 263.478149, 184.123764, 0.622413, 1.041609, 1.012785);
- }
- case 1:
- {
- for ( new i = 0; i < 5; i++ )
- if ( IsPlayerAttachedObjectSlotUsed( playerid, i ) )
- RemovePlayerAttachedObject( playerid, i );
- SetPlayerAttachedObject( playerid, 0, 1114, 1, 0.138007, 0.002714, -0.157366, 350.942352, 16.794704, 32.683506, 0.791829, 0.471535, 1.032759 );
- SetPlayerAttachedObject( playerid, 1, 1114, 1, 0.138007, 0.002714, 0.064523, 342.729064, 354.099456, 32.369094, 0.791829, 0.471535, 1.032759 );
- }
- case 2:
- {
- for ( new i = 0; i < 5; i++ )
- if ( IsPlayerAttachedObjectSlotUsed( playerid, i ) )
- RemovePlayerAttachedObject( playerid, i );
- SetPlayerAttachedObject( playerid, 0, 18645, 2, 0.017478, 0.051500, 0.003912, 285.055511, 90.860740, 171.179550, 1.780549, 0.912008, 1.208514 );
- SetPlayerAttachedObject( playerid, 1, 18690, 2, -2.979508, 0.306475, -0.388553, 285.055511, 90.860740, 171.179550, 1.780549, 0.912008, 1.208514 );
- SetPlayerAttachedObject( playerid, 2, 18716, 2, -2.979508, 0.306475, -0.388553, 285.055511, 90.860740, 171.179550, 1.780549, 0.912008, 1.208514 );
- }
- case 3:
- {
- for ( new i = 0; i < 5; i++ )
- if ( IsPlayerAttachedObjectSlotUsed( playerid, i ) )
- RemovePlayerAttachedObject( playerid, i );
- SetPlayerAttachedObject( playerid, 0, 18693, 5, 1.983503, 1.558882, -0.129482, 86.705787, 308.978118, 268.198822, 1.500000, 1.500000, 1.500000 );
- SetPlayerAttachedObject( playerid, 1, 18693, 6, 1.983503, 1.558882, -0.129482, 86.705787, 308.978118, 268.198822, 1.500000, 1.500000, 1.500000 );
- SetPlayerAttachedObject( playerid, 2, 18703, 6, 1.983503, 1.558882, -0.129482, 86.705787, 308.978118, 268.198822, 1.500000, 1.500000, 1.500000 );
- SetPlayerAttachedObject( playerid, 3, 18703, 5, 1.983503, 1.558882, -0.129482, 86.705787, 308.978118, 268.198822, 1.500000, 1.500000, 1.500000 );
- SetPlayerAttachedObject( playerid, 4, 18965, 2, 0.111052, 0.021643, -0.000846, 92.280899, 92.752510, 358.071044, 1.200000, 1.283168, 1.200000 );
- }
- case 4:
- {
- SetPlayerSpecialAction(playerid, 2);
- SendClientMessage(playerid, PURPLE, "Jetpack spawned");
- }
- case 5:
- {
- if(!IsPlayerAttachedObjectSlotUsed( playerid, 0 ) &&
- !IsPlayerAttachedObjectSlotUsed( playerid, 1 ) &&
- !IsPlayerAttachedObjectSlotUsed( playerid, 2 ) &&
- !IsPlayerAttachedObjectSlotUsed( playerid, 3 ) &&
- !IsPlayerAttachedObjectSlotUsed( playerid, 4 ) )
- return SendClientMessage(playerid, RED, "You are not holding any toys" );
- for ( new i = 0; i < 5; i ++ )
- {
- if ( IsPlayerAttachedObjectSlotUsed( playerid, i ) )
- {
- RemovePlayerAttachedObject( playerid, i );
- SendClientMessage( i, RED, "You removed all attached toys" );
- }
- }
- }
- }
- }
- #endif
- }
- return 1;
- }
- else if(!response)
- {
- switch(dialogid)
- {
- case LOGIN_DIALOG :
- {
- ShowPlayerLoginDialog(playerid);
- return 1;
- }
- case REGISTER_DIALOG :
- {
- ShowPlayerRegisterDialog(playerid);
- return 1;
- }
- case VEHICLE_DIALOG:{ShowPlayerVehicleSpawnDialog(playerid);}
- case VEHICLE_DIALOG+1:{ShowPlayerVehicleSpawnDialog(playerid);}
- case VEHICLE_DIALOG+2:{ShowPlayerVehicleSpawnDialog(playerid);}
- case VEHICLE_DIALOG+3:{ShowPlayerVehicleSpawnDialog(playerid);}
- case VEHICLE_DIALOG+4:{ShowPlayerVehicleSpawnDialog(playerid);}
- case VEHICLE_DIALOG+5:{ShowPlayerVehicleSpawnDialog(playerid);}
- case VEHICLE_DIALOG+6:{ShowPlayerVehicleSpawnDialog(playerid);}
- case VEHICLE_DIALOG+7:{ShowPlayerVehicleSpawnDialog(playerid);}
- case VEHICLE_DIALOG+8:{ShowPlayerVehicleSpawnDialog(playerid);}
- case VEHICLE_DIALOG+9:{ShowPlayerVehicleSpawnDialog(playerid);}
- case VEHICLE_DIALOG+10:{ShowPlayerVehicleSpawnDialog(playerid);}
- case VEHICLE_DIALOG+11:{ShowPlayerVehicleSpawnDialog(playerid);}
- case VEHICLE_DIALOG+12:{ShowPlayerVehicleSpawnDialog(playerid);}
- case VEHICLE_DIALOG+13:{ShowPlayerVehicleSpawnDialog(playerid);}
- case VEHICLE_DIALOG+14:{ShowPlayerVehicleSpawnDialog(playerid);}
- case VEHICLE_DIALOG+15:{ShowPlayerVehicleSpawnDialog(playerid);}
- }
- }
- return 0;
- }
- public OnRconLoginAttempt(ip[], password[], success)
- {
- if(!success)
- {
- for(new i = 0; i < MAX_PLAYERS; i++)
- {
- if(!IsPlayerConnected(i) || IsPlayerNPC(i)) continue;
- new IP[16];
- GetPlayerIp(i, IP, sizeof(IP));
- if(!strcmp(ip, IP, true))
- {
- PlayerInfo[i][RconAttempt]++;
- if(PlayerInfo[i][RconAttempt] == MAX_BAD_RCON_ATTEMPS)
- {
- new string[128];
- format(string, sizeof(string), ""red">>%s has been kicked! [Reason: Bad rcon attempts]", GetName(i));
- AdminMSG(RED, string);
- PlayerInfo[i][KickCount]++;
- #if PRINT_BYKICK == true
- printf("[KICK]: %s has been kicked", GetName(i));
- #endif
- Kick(i);
- }
- break;
- }
- }
- }
- return 1;
- }
- #if ENABLE_SPECATE == true
- public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
- {
- new x = 0;
- while(x!=MAX_PLAYERS)
- {
- if(IsPlayerConnected(x) && GetPlayerState(x) == PLAYER_STATE_SPECTATING &&
- PlayerInfo[x][SpecID] == playerid && PlayerInfo[x][SpecType] == ADMIN_SPEC_TYPE_PLAYER)
- {
- SetPlayerInterior(x,newinteriorid);
- }
- x++;
- }
- }
- #endif
- #if USE_MYSQL == true
- public OnQueryFinish(query[], resultid, extraid, connectionHandle)
- {
- //printf("OnQueryFinish('%s',%d,%d,%d)",query,resultid,extraid,connectionHandle);
- switch(resultid)
- {
- case _THREAD_GET_AKA :
- {
- mysql_store_result();
- new tempstring[1024], count = 0, finstring[1536];
- while(mysql_retrieve_row())
- {
- new result[MAX_PLAYER_NAME], temp[MAX_PLAYER_NAME+50];
- mysql_fetch_field_row(result, "PlayerName");
- format(temp, sizeof(temp), ""white"\n%d. - %s", count, result);
- strcat(tempstring, temp);
- count++;
- }
- if(count == 1)
- {
- SendClientMessage(extraid, GREEN, "This user has no more account with the same ip");
- }
- else
- {
- format(finstring, sizeof(finstring), ""white"Player has "red"%d "white"account(s) with the same IP,\nHe´s using following names:\n", count);
- strcat(finstring, tempstring);
- ShowPlayerDialog(extraid, AKA_DIALOG, DIALOG_STYLE_MSGBOX, "Aka list", finstring, "OK", "");
- }
- mysql_free_result();
- }
- case _THREAD_ACCOUNT_EXIST :
- {
- mysql_store_result();
- if(mysql_num_rows(gSQL) == 0)
- {
- ShowPlayerRegisterDialog(extraid);
- }
- else
- {
- IsPlayerMySQLBanned(extraid);
- }
- mysql_free_result();
- }
- case _THREAD_CREATE_PLAYER :
- {
- SendClientMessage(extraid, LIGHT_GREEN, "Your account has been created! Welcome!");
- PlayerInfo[extraid][Logged] = true;
- }
- case _THREAD_LOAD_PLAYER :
- {
- mysql_store_result();
- if(mysql_num_rows(gSQL) > 0)
- {
- new resultline[512], score, money, wanted;
- mysql_fetch_row_format(resultline);
- if(sscanf(resultline, "p<|>fffdddddddffddddddds[16]",
- PlayerInfo[extraid][XPos],
- PlayerInfo[extraid][YPos],
- PlayerInfo[extraid][ZPos],
- PlayerInfo[extraid][AdminLevel],
- PlayerInfo[extraid][VIPLevel],
- wanted,
- PlayerInfo[extraid][Kills],
- PlayerInfo[extraid][Deaths],
- money,
- score,
- PlayerInfo[extraid][Health],
- PlayerInfo[extraid][Armour],
- PlayerInfo[extraid][Hours],
- PlayerInfo[extraid][Minutes],
- PlayerInfo[extraid][Seconds],
- PlayerInfo[extraid][KickCount],
- PlayerInfo[extraid][LastSkin],
- PlayerInfo[extraid][SpawnCount],
- PlayerInfo[extraid][ReportCount],
- PlayerInfo[extraid][RegDate]))
- {
- SendClientMessage(extraid, LIGHT_GREEN, "There was a problem while loading your account");
- KickEx(extraid);
- mysql_free_result();
- return 1;
- }
- SetPlayerWantedLevel(extraid, wanted);
- GivePlayerMoney(extraid, money);
- SetPlayerScore(extraid, score);
- PlayerInfo[extraid][Logged] = true;
- if(PlayerInfo[extraid][AdminLevel] > 0)
- {
- new string[128];
- format(string,sizeof(string),"Successfully logged in. (Adminlevel %d)", PlayerInfo[extraid][AdminLevel]);
- SendClientMessage(extraid,GREEN,string);
- } else SendClientMessage(extraid,GREEN,"Successfully logged in!");
- }
- mysql_free_result();
- }
- case _THREAD_IS_BANNED :
- {
- mysql_store_result();
- if(mysql_num_rows(gSQL) > 0)
- {
- LoadMySQLBanStat(extraid);
- }
- else
- {
- #if USE_AUTO_LOGIN == true
- new IP[16];
- GetPlayerIp(extraid, IP, sizeof(IP));
- MySQLCheckAutoLogin(extraid, IP);
- #else
- ShowPlayerLoginDialog(extraid);
- #endif
- }
- mysql_free_result();
- }
- case _FETCH_BAN_STAT :
- {
- mysql_store_result();
- new string2[512], resultline[512], adminname[MAX_PLAYER_NAME], reason[128], Date[16];
- mysql_fetch_row_format(resultline);
- sscanf(resultline, "p<|>s[24]s[128]s[16]", adminname, reason, Date);
- mysql_free_result();
- format(string2,sizeof(string2),""red"You have been banned\n\n"white"Banned by:\t%s\nYour name:\t%s\nReason:\t%s\nDate:\t\t%s", adminname, GetName(extraid), reason, Date);
- ShowPlayerDialog(extraid, BAN_DIALOG, DIALOG_STYLE_MSGBOX, " ", string2, "OK", "");
- PlayerInfo[extraid][KickCount]++;
- #if PRINT_BYKICK == true
- printf("[KICK]: %s has been kicked", GetName(extraid));
- #endif
- KickEx(extraid);
- }
- case _CHECK_PASSWORD :
- {
- mysql_store_result();
- if(mysql_num_rows(gSQL) > 0)
- {
- LoadPlayer(extraid);
- LogPlayerIn(extraid);
- }
- else
- {
- SendClientMessage(extraid,RED,"Login failed! Incorrect password");
- PlayerInfo[extraid][FailLogin]++;
- printf("LOGIN: %s has failed to login, Wrong password Attempt (%d)", GetName(extraid), PlayerInfo[extraid][FailLogin]);
- if(PlayerInfo[extraid][FailLogin] == MAX_FAIL_LOGINS)
- {
- printf("%s has been kicked (Failed Logins)",GetName(extraid));
- #if PRINT_BYKICK == true
- printf("[KICK]: %s has been kicked", GetName(extraid));
- #endif
- Kick(extraid);
- }
- ShowPlayerLoginDialog(extraid);
- }
- mysql_free_result();
- }
- case _CHECK_AUTO_LOGIN :
- {
- mysql_store_result();
- if(mysql_num_rows(gSQL) > 0)
- {
- SendClientMessage(extraid,RED,"SERVER: You will get autologged in now");
- LoadPlayer(extraid);
- LogPlayerIn(extraid);
- }
- else
- {
- ShowPlayerLoginDialog(extraid);
- }
- mysql_free_result();
- }
- }
- return 1;
- }
- public OnQueryError(errorid, error[], callback[], query[], connectionHandle)
- {
- printf("%d, %s, %s, %s, %d", errorid, error, callback, query, connectionHandle);
- return 1;
- }
- #endif
- public OnPlayerText(playerid, text[])
- {
- if(PlayerInfo[playerid][Logged] != true)
- {
- SendClientMessage(playerid, GREY, "You need to login to use the chat");
- return 0;
- }
- if(ServerInfo[EnableChat] == false)
- {
- SendClientMessage(playerid, GREY, "The chat has been disabled");
- return 0;
- }
- #if USE_VIP_SYSTEM == true
- if(text[0] == '!' && PlayerInfo[playerid][VIPLevel] >= 1)
- {
- new string[128];
- GetPlayerName(playerid,string,sizeof(string));
- format(string,sizeof(string),"VIP Chat %s: %s",string,text[1]);
- VIPMSG(ORANGE,string);
- return 0;
- }
- #endif
- #if ENABLE_ADMIN_CHAT == true
- if(text[0] == '#' && PlayerInfo[playerid][AdminLevel] >= 1)
- {
- new string[128];
- GetPlayerName(playerid,string,sizeof(string));
- format(string,sizeof(string),"Admin Chat %s: %s",string,text[1]);
- AdminMSG(GREEN,string);
- return 0;
- }
- #endif
- #if USE_ANTI_ADS == true
- new
- is1 = 0,
- r = 0,
- strR[255];
- while(strlen(text[is1]))
- {
- if('0' <= text[is1] <= '9')
- {
- new is2 = is1 + 1, p=0;
- while(p == 0)
- {
- if('0' <= text[is2] <= '9' && strlen(text[is2]))
- {
- is2++;
- }
- else
- {
- strmid(strR[r], text, is1, is2, sizeof(strR));
- if(strval(strR[r]) < sizeof(strR)) r++;
- is1 = is2;
- p = 1;
- }
- }
- }
- is1++;
- }
- if(r >= 4)
- {
- SendClientMessage(playerid, RED, "Advertising is not allowed");
- return 0;
- }
- #endif
- if(ServerInfo[NoCaps] == true)
- {
- UpperToLower(text);
- }
- if(PlayerInfo[playerid][Muted] == true)
- {
- SendClientMessage(playerid, RED,"You hvae been muted! Please wait until the time is over!");
- return 0;
- }
- else
- {
- #if USE_CHAT_BUBBELS == true
- new cbMSG[150];
- format(cbMSG,sizeof(cbMSG),"%s", text);
- SetPlayerChatBubble(playerid, cbMSG, WHITE, 65.0, 8000);
- #endif
- #if USE_ID_MESSAGES == true
- new idMSG[150];
- format(idMSG,sizeof(idMSG),"%s (%d): {FFFFFF}%s", GetName(playerid), playerid, text);
- SendClientMessageToAll(GetPlayerColor(playerid), idMSG);
- #endif
- }
- return 0;
- }
- public OnPlayerSpawn(playerid)
- {
- #if LOAD_PLAYER_POS == true
- if(GetPVarInt(playerid, "1stSpawn") == 1)
- {
- SetPlayerPos(playerid, PlayerInfo[playerid][XPos], PlayerInfo[playerid][YPos], PlayerInfo[playerid][ZPos]);
- SetPlayerSkin(playerid, PlayerInfo[playerid][LastSkin]);
- #if LOAD_PLAYER_HA == true
- SetPlayerHealth(playerid, PlayerInfo[playerid][Health]);
- SetPlayerArmour(playerid, PlayerInfo[playerid][Armour]);
- #endif
- SetPVarInt(playerid, "1stSpawn", 0);
- }
- #endif
- PlayerInfo[playerid][SpawnCount]++;
- SetPlayerSkin(playerid, PlayerInfo[playerid][LastSkin]);
- return 1;
- }
- public OnPlayerDeath(playerid, killerid, reason)
- {
- PlayerInfo[playerid][Deaths]++;
- if(IsPlayerConnected(killerid) && killerid != INVALID_PLAYER_ID && killerid != playerid)
- {
- PlayerInfo[killerid][Kills]++;
- }
- #if ENABLE_SPECATE == true
- for(new x=0; x<MAX_PLAYERS; x++)
- if(GetPlayerState(x) == PLAYER_STATE_SPECTATING && PlayerInfo[x][SpecID] == playerid)
- AdvanceSpectate(x);
- #endif
- return 1;
- }
- #if ENABLE_SPECATE == true
- public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
- {
- if(GetPlayerState(playerid) == PLAYER_STATE_SPECTATING && PlayerInfo[playerid][SpecID] != INVALID_PLAYER_ID)
- {
- if(newkeys == KEY_JUMP) AdvanceSpectate(playerid);
- else if(newkeys == KEY_SPRINT) ReverseSpectate(playerid);
- }
- return 1;
- }
- public OnPlayerEnterVehicle(playerid, vehicleid)
- {
- for(new x=0; x<MAX_PLAYERS; x++)
- {
- if(GetPlayerState(x) == PLAYER_STATE_SPECTATING && PlayerInfo[x][SpecID] == playerid)
- {
- TogglePlayerSpectating(x, 1);
- PlayerSpectateVehicle(x, vehicleid);
- PlayerInfo[x][SpecType] = ADMIN_SPEC_TYPE_VEHICLE;
- }
- }
- return 1;
- }
- public OnPlayerExitVehicle(playerid, vehicleid)
- {
- for(new x=0; x<MAX_PLAYERS; x++)
- {
- if(GetPlayerState(x) == PLAYER_STATE_SPECTATING && PlayerInfo[x][SpecID] == playerid && PlayerInfo[x][SpecType] == ADMIN_SPEC_TYPE_VEHICLE)
- {
- TogglePlayerSpectating(x, 1);
- PlayerSpectatePlayer(x, playerid);
- PlayerInfo[x][SpecType] = ADMIN_SPEC_TYPE_PLAYER;
- }
- }
- return 1;
- }
- #endif
- //==============================================================================
- //------------------------------------------------------------------------------
- // ZCMD COMMANDS
- //------------------------------------------------------------------------------
- //==============================================================================
- #if USE_VIP_SYSTEM == true
- COMMAND:vsay(playerid,params[])
- {
- if(PlayerInfo[playerid][VIPLevel] >= VIP_vsay)
- {
- new text[128];
- if(sscanf(params, "s[128]", text))
- {
- SendClientMessage(playerid,RED,"Usage: /vsay <message>");
- return 1;
- }
- new string[128];
- format(string, sizeof(string), "* VIP %s: %s", GetName(playerid), text);
- SendClientMessageToAll(PURPLE,string);
- }
- else
- {
- SendClientMessage(playerid, RED, NO_PERM);
- }
- return 1;
- }
- COMMAND:mycolor(playerid,params[])
- {
- if(PlayerInfo[playerid][VIPLevel] >= VIP_mycolor)
- {
- new color;
- if(sscanf(params, "d", color))
- {
- SendClientMessage(playerid,RED,"Usage: /mycolor < 0 = White / 1 = Red / 2 = Orange / 3 = Blue / 4 = Green / 5 = Purple>");
- return 1;
- }
- if(color > 5 || color < 0) return SendClientMessage(playerid,RED,"Usage: /mycolor < 0 = White / 1 = Red / 2 = Orange / 3 = Blue / 4 = Green / 5 = Purple>");
- switch(color)
- {
- case 0 : SetPlayerColor(playerid, WHITE);
- case 1 : SetPlayerColor(playerid, RED);
- case 2 : SetPlayerColor(playerid, ORANGE);
- case 3 : SetPlayerColor(playerid, BLUE);
- case 4 : SetPlayerColor(playerid, LIGHT_GREEN);
- case 5 : SetPlayerColor(playerid, PURPLE);
- }
- }
- else
- {
- SendClientMessage(playerid, RED, NO_PERM);
- }
- return 1;
- }
- COMMAND:myweather(playerid,params[])
- {
- if(PlayerInfo[playerid][VIPLevel] >= VIP_myweather)
- {
- new weather;
- if(sscanf(params, "d", weather))
- {
- SendClientMessage(playerid,RED,"Usage: /myweather <weather id>");
- return 1;
- }
- SetPlayerWeather(playerid, weather);
- }
- else
- {
- SendClientMessage(playerid, RED, NO_PERM);
- }
- return 1;
- }
- COMMAND:vtoys(playerid,params[])
- {
- if(PlayerInfo[playerid][VIPLevel] >= VIP_vtoys)
- {
- ShowPlayerDialog(playerid, VTOYS_DIALOG, DIALOG_STYLE_LIST, "V.I.P Toys!", "Dick\nIron\nAlien\nIncred\nJetPack\nRemove toys", "Select", "Cancel");
- }
- else
- {
- SendClientMessage(playerid, RED, NO_PERM);
- }
- return 1;
- }
- #endif
- COMMAND:togping(playerid,params[])
- {
- if(PlayerInfo[playerid][AdminLevel] >= LEVEL_togping)
- {
- if(ServerInfo[PingSystem] == true)
- {
- for(new i=0; i <= MAX_PLAYERS; i++)
- {
- #if IS_ADMIN_IMMUNE == true
- if(IsPlayerAdmin(i) || PlayerInfo[i][AdminLevel] >= 1) continue;
- #endif
- if(!IsPlayerConnected(i) || IsPlayerNPC(i) || PlayerInfo[i][PingTimer] == -1) continue;
- KillTimer(PlayerInfo[i][PingTimer]);
- PlayerInfo[i][PingTimer] = -1;
- }
- ServerInfo[PingSystem] = false;
- SendClientMessage(playerid, RED, "Anti High Ping System has been disabled");
- }
- else if(ServerInfo[PingSystem] == false)
- {
- for(new i=0; i <= MAX_PLAYERS; i++)
- {
- #if IS_ADMIN_IMMUNE == true
- if(IsPlayerAdmin(i) || PlayerInfo[i][AdminLevel] >= 1) continue;
- #endif
- if(!IsPlayerConnected(i) || IsPlayerNPC(i)) continue;
- PlayerInfo[i][PingTimer] = SetTimerEx("CheckPlayerPing", PINGCHECK_TIME*1000, true, "d", i);
- }
- ServerInfo[PingSystem] = true;
- SendClientMessage(playerid, GREEN, "Anti High Ping System has been enabled");
- }
- }
- return 1;
- }
- #if USE_PM_SYSTEM == true
- COMMAND:pm(playerid,params[])
- {
- new player, msg[128], finmsg[192];
- if(sscanf(params,"rs[128]", player, msg))
- {
- SendClientMessage(playerid,RED,"Usage: /pm <playerid/part of nick> <message>");
- return 1;
- }
- if(!IsPlayerConnected(player))
- {
- SendClientMessage(playerid,RED,"Player is not connected.");
- return 1;
- }
- if(player == playerid)
- {
- SendClientMessage(playerid, RED, "You can´t pm yourself");
- return 1;
- }
- format(finmsg,sizeof(finmsg),"***[PM] from %s(%d): %s", GetName(playerid), playerid, msg);
- SendClientMessage(player, YELLOW, finmsg);
- format(finmsg,sizeof(finmsg),">>>[PM] to %s(%d): %s", GetName(player), player, msg);
- SendClientMessage(playerid, YELLOW, finmsg);
- return 1;
- }
- #endif
- #if ENABLE_SPECATE == true
- COMMAND:spec(playerid,params[])
- {
- if(PlayerInfo[playerid][AdminLevel] >= LEVEL_spec || IsPlayerAdmin(playerid))
- {
- new player;
- if(sscanf(params, "r", player))
- {
- SendClientMessage(playerid,RED,"Usage: /spec <playerid/part of nick>");
- return 1;
- }
- if(PlayerInfo[player][AdminLevel] == MAX_ADMIN_LEVEL)
- {
- SendClientMessage(playerid,RED,"ERROR: You cannot use this command on this admin");
- return 1;
- }
- if(IsPlayerConnected(player) && player != INVALID_PLAYER_ID && player != playerid)
- {
- if(GetPlayerState(player) == PLAYER_STATE_SPECTATING && PlayerInfo[player][SpecID] != INVALID_PLAYER_ID)
- {
- SendClientMessage(playerid, RED, "Spectate: Player spectating someone else");
- return 1;
- }
- if(GetPlayerState(player) != 1 && GetPlayerState(player) != 2 && GetPlayerState(player) != 3)
- {
- SendClientMessage(playerid, RED, "Spectate: Player not spawned");
- return 1;
- }
- if((PlayerInfo[player][AdminLevel] != MAX_ADMIN_LEVEL && PlayerInfo[playerid][AdminLevel] != MAX_ADMIN_LEVEL))
- {
- StartSpectate(playerid, player);
- GetPlayerPos(playerid,Pos[playerid][0],Pos[playerid][1],Pos[playerid][2]);
- GetPlayerFacingAngle(playerid,Pos[playerid][3]);
- SendClientMessage(playerid,BLUE,"Now Spectating");
- }
- else
- {
- SendClientMessage(playerid,RED,"ERROR: You cannot spectate the highest level admin");
- }
- }
- else
- {
- SendClientMessage(playerid,RED,"ERROR: Player is not connected");
- }
- }
- else
- {
- SendClientMessage(playerid, RED, NO_PERM);
- }
- return 1;
- }
- COMMAND:adminhelp(playerid,params[])
- {
- #pragma unused params
- if(PlayerInfo[playerid][AdminLevel] >= LEVEL_adminhelp)
- {
- ShowPlayerDialog(playerid,ADMINHELP_DIALOG,DIALOG_STYLE_MSGBOX, "Admin-Commands", ""white"/spec /specoff /warn /slap /asay /mute /unmute /onduty /offduty \n\n/burn /goto /eject /kick /ban /clearchat /get /cashfall /scorefall \n\n/healall /armourall /setallweather /setalltime /setcash /setmoney /announce\n\n/jail /unjail /jailed /wanteds /frozen /akill /showguns /miniguns\n\n/muted /killall /kickall /setallwanted /disarmall /ejectall /giveallweapon /spawnveh","OK","");
- }
- else
- {
- SendClientMessage(playerid, RED, NO_PERM);
- }
- return 1;
- }
- COMMAND:setscore(playerid,params[])
- {
- if(PlayerInfo[playerid][AdminLevel] >= LEVEL_setscore)
- {
- new player, amount;
- if(sscanf(params, "rd", player, amount))
- {
- SendClientMessage(playerid,RED,"Usage: /setscore <playerid/part of nick> <score>");
- return 1;
- }
- if(IsPlayerConnected(player) && player != INVALID_PLAYER_ID)
- {
- new string[128];
- if(player != playerid)
- {
- format(string,sizeof(string),"Administrator \"%s\" has set your score to %d.", GetName(playerid), amount);
- SendClientMessage(player,YELLOW,string);
- format(string,sizeof(string),"You set \"%s\'s\" score to %d.",GetName(player));
- SendClientMessage(playerid,YELLOW,string);
- }
- else
- {
- format(string,sizeof(string),"You have set your score to %d.",amount);
- SendClientMessage(playerid,YELLOW,string);
- }
- SetPlayerScore(player, amount);
- }
- else
- {
- SendClientMessage(playerid,RED,"ERROR: Player is not connected");
- }
- }
- else
- {
- SendClientMessage(playerid, RED, NO_PERM);
- }
- return 1;
- }
- COMMAND:setwanted(playerid,params[])
- {
- if(PlayerInfo[playerid][AdminLevel] >= LEVEL_setwanted)
- {
- new player, wanted, string[128];
- if(sscanf(params, "rd", player, wanted))
- {
- SendClientMessage(playerid,RED,"Usage: /setscore <playerid/part of nick> <wanted>");
- return 1;
- }
- if(wanted > 6) return SendClientMessage(playerid, RED, "Wanted level 1-6");
- SetPlayerWantedLevel(player, wanted);
- format(string,sizeof(string),"Administrator \"%s\" has set your WantedLevel to %d.", GetName(playerid), wanted);
- SendClientMessage(player, YELLOW, string);
- format(string,sizeof(string),"You have set \"%s's\" WantedLevel to %d.", GetName(player), wanted);
- SendClientMessage(playerid, YELLOW, string);
- }
- else
- {
- SendClientMessage(playerid, RED, NO_PERM);
- }
- return 1;
- }
- COMMAND:setmoney(playerid, params[])
- {
- if(PlayerInfo[playerid][AdminLevel] >= LEVEL_setmoney)
- {
- new player, amount;
- if(sscanf(params, "rd", player, amount))
- {
- SendClientMessage(playerid,RED,"Usage: /setmoney <playerid/part of nick> <amount>");
- return 1;
- }
- if(IsPlayerConnected(player) && player != INVALID_PLAYER_ID)
- {
- new string[128];
- if(player != playerid)
- {
- format(string,sizeof(string),"Administrator \"%s\" has set your cash to $%d.", GetName(playerid), amount);
- SendClientMessage(player, YELLOW, string);
- format(string,sizeof(string),"You have set \"%s's\" cash to $%d.", GetName(player), amount);
- SendClientMessage(playerid, YELLOW, string);
- }
- else
- {
- format(string,sizeof(string),"You have set your cash to $%d.", amount);
- SendClientMessage(playerid, YELLOW, string);
- }
- ResetPlayerMoney(player);
- GivePlayerMoney(player, amount);
- }
- else
- {
- SendClientMessage(playerid,RED,"ERROR: Player is not connected");
- }
- }
- else
- {
- SendClientMessage(playerid, RED, NO_PERM);
- }
- return 1;
- }
- COMMAND:eject(playerid,params[])
- {
- if(PlayerInfo[playerid][AdminLevel] >= LEVEL_eject)
- {
- new player;
- if(sscanf(params, "r", player))
- {
- SendClientMessage(playerid,RED,"Usage: /eject <playerid/part of nick>");
- return 1;
- }
- if(PlayerInfo[player][AdminLevel] == MAX_ADMIN_LEVEL && PlayerInfo[playerid][AdminLevel] != MAX_ADMIN_LEVEL)
- {
- SendClientMessage(playerid,RED,"ERROR: You cannot use this command on this admin");
- return 1;
- }
- if(IsPlayerConnected(player) && player != INVALID_PLAYER_ID)
- {
- if(IsPlayerInAnyVehicle(player))
- {
- new string[128], Float:x, Float:y, Float:z;
- if(player != playerid)
- {
- format(string,sizeof(string),"Administrator \"%s\" has ejected you from your vehicle", GetName(playerid));
- SendClientMessage(player,BLUE,string);
- }
- format(string,sizeof(string),"You have ejected \"%s\" from their vehicle", GetName(player));
- SendClientMessage(playerid,BLUE,string);
- GetPlayerPos(player,x,y,z);
- SetPlayerPos(player,x,y,z+3);
- }
- else
- {
- SendClientMessage(playerid,RED,"ERROR: Player is not in a vehicle");
- }
- }
- else
- {
- SendClientMessage(playerid,RED,"ERROR: Player is not connected or unavailable");
- }
- }
- else
- {
- SendClientMessage(playerid, RED, NO_PERM);
- }
- return 1;
- }
- COMMAND:burn(playerid,params[])
- {
- if(PlayerInfo[playerid][AdminLevel] >= LEVEL_burn)
- {
- new player;
- if(sscanf(params, "r", player))
- {
- SendClientMessage(playerid,RED,"Usage: /burn <playerid/part of nick>");
- return 1;
- }
- if(PlayerInfo[player][AdminLevel] == MAX_ADMIN_LEVEL && PlayerInfo[playerid][AdminLevel] != MAX_ADMIN_LEVEL)
- {
- SendClientMessage(playerid,RED,"ERROR: You cannot use this command on this admin");
- return 1;
- }
- if(IsPlayerConnected(player) && player != INVALID_PLAYER_ID)
- {
- new string[128], Float:x, Float:y, Float:z;
- format(string, sizeof(string), "You have burnt \"%s\" ", GetName(player));
- SendClientMessage(playerid,BLUE,string);
- if(player != playerid)
- {
- format(string,sizeof(string),"Administrator \"%s\" has burnt you", GetName(playerid));
- SendClientMessage(player,BLUE,string);
- }
- GetPlayerPos(player, x, y, z);
- CreateExplosion(x, y , z + 3, 1, 10);
- }
- else
- {
- SendClientMessage(playerid,RED,"ERROR: Player is not connected");
- }
- }
- else
- {
- SendClientMessage(playerid, RED, NO_PERM);
- }
- return 1;
- }
- COMMAND:crash(playerid,params[])
- {
- if(PlayerInfo[playerid][AdminLevel] >= LEVEL_crash)
- {
- new player;
- if(sscanf(params, "r", player))
- {
- SendClientMessage(playerid,RED,"Usage: /crash <playerid/part of nick>");
- return 1;
- }
- if(PlayerInfo[player][AdminLevel] == MAX_ADMIN_LEVEL && PlayerInfo[playerid][AdminLevel] != MAX_ADMIN_LEVEL)
- {
- SendClientMessage(playerid,RED,"ERROR: You cannot use this command on this admin");
- return 1;
- }
- if(IsPlayerConnected(player) && player != INVALID_PLAYER_ID)
- {
- new string[128], Float:X, Float:Y, Float:Z;
- GetPlayerPos(player,X,Y,Z);
- new objectcrash = CreatePlayerObject(player,111111121,X,Y,Z,0,0,0);
- SetPlayerVirtualWorld(player, 1337);
- new crashveh = CreateVehicle(520, X, Y, Z, 0, 0, 0, -1);
- SetVehicleVirtualWorld(crashveh, 1337);
- PutPlayerInVehicle(player, crashveh, 0);
- AddVehicleComponent(crashveh, 13372);
- DestroyVehicle(crashveh);
- DestroyObject(objectcrash);
- format(string, sizeof(string), "You have crashed \"%s's\" game", GetName(player));
- SendClientMessage(playerid, BLUE, string);
- }
- else
- {
- SendClientMessage(playerid,RED,"ERROR: Player is not connected");
- }
- }
- else
- {
- SendClientMessage(playerid, RED, NO_PERM);
- }
- return 1;
- }
- COMMAND:ip(playerid,params[])
- {
- if(PlayerInfo[playerid][AdminLevel] >= LEVEL_ip)
- {
- new player;
- if(sscanf(params, "r", player))
- {
- SendClientMessage(playerid,RED,"Usage: /ip <playerid/part of nick>");
- return 1;
- }
- if(PlayerInfo[player][AdminLevel] == MAX_ADMIN_LEVEL && PlayerInfo[playerid][AdminLevel] != MAX_ADMIN_LEVEL)
- {
- SendClientMessage(playerid,RED,"ERROR: You cannot use this command on this admin");
- return 1;
- }
- if(IsPlayerConnected(player) && player != INVALID_PLAYER_ID)
- {
- new IP[16], string[64];
- GetPlayerIp(player,IP,sizeof(IP));
- format(string,sizeof(string),"\"%s's\" ip is '%s'", GetName(player), IP);
- SendClientMessage(playerid,BLUE,string);
- }
- else
- {
- SendClientMessage(playerid,RED,"ERROR: Player is not connected");
- }
- }
- else
- {
- SendClientMessage(playerid, RED, NO_PERM);
- }
- return 1;
- }
- COMMAND:time(playerid,params[])
- {
- #pragma unused params
- new string[64], hour,minuite,second; gettime(hour,minuite,second);
- format(string, sizeof(string), "~g~|~w~%d:%d~g~|", hour, minuite);
- GameTextForPlayer(playerid, string, 5000, 1);
- return 1;
- }
- COMMAND:mytime(playerid,params[])
- {
- if(PlayerInfo[playerid][AdminLevel] >= LEVEL_mytime)
- {
- new time;
- if(sscanf(params, "d", time))
- {
- SendClientMessage(playerid,RED,"Usage: /mytime <hour>");
- return 1;
- }
- new string[128];
- format(string,sizeof(string),"You have set your time to %d:00", time);
- SendClientMessage(playerid,BLUE,string);
- SetPlayerTime(playerid, time, 0);
- }
- else
- {
- SendClientMessage(playerid, RED, NO_PERM);
- }
- return 1;
- }
- COMMAND:asay(playerid,params[])
- {
- #pragma unused params
- if(PlayerInfo[playerid][AdminLevel] >= LEVEL_asay)
- {
- new text[128];
- if(sscanf(params, "s[128]", text))
- {
- SendClientMessage(playerid,RED,"Usage: /asay <message>");
- return 1;
- }
- new string[128];
- format(string, sizeof(string), "* Admin %s: %s", GetName(playerid), text);
- SendClientMessageToAll(RED,string);
- }
- else
- {
- SendClientMessage(playerid, RED, NO_PERM);
- }
- return 1;
- }
- COMMAND:announce(playerid,params[])
- {
- if(PlayerInfo[playerid][AdminLevel] >= LEVEL_announce || IsPlayerAdmin(playerid))
- {
- new text[128];
- if(sscanf(params, "s[128]", text))
- {
- SendClientMessage(playerid,RED,"Usage: /announce <message>");
- return 1;
- }
- GameTextForAll(text, 4000, 3);
- }
- else
- {
- SendClientMessage(playerid, RED, NO_PERM);
- }
- return 1;
- }
- COMMAND:goto(playerid,params[])
- {
- if(PlayerInfo[playerid][AdminLevel] >= LEVEL_goto || IsPlayerAdmin(playerid))
- {
- new player;
- if(sscanf(params, "r", player))
- {
- SendClientMessage(playerid,RED,"Usage: /goto <playerid/part of nick>");
- return 1;
- }
- if(IsPlayerConnected(player) && player != INVALID_PLAYER_ID && player != playerid)
- {
- new Float:x, Float:y, Float:z; GetPlayerPos(player,x,y,z);
- SetPlayerInterior(playerid,GetPlayerInterior(player));
- SetPlayerVirtualWorld(playerid,GetPlayerVirtualWorld(player));
- if(GetPlayerState(playerid) == 2)
- {
- SetVehiclePos(GetPlayerVehicleID(playerid),x+3,y,z);
- LinkVehicleToInterior(GetPlayerVehicleID(playerid),GetPlayerInterior(player));
- SetVehicleVirtualWorld(GetPlayerVehicleID(playerid),GetPlayerVirtualWorld(player));
- }
- else SetPlayerPos(playerid,x+2,y,z);
- new string[128];
- format(string,sizeof(string),"You have Teleported to \"%s\"", GetName(player));
- return SendClientMessage(playerid,RED,string);
- }
- else
- {
- SendClientMessage(playerid,RED,"ERROR: Player is not connected");
- }
- }
- else
- {
- SendClientMessage(playerid, RED, NO_PERM);
- }
- return 1;
- }
- COMMAND:get(playerid,params[])
- {
- if(PlayerInfo[playerid][AdminLevel] >= LEVEL_get || IsPlayerAdmin(playerid))
- {
- new player;
- if(sscanf(params, "r", player))
- {
- SendClientMessage(playerid,RED,"Usage: /get <playerid/part of nick>");
- return 1;
- }
- new string[128];
- if(PlayerInfo[player][AdminLevel] == MAX_ADMIN_LEVEL && PlayerInfo[playerid][AdminLevel] != MAX_ADMIN_LEVEL)
- {
- SendClientMessage(playerid,RED,"ERROR: You cannot use this command on this admin");
- return 1;
- }
- if(IsPlayerConnected(player) && player != INVALID_PLAYER_ID && player != playerid)
- {
- new Float:x, Float:y, Float:z;
- GetPlayerPos(playerid,x,y,z);
- SetPlayerInterior(player,GetPlayerInterior(playerid));
- SetPlayerVirtualWorld(player,GetPlayerVirtualWorld(playerid));
- if(GetPlayerState(player) == 2)
- {
- new VehicleID = GetPlayerVehicleID(player);
- SetVehiclePos(VehicleID,x+3,y,z);
- LinkVehicleToInterior(VehicleID,GetPlayerInterior(playerid));
- SetVehicleVirtualWorld(GetPlayerVehicleID(player),GetPlayerVirtualWorld(playerid));
- }
- else
- {
- SetPlayerPos(player,x+2,y,z);
- }
- format(string,sizeof(string),"You have been teleported to Administrator \"%s's\" location", GetName(playerid));
- SendClientMessage(player,BLUE,string);
- format(string,sizeof(string),"You have teleported \"%s\" to your location", GetName(player));
- SendClientMessage(playerid,BLUE,string);
- return 1;
- }
- else
- {
- SendClientMessage(playerid, RED, "Player is not connected or is yourself");
- }
- }
- else
- {
- SendClientMessage(playerid, RED, NO_PERM);
- }
- return 1;
- }
- COMMAND:kick(playerid,params[])
- {
- if(PlayerInfo[playerid][AdminLevel] >= LEVEL_kick)
- {
- new player, reason[128];
- if(sscanf(params, "rs[128]", player, reason))
- {
- SendClientMessage(playerid,RED,"Usage: /kick <playerid/part of nick> <reason>");
- return 1;
- }
- if(IsPlayerConnected(player) && player != INVALID_PLAYER_ID && player != playerid && PlayerInfo[player][AdminLevel] != MAX_ADMIN_LEVEL)
- {
- new string[128];
- format(string,sizeof(string),"**%s has been kicked by Admin %s [reason: %s]",GetName(player),GetName(playerid),reason);
- SendClientMessageToAll(YELLOW,string);
- print(string);
- PlayerInfo[player][KickCount]++;
- #if PRINT_BYKICK == true
- printf("[KICK]: %s has been kicked", GetName(playerid));
- #endif
- Kick(player);
- }
- else
- {
- SendClientMessage(playerid, RED, "Player is not connected or is yourself or is the highest level admin");
- }
- }
- else
- {
- SendClientMessage(playerid, RED, NO_PERM);
- }
- return 1;
- }
- COMMAND:mute(playerid,params[])
- {
- if(PlayerInfo[playerid][AdminLevel] >= LEVEL_mute)
- {
- new player, time, reason[128];
- if(sscanf(params, "rds[128]", player, time, reason))
- {
- SendClientMessage(playerid,RED,"Usage: /mute <playerid/part of nick> <seconds> <reason>");
- return 1;
- }
- if(PlayerInfo[player][Muted] == true)
- {
- SendClientMessage(playerid,RED,"This player is already muted");
- return 1;
- }
- if(IsPlayerConnected(player) && player != INVALID_PLAYER_ID && player != playerid && PlayerInfo[player][AdminLevel] != MAX_ADMIN_LEVEL)
- {
- new string[128];
- PlayerInfo[player][Muted] = true;
- format(string,sizeof(string),"**%s has been muted by Admin '%s' for %d seconds [Reason: %s]",GetName(player), GetName(playerid), time, reason);
- SendClientMessageToAll(YELLOW,string);
- PlayerInfo[player][MuteTimer] = SetTimerEx("unmute",time*1000, false, "d", player);
- }
- else
- {
- SendClientMessage(playerid, RED, "Player is not connected or is yourself or is the highest level admin");
- }
- }
- else
- {
- SendClientMessage(playerid, RED, NO_PERM);
- }
- return 1;
- }
- COMMAND:unmute(playerid,params[])
- {
- if(PlayerInfo[playerid][AdminLevel] >= LEVEL_unmute)
- {
- new player;
- if(sscanf(params, "r", player))
- {
- SendClientMessage(playerid,RED,"Usage: /unmute <playerid/part of nick>");
- return 1;
- }
- if(PlayerInfo[player][Muted] == false)
- {
- SendClientMessage(playerid,RED,"This player is not muted");
- return 1;
- }
- if(IsPlayerConnected(player) && player != INVALID_PLAYER_ID && player != playerid)
- {
- PlayerInfo[player][Muted] = false;
- KillTimer(PlayerInfo[player][MuteTimer]);
- SendClientMessage(player, GREEN, "You have been unmuted!");
- SendClientMessage(playerid, RED, "Player has been unmuted.");
- }
- else
- {
- SendClientMessage(playerid, RED, "Player isn´t connected or invalid!");
- }
- }
- else
- {
- SendClientMessage(playerid, RED, NO_PERM);
- }
- return 1;
- }
- COMMAND:ban(playerid,params[])
- {
- if((PlayerInfo[playerid][AdminLevel] >= LEVEL_ban) || (IsPlayerAdmin(playerid)))
- {
- new player, reason[128];
- if(sscanf(params, "rs[128]", player, reason))
- {
- SendClientMessage(playerid,RED,"Usage: /ban <playerid/part of nick> <reason>");
- return 1;
- }
- if(PlayerInfo[player][AdminLevel] != MAX_ADMIN_LEVEL)
- {
- if(IsPlayerConnected(player) && player != INVALID_PLAYER_ID && player != playerid && PlayerInfo[player][AdminLevel] != MAX_ADMIN_LEVEL && PlayerInfo[player][Logged] == true)
- {
- new year, month, day, string[128];
- getdate(year, month, day);
- format(string, sizeof(string), "**%s has been banned by Admin %s [Reason: %s]", GetName(player), GetName(playerid),reason);
- SendClientMessageToAll(YELLOW, string);
- print(string);
- CreateBan(player, GetName(playerid), reason);
- format(string, sizeof(string),""red"You have been banned!"white"\n\nAdmin:\t\t%s\nReason:\t%s\n",GetName(playerid),reason);
- ShowPlayerDialog(player, BAN_DIALOG, DIALOG_STYLE_MSGBOX, "Notice", string, "OK", "");
- Kick(player);
- return 1;
- }
- else
- {
- SendClientMessage(playerid, RED, "Player is not connected or is yourself or is the highest level admin");
- }
- }
- else
- {
- format(reason,sizeof(reason),"WARNING: %s just tried to ban you with reason: %s", GetName(playerid), reason);
- SendClientMessage(player, RED, reason);
- }
- }
- else
- {
- SendClientMessage(playerid, RED, NO_PERM);
- }
- return 1;
- }
- COMMAND:slap(playerid,params[])
- {
- if(PlayerInfo[playerid][AdminLevel] >= LEVEL_slap)
- {
- new player;
- if(sscanf(params, "r", player))
- {
- SendClientMessage(playerid,RED,"Usage: /slap <playerid/part of nick>");
- return 1;
- }
- if(IsPlayerConnected(player) && player != INVALID_PLAYER_ID && (PlayerInfo[player][AdminLevel] != MAX_ADMIN_LEVEL))
- {
- new Float:pHealth, Float:x, Float:y, Float:z, string[128];
- GetPlayerHealth(player,pHealth);
- SetPlayerHealth(player,pHealth-25);
- GetPlayerPos(player,x,y,z);
- SetPlayerPos(player,x,y,z+10);
- format(string,sizeof(string),"You have been slapped by Administrator %s",GetName(playerid));
- SendClientMessage(player,RED,string);
- format(string,sizeof(string),"You have slapped %s",GetName(player));
- SendClientMessage(playerid,BLUE,string);
- }
- else
- {
- SendClientMessage(playerid, RED, "Player is not connected or is the highest level admin");
- }
- }
- else
- {
- SendClientMessage(playerid, RED, NO_PERM);
- }
- return 1;
- }
- COMMAND:admins(playerid,params[])
- {
- #pragma unused params
- SendClientMessage(playerid, PURPLE, "--------------------------------------");
- new Count[2], i, string[128];
- for(i = 0; i < MAX_PLAYERS; i++) if(IsPlayerConnected(i))
- {
- if(PlayerInfo[i][AdminLevel] > 0) Count[0]++;
- if(IsPlayerAdmin(i)) Count[1]++;
- }
- if((Count[0] == 0 && Count[1] == 0) || (Count[0] == 0 && Count[1] >= 1 && PlayerInfo[playerid][AdminLevel] == 0))
- {
- SendClientMessage(playerid, PURPLE, "No Administrators online");
- SendClientMessage(playerid, PURPLE, "--------------------------------------");
- return 1;
- }
- if(Count[0] == 1)
- {
- for(i = 0; i < MAX_PLAYERS; i++) if(IsPlayerConnected(i) && PlayerInfo[i][AdminLevel] > 0)
- {
- format(string, sizeof(string), "Admin: (%d)%s [AdminLevel: %d]", i, GetName(i), PlayerInfo[i][AdminLevel] ); SendClientMessage(playerid, BLUE, string);
- }
- }
- if(Count[0] > 1)
- {
- new x; format(string, sizeof(string), "Admins:");
- for(i = 0; i < MAX_PLAYERS; i++) if(IsPlayerConnected(i) && PlayerInfo[i][AdminLevel] > 0)
- {
- format(string,sizeof(string),"%s(%d)%s [AdminLevel: %d]",string,i,GetName(i),PlayerInfo[i][AdminLevel]);
- x++;
- if(x >= 5)
- {
- SendClientMessage(playerid, PURPLE, string); format(string, sizeof(string), "Admins: "); x = 0;
- }
- else format(string, sizeof(string), "%s, ", string);
- }
- if(x <= 4 && x > 0) {
- string[strlen(string)-3] = '.';
- SendClientMessage(playerid, PURPLE, string);
- }
- }
- if( (Count[1] == 1) && (PlayerInfo[playerid][AdminLevel] > 0))
- {
- for(i = 0; i < MAX_PLAYERS; i++) if(IsPlayerConnected(i) && IsPlayerAdmin(i))
- {
- format(string, sizeof(string), "RCON Admin: (%d)%s", i, GetName(i));
- SendClientMessage(playerid, GREEN, string);
- }
- }
- if(Count[1] > 1)
- {
- new x; format(string, sizeof(string), "RCON Admins: ");
- for(i = 0; i < MAX_PLAYERS; i++) if(IsPlayerConnected(i) && IsPlayerAdmin(i))
- {
- format(string,sizeof(string),"%s(%d)%s",string,i,GetName(i));
- x++;
- if(x >= 5)
- {
- SendClientMessage(playerid, WHITE, string); format(string, sizeof(string), "RCON Admins: "); x = 0;
- }
- else format(string, sizeof(string), "%s, ", string);
- }
- if(x <= 4 && x > 0)
- {
- string[strlen(string)-3] = '.';
- SendClientMessage(playerid, GREEN, string);
- }
- }
- SendClientMessage(playerid, PURPLE, "--------------------------------------");
- return 1;
- }
- #if USE_VIP_SYSTEM == true
- COMMAND:setviplevel(playerid,params[])
- {
- if(PlayerInfo[playerid][AdminLevel] == LEVEL_setviplevel)
- {
- new player, vlevel;
- if(sscanf(params, "rd", player, vlevel))
- {
- SendClientMessage(playerid,RED,"Usage: /setviplevel <playerid/part of nick> <level>");
- return 1;
- }
- if(IsPlayerConnected(player) && player != INVALID_PLAYER_ID && PlayerInfo[player][Logged] == true)
- {
- if(vlevel > MAX_VIP_LEVEL)
- {
- SendClientMessage(playerid,RED,"ERROR: Incorrect Level");
- return 1;
- }
- if(vlevel == PlayerInfo[player][VIPLevel])
- {
- SendClientMessage(playerid,RED,"ERROR: Player is already this level");
- return 1;
- }
- new year, month, day, hour, minute, second, string[128];
- getdate(year, month, day);
- gettime(hour,minute,second);
- if(vlevel > 0)
- {
- format(string,sizeof(string),"Administrator %s has set you to VIP Status [level %d]",GetName(playerid), vlevel);
- }
- else
- {
- format(string,sizeof(string),"Administrator %s deleted your VIP level",GetName(playerid));
- }
- SendClientMessage(player,BLUE,string);
- if(vlevel > PlayerInfo[player][VIPLevel])
- {
- GameTextForPlayer(player,"Promoted", 5000, 3);
- }
- else
- {
- GameTextForPlayer(player,"Demoted", 5000, 3);
- }
- format(string,sizeof(string),"You have made %s Level %d on %d/%d/%d at %d:%d:%d", GetName(player), vlevel, day, month, year, hour, minute, second);
- SendClientMessage(playerid,BLUE,string);
- format(string,sizeof(string),"Administrator %s has made %s VIPLevel %d on %d/%d/%d at %d:%d:%d",GetName(playerid), GetName(player), vlevel, day, month, year, hour, minute, second);
- SendClientMessageToAll(BLUE,string);
- PlayerInfo[player][VIPLevel] = vlevel;
- }
- else
- {
- SendClientMessage(playerid,RED,"ERROR: Cannot VIP permissions");
- }
- }
- else
- {
- SendClientMessage(playerid, RED, NO_PERM);
- }
- return 1;
- }
- #endif
- COMMAND:setadminlevel(playerid,params[])
- {
- if(PlayerInfo[playerid][AdminLevel] == LEVEL_setadminlevel || IsPlayerAdmin(playerid))
- {
- new player, alevel;
- if(sscanf(params, "rd", player, alevel))
- {
- SendClientMessage(playerid,RED,"Usage: /setadminlevel <playerid/part of nick> <level>");
- return 1;
- }
- if(IsPlayerConnected(player) && player != INVALID_PLAYER_ID && PlayerInfo[player][Logged] == true)
- {
- if(alevel > MAX_ADMIN_LEVEL)
- {
- SendClientMessage(playerid,RED,"ERROR: Incorrect Level");
- return 1;
- }
- if(alevel == PlayerInfo[player][AdminLevel])
- {
- SendClientMessage(playerid,RED,"ERROR: Player is already this level");
- return 1;
- }
- new year, month, day, hour, minute, second, string[128];
- getdate(year, month, day);
- gettime(hour,minute,second);
- if(alevel > 0)
- {
- format(string,sizeof(string),"Administrator %s has set you to Administrator Status [level %d]",GetName(playerid), alevel);
- }
- else
- {
- format(string,sizeof(string),"Administrator %s has set you to Player Status [level %d]",GetName(playerid), alevel);
- }
- SendClientMessage(player,BLUE,string);
- if(alevel > PlayerInfo[player][AdminLevel])
- {
- GameTextForPlayer(player,"Promoted", 5000, 3);
- }
- else
- {
- GameTextForPlayer(player,"Demoted", 5000, 3);
- }
- format(string,sizeof(string),"You have made %s Level %d on %d/%d/%d at %d:%d:%d", GetName(player), alevel, day, month, year, hour, minute, second);
- SendClientMessage(playerid,BLUE,string);
- format(string,sizeof(string),"Administrator %s has made %s AdminLevel %d on %d/%d/%d at %d:%d:%d",GetName(playerid), GetName(player), alevel, day, month, year, hour, minute, second);
- SendClientMessageToAll(BLUE,string);
- PlayerInfo[player][AdminLevel] = alevel;
- }
- else
- {
- SendClientMessage(playerid,RED,"ERROR: Cannot assign permissions");
- }
- }
- else
- {
- SendClientMessage(playerid, RED, NO_PERM);
- }
- return 1;
- }
- COMMAND:richlist(playerid,params[])
- {
- #pragma unused params
- if(PlayerInfo[playerid][AdminLevel] == LEVEL_richlist || IsPlayerAdmin(playerid))
- {
- new string[128], Slot1 = -1, Slot2 = -1, Slot3 = -1, Slot4 = -1, HighestCash = -9999;
- SendClientMessage(playerid,WHITE,"Rich List:");
- for(new x=0; x<MAX_PLAYERS; x++) if (IsPlayerConnected(x)) if (GetPlayerMoney(x) >= HighestCash) {
- HighestCash = GetPlayerMoney(x);
- Slot1 = x;
- }
- HighestCash = -9999;
- for(new x=0; x<MAX_PLAYERS; x++) if (IsPlayerConnected(x) && x != Slot1) if (GetPlayerMoney(x) >= HighestCash) {
- HighestCash = GetPlayerMoney(x);
- Slot2 = x;
- }
- HighestCash = -9999;
- for(new x=0; x<MAX_PLAYERS; x++) if (IsPlayerConnected(x) && x != Slot1 && x != Slot2) if (GetPlayerMoney(x) >= HighestCash) {
- HighestCash = GetPlayerMoney(x);
- Slot3 = x;
- }
- HighestCash = -9999;
- for(new x=0; x<MAX_PLAYERS; x++) if (IsPlayerConnected(x) && x != Slot1 && x != Slot2 && x != Slot3) if (GetPlayerMoney(x) >= HighestCash) {
- HighestCash = GetPlayerMoney(x);
- Slot4 = x;
- }
- format(string, sizeof(string), "(%d) %s - $%d", Slot1,GetName(Slot1),GetPlayerMoney(Slot1) );
- SendClientMessage(playerid,WHITE,string);
- if(Slot2 != -1) {
- format(string, sizeof(string), "(%d) %s - $%d", Slot2,GetName(Slot2),GetPlayerMoney(Slot2) );
- SendClientMessage(playerid,WHITE,string);
- }
- if(Slot3 != -1) {
- format(string, sizeof(string), "(%d) %s - $%d", Slot3,GetName(Slot3),GetPlayerMoney(Slot3) );
- SendClientMessage(playerid,WHITE,string);
- }
- if(Slot4 != -1) {
- format(string, sizeof(string), "(%d) %s - $%d", Slot4,GetName(Slot4),GetPlayerMoney(Slot4) );
- SendClientMessage(playerid,WHITE,string);
- }
- }
- else
- {
- SendClientMessage(playerid, RED, NO_PERM);
- }
- return 1;
- }
- COMMAND:wanteds(playerid,params[])
- {
- #pragma unused params
- if(PlayerInfo[playerid][AdminLevel] == LEVEL_wanteds || IsPlayerAdmin(playerid))
- {
- new string[128], Slot1 = -1, Slot2 = -1, Slot3 = -1, Slot4 = -1, HighestWanted = -9999;
- SendClientMessage(playerid, YELLOW, "___________ |- Wanted Players -| ___________");
- for(new x=0; x<MAX_PLAYERS; x++) if (IsPlayerConnected(x)) if (GetPlayerWantedLevel(x) >= HighestWanted)
- {
- HighestWanted = GetPlayerWantedLevel(x);
- Slot1 = x;
- }
- HighestWanted = -9999;
- for(new x=0; x<MAX_PLAYERS; x++) if (IsPlayerConnected(x) && x != Slot1) if (GetPlayerWantedLevel(x) >= HighestWanted)
- {
- HighestWanted = GetPlayerWantedLevel(x);
- Slot2 = x;
- }
- HighestWanted = -9999;
- for(new x=0; x<MAX_PLAYERS; x++) if (IsPlayerConnected(x) && x != Slot1 && x != Slot2) if (GetPlayerWantedLevel(x) >= HighestWanted)
- {
- HighestWanted = GetPlayerWantedLevel(x);
- Slot3 = x;
- }
- HighestWanted = -9999;
- for(new x=0; x<MAX_PLAYERS; x++) if (IsPlayerConnected(x) && x != Slot1 && x != Slot2 && x != Slot3) if (GetPlayerWantedLevel(x) >= HighestWanted)
- {
- HighestWanted = GetPlayerWantedLevel(x);
- Slot4 = x;
- }
- format(string, sizeof(string), "(%d) %s - Wanteds: %d", Slot1,GetName(Slot1),GetPlayerWantedLevel(Slot1));
- SendClientMessage(playerid,WHITE,string);
- if(Slot2 != -1)
- {
- format(string, sizeof(string), "(%d) %s - Wanteds: %d", Slot2,GetName(Slot2),GetPlayerWantedLevel(Slot2));
- SendClientMessage(playerid,WHITE,string);
- }
- if(Slot3 != -1)
- {
- format(string, sizeof(string), "(%d) %s - Wanteds: %d", Slot3,GetName(Slot3),GetPlayerWantedLevel(Slot3));
- SendClientMessage(playerid,WHITE,string);
- }
- if(Slot4 != -1)
- {
- format(string, sizeof(string), "(%d) %s - Wanteds: %d", Slot4,GetName(Slot4),GetPlayerWantedLevel(Slot4));
- SendClientMessage(playerid,WHITE,string);
- }
- }
- else
- {
- SendClientMessage(playerid, RED, NO_PERM);
- }
- return 1;
- }
- COMMAND:jailed(playerid,params[])
- {
- #pragma unused params
- if(PlayerInfo[playerid][AdminLevel] == LEVEL_jailed || IsPlayerAdmin(playerid))
- {
- new bool:First2 = false;
- new Count, i;
- new string[128];
- new adminname[MAX_PLAYER_NAME];
- for(i = 0; i < MAX_PLAYERS; i++)
- if(IsPlayerConnected(i) && PlayerInfo[i][Jailed])
- Count++;
- if(Count == 0)
- return SendClientMessage(playerid,RED, "No players are Jailed!");
- for(i = 0; i < MAX_PLAYERS; i++)
- if(IsPlayerConnected(i) && PlayerInfo[i][Jailed])
- {
- GetPlayerName(i, adminname, sizeof(adminname));
- if(!First2)
- {
- format(string, sizeof(string), "Jailed Players: (%d)%s", i,adminname); First2 = true;
- }
- else format(string,sizeof(string),"%s, (%d)%s ",string,i,adminname);
- SendClientMessage(playerid,YELLOW,string);
- }
- }
- else
- {
- SendClientMessage(playerid, RED, NO_PERM);
- }
- return 1;
- }
- COMMAND:frozen(playerid,params[])
- {
- #pragma unused params
- if(PlayerInfo[playerid][AdminLevel] == LEVEL_frozen || IsPlayerAdmin(playerid))
- {
- new bool:First2 = false;
- new Count,string[128], i;
- new adminname[MAX_PLAYER_NAME];
- for(i = 0; i < MAX_PLAYERS; i++)
- if(IsPlayerConnected(i) && PlayerInfo[i][Frozen])
- Count++;
- if(Count == 0)
- return SendClientMessage(playerid,RED, "No players are Frozen!");
- for(i = 0; i < MAX_PLAYERS; i++)
- if(IsPlayerConnected(i) && PlayerInfo[i][Frozen])
- {
- GetPlayerName(i, adminname, sizeof(adminname));
- if(!First2)
- {
- format(string, sizeof(string), "Frozen Players: (%d)%s", i,adminname);
- First2 = true;
- }
- else format(string,sizeof(string),"%s, (%d)%s ",string,i,adminname);
- SendClientMessage(playerid,YELLOW,string);
- }
- }
- else
- {
- SendClientMessage(playerid, RED, NO_PERM);
- }
- return 1;
- }
- COMMAND:akill(playerid,params[])
- {
- if(PlayerInfo[playerid][AdminLevel] == LEVEL_akill || IsPlayerAdmin(playerid))
- {
- new player;
- if(sscanf(params, "r", player))
- {
- SendClientMessage(playerid,RED,"Usage: /akill <playerid/part of nick>");
- return 1;
- }
- if(IsPlayerConnected(player) && player != INVALID_PLAYER_ID && PlayerInfo[player][AdminLevel] != MAX_ADMIN_LEVEL)
- {
- new string[128];
- format(string,sizeof(string),"Administrator %s has killed you",GetName(playerid));
- SendClientMessage(player,RED,string);
- format(string,sizeof(string),"You have killed %s",GetName(player));
- SendClientMessage(playerid,PURPLE,string);
- SetPlayerHealth(player,0.0);
- }
- else SendClientMessage(playerid,YELLOW,"Player not connected or highest level admin");
- }
- else
- {
- SendClientMessage(playerid, RED, NO_PERM);
- }
- return 1;
- }
- COMMAND:showguns(playerid,params[])
- {
- if(PlayerInfo[playerid][AdminLevel] == LEVEL_showguns || IsPlayerAdmin(playerid))
- {
- new player;
- if(sscanf(params, "r", player))
- {
- SendClientMessage(playerid,RED,"Usage: /showguns <playerid/part of nick>");
- return 1;
- }
- if(IsPlayerConnected(player) && player != INVALID_PLAYER_ID)
- {
- new Count, x;
- new string[128];
- new WeapName[24], slot, weap, ammo;
- format(string,sizeof(string),"_______|- %s(%d) Weapons -|_______", player,GetName(player));
- SendClientMessage(playerid,YELLOW,string);
- for(slot = 0; slot < 14; slot++)
- {
- GetPlayerWeaponData(player, slot, weap, ammo);
- if(ammo != 0 && weap != 0)
- Count++;
- }
- if(Count < 1)
- return SendClientMessage(playerid,RED,"No Weapons found!");
- if(Count >= 1)
- {
- for(slot = 0; slot < 14; slot++)
- {
- GetPlayerWeaponData(player, slot, weap, ammo);
- if(ammo != 0 && weap != 0)
- {
- GetWeaponName(weap, WeapName, sizeof(WeapName));
- if(ammo == 65535 || ammo == 1)
- format(string,sizeof(string),"%s%s (1)",string, WeapName);
- else format(string,sizeof(string),"%s%s (%d)",string, WeapName, ammo);
- x++;
- if(x >= 5)
- {
- SendClientMessage(playerid, BLUE, string);
- x = 0;
- format(string, sizeof(string), "");
- }
- else format(string, sizeof(string), "%s, ", string);
- }
- }
- if(x <= 4 && x > 0)
- {
- string[strlen(string)-3] = '.';
- SendClientMessage(playerid, RED, string);
- }
- }
- }
- else SendClientMessage(playerid,YELLOW,"Player not connected");
- }
- else
- {
- SendClientMessage(playerid, RED, NO_PERM);
- }
- return 1;
- }
- COMMAND:morning(playerid,params[])
- {
- #pragma unused params
- if(PlayerInfo[playerid][AdminLevel] == LEVEL_morning)
- {
- SetPlayerTime(playerid,7,0);
- }
- else
- {
- SendClientMessage(playerid, RED, NO_PERM);
- }
- return 1;
- }
- COMMAND:miniguns(playerid,params[])
- {
- #pragma unused params
- if(PlayerInfo[playerid][AdminLevel] >= LEVEL_miniguns)
- {
- new bool:First2 = false;
- new Count, string[128];
- new i, slot, weap, ammo;
- for(i = 0; i < MAX_PLAYERS; i++)
- {
- if(IsPlayerConnected(i))
- {
- for(slot = 0; slot < 14; slot++)
- {
- GetPlayerWeaponData(i, slot, weap, ammo);
- if(ammo != 0 && weap == 38)
- {
- Count++;
- if(!First2)
- {
- format(string, sizeof(string), "Minigun: (%d)%s(ammo%d)", i, GetName(i), ammo);
- First2 = true;
- }
- else format(string,sizeof(string),"%s, (%d)%s(ammo%d) ",string, i, GetName(i), ammo);
- }
- }
- }
- }
- if(Count == 0)
- return SendClientMessage(playerid,GREEN,"No player has Minigun!");
- else return SendClientMessage(playerid,WHITE,string);
- }
- else
- {
- SendClientMessage(playerid, RED, NO_PERM);
- }
- return 1;
- }
- COMMAND:spawnveh(playerid, params[])
- {
- if(PlayerInfo[playerid][AdminLevel] >= LEVEL_spawnveh)
- {
- ShowPlayerVehicleSpawnDialog(playerid);
- return 1;
- }
- else
- {
- SendClientMessage(playerid, RED, NO_PERM);
- }
- return 1;
- }
- COMMAND:muted(playerid,params[])
- {
- #pragma unused params
- if(PlayerInfo[playerid][AdminLevel] == LEVEL_muted || IsPlayerAdmin(playerid))
- {
- new bool:First2 = false, Count, adminname[MAX_PLAYER_NAME], string[128], i;
- for(i = 0; i < MAX_PLAYERS; i++) if(IsPlayerConnected(i) && PlayerInfo[i][Muted]) Count++;
- if(Count == 0) return SendClientMessage(playerid,RED, "ERROR: No players are Muted!");
- for(i = 0; i < MAX_PLAYERS; i++) if(IsPlayerConnected(i) && PlayerInfo[i][Muted])
- {
- GetPlayerName(i, adminname, sizeof(adminname));
- if(!First2)
- {
- format(string, sizeof(string), "Muted Players: (%d)%s", i,adminname);
- First2 = true;
- } else format(string,sizeof(string),"%s, (%d)%s ",string,i,adminname);
- SendClientMessage(playerid,YELLOW,string);
- }
- }
- else
- {
- SendClientMessage(playerid, RED, NO_PERM);
- }
- return 1;
- }
- COMMAND:unfreeze(playerid,params[])
- {
- if(PlayerInfo[playerid][AdminLevel] >= LEVEL_unfreeze)
- {
- new player;
- if(sscanf(params, "r", player))
- {
- SendClientMessage(playerid,RED,"Usage: /unfreeze <playerid/part of nick>");
- return 1;
- }
- if(PlayerInfo[player][Frozen] == true)
- {
- TogglePlayerControllable(player,true);
- PlayerInfo[player][Frozen] = false;
- SendClientMessage(player,GREEN, "You have been unfreezed by an admin");
- }
- else
- {
- SendClientMessage(playerid,RED,"Not possible to unfreeze him now");
- }
- }
- else
- {
- SendClientMessage(playerid, RED, NO_PERM);
- }
- return 1;
- }
- COMMAND:freeze(playerid,params[])
- {
- if(PlayerInfo[playerid][AdminLevel] >= LEVEL_freeze)
- {
- new player;
- if(sscanf(params, "r", player))
- {
- SendClientMessage(playerid,RED,"Usage: /freeze <playerid/part of nick>");
- return 1;
- }
- if(IsPlayerConnected(player) && player != INVALID_PLAYER_ID)
- {
- TogglePlayerControllable(player,false);
- PlayerInfo[player][Frozen] = true;
- SendClientMessage(player,RED, "You have been freezed by an admin");
- }
- else
- {
- SendClientMessage(playerid,RED,"Not possible to freeze him now");
- }
- }
- else
- {
- SendClientMessage(playerid, RED, NO_PERM);
- }
- return 1;
- }
- COMMAND:jail(playerid,params[])
- {
- if(PlayerInfo[playerid][AdminLevel] >= LEVEL_jail)
- {
- new player, time, reason[128];
- if(sscanf(params, "rds[128]", player, time, reason))
- {
- SendClientMessage(playerid,RED,"Usage: /jail <playerid/part of nick> <minutes> <reason>");
- return 1;
- }
- if(IsPlayerConnected(player) && player != INVALID_PLAYER_ID && PlayerInfo[player][AdminLevel] != MAX_ADMIN_LEVEL)
- {
- if(PlayerInfo[player][Jailed] == false)
- {
- PlayerInfo[playerid][JailTime] = time * 1000 * 60;
- SetTimerEx("JailPlayer", 5000, 0, "d", player);
- SetTimerEx("Jail1", 1000, 0, "d", player);
- PlayerInfo[player][Jailed] = true;
- new string[128];
- format(string, sizeof(string), "**%s has been jailed for %i minutes by admin %s [Reason: %s]", GetName(player), time, GetName(playerid), reason);
- SendClientMessageToAll(RED,string);
- } else SendClientMessage(playerid, RED, "ERROR: Player is already in jail");
- }else SendClientMessage(playerid, RED, "ERROR: Player is not connected or is the highest level admin");
- }
- else
- {
- SendClientMessage(playerid, RED, NO_PERM);
- }
- return 1;
- }
- COMMAND:unjail(playerid,params[])
- {
- if(PlayerInfo[playerid][AdminLevel] >= LEVEL_unjail)
- {
- new player;
- if(sscanf(params, "r", player))
- {
- SendClientMessage(playerid,RED,"Usage: /unjail <playerid/part of nick>");
- return 1;
- }
- if(IsPlayerConnected(player) && player != INVALID_PLAYER_ID && PlayerInfo[player][AdminLevel] != MAX_ADMIN_LEVEL)
- {
- if(PlayerInfo[player][Jailed] == true)
- {
- new string[128];
- format(string,sizeof(string),"Administrator %s has unjailed you", GetName(playerid));
- SendClientMessage(player,GREEN,string);
- format(string,sizeof(string),"**%s has been released from prison",GetName(player));
- SendClientMessage(player,RED,string);
- UnjailPlayer(player);
- } else SendClientMessage(playerid, RED, "ERROR: Player is not in jail");
- } else SendClientMessage(playerid, RED, "ERROR: Player is not connected or is the highest level admin");
- }
- else
- {
- SendClientMessage(playerid, RED, NO_PERM);
- }
- return 1;
- }
- COMMAND:clearchat(playerid,params[])
- {
- #pragma unused params
- if(PlayerInfo[playerid][AdminLevel] >= LEVEL_clearchat)
- {
- for(new i = 0; i < 64; i++)
- {
- SendClientMessageToAll(GREEN," ");
- }
- }
- else
- {
- SendClientMessage(playerid, RED, NO_PERM);
- }
- return 1;
- }
- COMMAND:move(playerid,params[])
- {
- if(PlayerInfo[playerid][AdminLevel] >= LEVEL_move)
- {
- if(!strlen(params))
- {
- SendClientMessage(playerid, RED, "USAGE: /move [up / down / +x / -x / +y / -y / off]");
- return 1;
- }
- new Float:X, Float:Y, Float:Z;
- if(strcmp(params,"up",true) == 0)
- {
- TogglePlayerControllable(playerid,false); GetPlayerPos(playerid,X,Y,Z); SetPlayerPos(playerid,X,Y,Z+5); SetCameraBehindPlayer(playerid);
- }
- else if(strcmp(params,"down",true) == 0)
- {
- TogglePlayerControllable(playerid,false); GetPlayerPos(playerid,X,Y,Z); SetPlayerPos(playerid,X,Y,Z-5); SetCameraBehindPlayer(playerid);
- }
- else if(strcmp(params,"+x",true) == 0)
- {
- TogglePlayerControllable(playerid,false); GetPlayerPos(playerid,X,Y,Z); SetPlayerPos(playerid,X+5,Y,Z);
- }
- else if(strcmp(params,"-x",true) == 0)
- {
- TogglePlayerControllable(playerid,false); GetPlayerPos(playerid,X,Y,Z); SetPlayerPos(playerid,X-5,Y,Z);
- }
- else if(strcmp(params,"+y",true) == 0)
- {
- TogglePlayerControllable(playerid,false); GetPlayerPos(playerid,X,Y,Z); SetPlayerPos(playerid,X,Y+5,Z);
- }
- else if(strcmp(params,"-y",true) == 0)
- {
- TogglePlayerControllable(playerid,false); GetPlayerPos(playerid,X,Y,Z); SetPlayerPos(playerid,X,Y-5,Z);
- }
- else if(strcmp(params,"off",true) == 0)
- {
- TogglePlayerControllable(playerid,true);
- }
- else
- {
- SendClientMessage(playerid,RED,"USAGE: /move [up / down / +x / -x / +y / -y / off]");
- return 1;
- }
- }
- else
- {
- SendClientMessage(playerid, RED, NO_PERM);
- }
- return 1;
- }
- COMMAND:changepass(playerid,params[])
- {
- new pass[128];
- if(sscanf(params, "s[128]", pass))
- {
- SendClientMessage(playerid,RED,"Usage: /changepass <new pass>");
- return 1;
- }
- if(strlen(pass) < MIN_PASS_LEN || strlen(pass) > MAX_PASS_LEN)
- {
- SendClientMessage(playerid,RED,"SERVER: Incorrect password length.");
- return 1;
- }
- new string[128];
- UpdatePlayerPass(playerid, pass);
- PlayerPlaySound(playerid,1057,0.0,0.0,0.0);
- format(string, sizeof(string),"SERVER: You have successfully changed your password to \"%s\"",pass);
- SendClientMessage(playerid,YELLOW,string);
- return 1;
- }
- COMMAND:healall(playerid,params[])
- {
- #pragma unused params
- if(PlayerInfo[playerid][AdminLevel] >= LEVEL_healall)
- {
- for(new i = 0; i < MAX_PLAYERS; i++)
- {
- if(IsPlayerConnected(i) && (i != playerid) && i != MAX_ADMIN_LEVEL)
- {
- PlayerPlaySound(i,1057,0.0,0.0,0.0);
- SetPlayerHealth(i,100.0);
- }
- }
- new string[64];
- format(string,sizeof(string),"Administrator \"%s\" healed all players", GetName(playerid));
- SendClientMessageToAll(BLUE, string);
- GameTextForAll("Health for all!", 3000, 3);
- SetPlayerHealth(playerid,100.0);
- }
- else
- {
- SendClientMessage(playerid, RED, NO_PERM);
- }
- return 1;
- }
- COMMAND:armourall(playerid,params[])
- {
- #pragma unused params
- if(PlayerInfo[playerid][AdminLevel] >= LEVEL_armourall)
- {
- for(new i = 0; i < MAX_PLAYERS; i++)
- {
- if(IsPlayerConnected(i) && (i != playerid) && i != MAX_ADMIN_LEVEL)
- {
- PlayerPlaySound(i,1057,0.0,0.0,0.0);
- SetPlayerArmour(i,100.0);
- }
- }
- new string[64];
- format(string,sizeof(string),"Administrator \"%s\" restored all players armour", GetName(playerid));
- SendClientMessageToAll(BLUE, string);
- GameTextForAll("Armour for all!", 3000, 3);
- SetPlayerArmour(playerid,100.0);
- }
- else
- {
- SendClientMessage(playerid, RED, NO_PERM);
- }
- return 1;
- }
- COMMAND:vips(playerid, params[])
- {
- new string[1024], temp[128];
- strcat(string, ""blue"Online VIPs:\n"white"");
- for(new i = 0; i < MAX_PLAYERS; i++)
- {
- if(PlayerInfo[i][VIPLevel] >= 1 && IsPlayerConnected(i))
- {
- format(temp, sizeof(temp), "\n%s [ID: %d] Level: %d", GetName(i), i, PlayerInfo[i][VIPLevel]);
- strcat(string, temp);
- }
- }
- ShowPlayerDialog(playerid, VIPS_DIALOG, DIALOG_STYLE_MSGBOX, "Vips", string, "OK", "");
- return 1;
- }
- COMMAND:sethealth(playerid,params[])
- {
- if(PlayerInfo[playerid][AdminLevel] >= LEVEL_sethealth)
- {
- new Float:health, player;
- if(sscanf(params, "rf", player, health))
- {
- SendClientMessage(playerid,RED,"Usage: /sethealth <playerid/part of nick> <health>");
- return 1;
- }
- if(IsPlayerConnected(player))
- {
- SetPlayerHealth(player, health);
- new string[128];
- format(string, sizeof(string), "Admin %s set your health to %f", GetName(playerid), health);
- SendClientMessage(player, GREEN, string);
- format(string, sizeof(string), "You set %´s health to %f", GetName(player), health);
- SendClientMessage(playerid, GREEN, string);
- }
- }
- else
- {
- SendClientMessage(playerid, RED, NO_PERM);
- }
- return 1;
- }
- COMMAND:setarmour(playerid,params[])
- {
- if(PlayerInfo[playerid][AdminLevel] >= LEVEL_setarmour)
- {
- new player, Float:armour;
- if(sscanf(params, "rf", player, armour))
- {
- SendClientMessage(playerid,RED,"Usage: /setarmour <playerid/part of nick> <armour>");
- return 1;
- }
- if(IsPlayerConnected(player))
- {
- SetPlayerArmour(player, armour);
- new string[128];
- format(string, sizeof(string), "Admin %s set your armour to %f", GetName(playerid), armour);
- SendClientMessage(player, GREEN, string);
- format(string, sizeof(string), "You set %´s armour to %f", GetName(player), armour);
- SendClientMessage(playerid, GREEN, string);
- }
- }
- else
- {
- SendClientMessage(playerid, RED, NO_PERM);
- }
- return 1;
- }
- COMMAND:pay(playerid, params[])
- {
- new player, cash;
- if(sscanf(params, "rd", player, cash))
- {
- SendClientMessage(playerid,RED,"Usage: /pay <playerid/part of nick> <money>");
- return 1;
- }
- if(IsPlayerConnected(player) && player != INVALID_PLAYER_ID)
- {
- if(GetPlayerMoney(playerid) < cash)
- {
- SendClientMessage(playerid, RED, "You don't have that much!");
- return 1;
- }
- if(cash < 1000 || cash > 1000000)
- {
- SendClientMessage(playerid, RED, "Cash must be $1,000 - $1,000,000");
- return 1;
- }
- if(player == playerid)
- {
- SendClientMessage(playerid, RED, "You really want to pay yourself?... lol");
- return 1;
- }
- new string[128];
- GivePlayerMoney(playerid, -cash);
- GivePlayerMoney(player, cash);
- format(string,sizeof(string),"%s paid you $%d", GetName(playerid), cash);
- SendClientMessage(player,YELLOW,string);
- SendClientMessage(playerid,YELLOW,"Successfully paid the money!");
- }
- else
- {
- SendClientMessage(playerid, RED, NO_PERM);
- }
- return 1;
- }
- COMMAND:setallweather(playerid,params[])
- {
- if(PlayerInfo[playerid][AdminLevel] >= LEVEL_setallweather)
- {
- new weather;
- if(sscanf(params, "d", weather))
- {
- SendClientMessage(playerid,RED,"Usage: /setallweather <weather id>");
- return 1;
- }
- for(new i = 0; i < MAX_PLAYERS; i++)
- {
- if(IsPlayerConnected(i))
- {
- PlayerPlaySound(i,1057,0.0,0.0,0.0);
- SetPlayerWeather(i, weather);
- }
- }
- new string[128];
- format(string,sizeof(string),"Administrator \"%s\" has set all players weather to '%d'", GetName(playerid), weather);
- SendClientMessageToAll(BLUE, string);
- }
- else
- {
- SendClientMessage(playerid, RED, NO_PERM);
- }
- return 1;
- }
- COMMAND:setalltime(playerid,params[])
- {
- if(PlayerInfo[playerid][AdminLevel] >= LEVEL_setalltime)
- {
- new hour;
- if(sscanf(params, "d", hour))
- {
- SendClientMessage(playerid,RED,"Usage: /setalltime <hour>");
- return 1;
- }
- if(hour > 24)
- {
- SendClientMessage(playerid, RED, "ERROR: Invalid hour");
- return 1;
- }
- for(new i = 0; i < MAX_PLAYERS; i++)
- {
- if(IsPlayerConnected(i))
- {
- PlayerPlaySound(i,1057,0.0,0.0,0.0);
- SetPlayerTime(i, hour, 0);
- }
- }
- new string[128];
- format(string,sizeof(string),"Administrator \"%s\" has set all players time to '%d:00'", GetName(playerid), hour);
- SendClientMessageToAll(BLUE, string);
- }
- else
- {
- SendClientMessage(playerid, RED, NO_PERM);
- }
- return 1;
- }
- COMMAND:cashfall(playerid,params[])
- {
- #pragma unused params
- if(PlayerInfo[playerid][AdminLevel] >= LEVEL_cashfall)
- {
- new string[128];
- for(new i = 0; i < MAX_PLAYERS; i++)
- {
- if(IsPlayerConnected(i) && PlayerInfo[i][Logged] == true)
- {
- PlayerPlaySound(i,1057,0.0,0.0,0.0);
- GivePlayerMoney(i,50000);
- }
- }
- format(string,sizeof(string),"Administrator \"%s\" has given all players $50,000", GetName(playerid));
- SendClientMessageToAll(BLUE, string);
- }
- else
- {
- SendClientMessage(playerid, RED, NO_PERM);
- }
- return 1;
- }
- COMMAND:scorefall(playerid,params[])
- {
- #pragma unused params
- if(PlayerInfo[playerid][AdminLevel] >= LEVEL_scorefall)
- {
- new string[128];
- for(new i = 0; i < MAX_PLAYERS; i++)
- {
- if(IsPlayerConnected(i) && PlayerInfo[i][Logged] == true)
- {
- PlayerPlaySound(i,1057,0.0,0.0,0.0);
- GivePlayerScore(i,100);
- }
- }
- format(string,sizeof(string),"Administrator \"%s\" has given all players 100 score", GetName(playerid));
- SendClientMessageToAll(BLUE, string);
- }
- else
- {
- SendClientMessage(playerid, RED, NO_PERM);
- }
- return 1;
- }
- COMMAND:killall(playerid,params[])
- {
- #pragma unused params
- if(PlayerInfo[playerid][AdminLevel] >= LEVEL_killall)
- {
- for(new i = 0; i < MAX_PLAYERS; i++)
- {
- if(IsPlayerConnected(i) && (i != playerid) && i != MAX_ADMIN_LEVEL)
- {
- PlayerPlaySound(i,1057,0.0,0.0,0.0);
- SetPlayerHealth(i,0.0);
- }
- }
- new string[128];
- format(string,sizeof(string),"Administrator \"%s\" has killed all players", GetName(playerid));
- SendClientMessageToAll(BLUE, string);
- }
- else
- {
- SendClientMessage(playerid, RED, NO_PERM);
- }
- return 1;
- }
- COMMAND:kickall(playerid,params[])
- {
- #pragma unused params
- if(PlayerInfo[playerid][AdminLevel] >= LEVEL_kickall)
- {
- for(new i = 0; i < MAX_PLAYERS; i++)
- {
- if(IsPlayerConnected(i) && (i != playerid) && i != MAX_ADMIN_LEVEL)
- {
- #if PRINT_BYKICK == true
- printf("[KICK]: %s has been kicked", GetName(playerid));
- #endif
- Kick(i);
- }
- }
- new string[128];
- format(string,sizeof(string),"Administrator \"%s\" has kicked all players", GetName(playerid));
- SendClientMessageToAll(DARK_BLUE, string);
- }
- else
- {
- SendClientMessage(playerid, RED, NO_PERM);
- }
- return 1;
- }
- COMMAND:setallwanted(playerid,params[])
- {
- if(PlayerInfo[playerid][AdminLevel] >= LEVEL_setallwanted)
- {
- if(!strlen(params)) return SendClientMessage(playerid, RED, "Usage: /setallwanted <WantedLevel>");
- new var = strval(params), string[128];
- for(new i = 0; i < MAX_PLAYERS; i++)
- {
- if(IsPlayerConnected(i))
- {
- PlayerPlaySound(i,1057,0.0,0.0,0.0);
- SetPlayerWantedLevel(i,var);
- }
- }
- format(string,sizeof(string),"Administrator \"%s\" has set all players wanted level to '%d'", GetName(playerid), var);
- SendClientMessageToAll(ORANGE, string);
- }
- else
- {
- SendClientMessage(playerid, RED, NO_PERM);
- }
- return 1;
- }
- COMMAND:disarmall(playerid,params[])
- {
- #pragma unused params
- if(PlayerInfo[playerid][AdminLevel] >= LEVEL_disarmall)
- {
- for(new i = 0; i < MAX_PLAYERS; i++)
- {
- if(IsPlayerConnected(i) && (i != playerid) && i != MAX_ADMIN_LEVEL)
- {
- PlayerPlaySound(i,1057,0.0,0.0,0.0);
- ResetPlayerWeapons(i);
- }
- }
- new string[128];
- format(string,sizeof(string),"Administrator \"%s\" has disarmed all players", GetName(playerid));
- SendClientMessageToAll(PURPLE, string);
- }
- else
- {
- SendClientMessage(playerid, RED, NO_PERM);
- }
- return 1;
- }
- COMMAND:ejectall(playerid,params[])
- {
- #pragma unused params
- if(PlayerInfo[playerid][AdminLevel] >= LEVEL_ejectall)
- {
- new Float:x, Float:y, Float:z;
- for(new i = 0; i < MAX_PLAYERS; i++)
- {
- if(IsPlayerConnected(i) && i != MAX_ADMIN_LEVEL)
- {
- if(IsPlayerInAnyVehicle(i))
- {
- PlayerPlaySound(i,1057,0.0,0.0,0.0);
- GetPlayerPos(i,x,y,z);
- SetPlayerPos(i,x,y,z+3);
- }
- }
- }
- new string[128];
- format(string,sizeof(string),"Administrator \"%s\" has ejected all Players", GetName(playerid));
- SendClientMessageToAll(PURPLE, string);
- }
- else
- {
- SendClientMessage(playerid, RED, NO_PERM);
- }
- return 1;
- }
- COMMAND:giveallweapon(playerid,params[])
- {
- if(PlayerInfo[playerid][AdminLevel] >= LEVEL_giveallweapon)
- {
- new gun, WeapName[64], string[128];
- if(sscanf(params, "d", gun))
- {
- SendClientMessage(playerid,RED,"Usage: /giveallweapon <weapon id>");
- return 1;
- }
- for(new i = 0; i < MAX_PLAYERS; i++)
- {
- if(IsPlayerConnected(i))
- {
- PlayerPlaySound(i,1057,0.0,0.0,0.0);
- GivePlayerWeapon(i,gun,99999);
- }
- }
- GetWeaponName(gun, WeapName, sizeof(WeapName));
- format(string,sizeof(string),"Administrator \"%s\" has given all players a %s", GetName(playerid), WeapName);
- SendClientMessageToAll(BLUE, string);
- }
- else
- {
- SendClientMessage(playerid, RED, NO_PERM);
- }
- return 1;
- }
- COMMAND:enable(playerid,params[])
- {
- if(PlayerInfo[playerid][AdminLevel] >= LEVEL_enable || IsPlayerAdmin(playerid))
- {
- new cmd[64];
- if(sscanf(params, "s", cmd))
- {
- SendClientMessage(playerid,RED,"Usage: /enable <PingKicker / AntiCaps / Chat / AutoLogin / ConnectMsgs>");
- return 1;
- }
- if(!strcmp(cmd, "pingkicker", true))
- {
- if(ServerInfo[PingSystem] == false)
- {
- for(new i=0; i <= MAX_PLAYERS; i++)
- {
- #if IS_ADMIN_IMMUNE == true
- if(IsPlayerAdmin(i) || PlayerInfo[i][AdminLevel] >= 1) continue;
- #endif
- if(!IsPlayerConnected(i) || IsPlayerNPC(i)) continue;
- PlayerInfo[i][PingTimer] = SetTimerEx("CheckPlayerPing", PINGCHECK_TIME*1000, true, "d", i);
- }
- SendClientMessage(playerid, GREEN, "Anti High Ping System has been enabled");
- ServerInfo[PingSystem] = true;
- }
- }
- else if(!strcmp(cmd, "anticaps", true))
- {
- ServerInfo[NoCaps] = true;
- }
- else if(!strcmp(cmd, "chat", true))
- {
- ServerInfo[EnableChat] = true;
- }
- else if(!strcmp(cmd, "autologin", true))
- {
- ServerInfo[AutoLogin] = true;
- }
- else if(!strcmp(cmd, "connectmsgs", true))
- {
- ServerInfo[ConnectMessages] = true;
- }
- }
- else
- {
- SendClientMessage(playerid, RED, NO_PERM);
- }
- return 1;
- }
- COMMAND:disable(playerid,params[])
- {
- if(PlayerInfo[playerid][AdminLevel] >= LEVEL_disable || IsPlayerAdmin(playerid))
- {
- new cmd[64];
- if(sscanf(params, "s", cmd))
- {
- SendClientMessage(playerid,RED,"Usage: /disable <PingKicker / AntiCaps / Chat / ConnectMsgs>");
- return 1;
- }
- if(!strcmp(cmd, "pingkicker", true))
- {
- if(ServerInfo[PingSystem] == true)
- {
- for(new i=0; i <= MAX_PLAYERS; i++)
- {
- #if IS_ADMIN_IMMUNE == true
- if(IsPlayerAdmin(i) || PlayerInfo[i][AdminLevel] >= 1) continue;
- #endif
- if(!IsPlayerConnected(i) || IsPlayerNPC(i) || PlayerInfo[i][PingTimer] == -1) continue;
- KillTimer(PlayerInfo[i][PingTimer]);
- PlayerInfo[i][PingTimer] = -1;
- }
- ServerInfo[PingSystem] = false;
- SendClientMessage(playerid, RED, "Anti High Ping System has been disabled");
- }
- }
- else if(!strcmp(cmd, "anticaps", true))
- {
- ServerInfo[NoCaps] = false;
- }
- else if(!strcmp(cmd, "chat", true))
- {
- ServerInfo[EnableChat] = false;
- }
- else if(!strcmp(cmd, "autologin", true))
- {
- ServerInfo[AutoLogin] = false;
- }
- else if(!strcmp(cmd, "connectmsgs", true))
- {
- ServerInfo[ConnectMessages] = false;
- }
- }
- else
- {
- SendClientMessage(playerid, RED, NO_PERM);
- }
- return 1;
- }
- COMMAND:specoff(playerid,params[])
- {
- #pragma unused params
- if(PlayerInfo[playerid][AdminLevel] >= LEVEL_spec || IsPlayerAdmin(playerid))
- {
- if(PlayerInfo[playerid][SpecType] != ADMIN_SPEC_TYPE_NONE)
- {
- StopSpectate(playerid);
- SendClientMessage(playerid,BLUE,"No Longer Spectating");
- }
- else
- {
- SendClientMessage(playerid,RED,"ERROR: You are not spectating");
- }
- }
- else
- {
- SendClientMessage(playerid, RED, NO_PERM);
- }
- return 1;
- }
- #endif
- COMMAND:onduty(playerid,params[])
- {
- #pragma unused params
- if(PlayerInfo[playerid][AdminLevel] >= LEVEL_onduty)
- {
- if(PlayerInfo[playerid][AdminOnDuty] == false)
- {
- PlayerInfo[playerid][AdminOnDuty] = true;
- SetPlayerColor(playerid, RED);
- adminlabel[playerid] = Create3DTextLabel("ADMIN ON DUTY", RED,0,0,0,70.5,1);
- Attach3DTextLabelToPlayer(adminlabel[playerid], playerid, 0.0, 0.0, 0.45);
- new aonduty[64];
- format(aonduty, sizeof(aonduty), "[ Administrator %s is now onduty! ]", GetName(playerid));
- SendClientMessageToAll(RED, aonduty);
- SetPlayerHealth(playerid,999999);
- }
- else if(PlayerInfo[playerid][AdminOnDuty] == true)
- {
- SendClientMessage(playerid,RED,"You are already onduty!");
- }
- }
- else
- {
- SendClientMessage(playerid, RED, NO_PERM);
- }
- return 1;
- }
- COMMAND:offduty(playerid,params[])
- {
- #pragma unused params
- if(PlayerInfo[playerid][AdminLevel] >= LEVEL_onduty)
- {
- if(PlayerInfo[playerid][AdminOnDuty] == true)
- {
- PlayerInfo[playerid][AdminOnDuty] = false;
- new offduty[64];
- Delete3DTextLabel(adminlabel[playerid]);
- format(offduty, sizeof(offduty), "[ Administrator %s is now offduty! ]", GetName(playerid));
- SendClientMessageToAll(GREEN, offduty);
- SetPlayerColor(playerid, WHITE);
- SetPlayerHealth(playerid,100);
- }
- else if(PlayerInfo[playerid][AdminOnDuty] == false)
- {
- SendClientMessage(playerid,RED,"You are not onduty!");
- }
- }
- else
- {
- SendClientMessage(playerid, RED, NO_PERM);
- }
- return 1;
- }
- COMMAND:flip(playerid, params[])
- {
- #pragma unused params
- new currentveh,
- Float:angle;
- currentveh = GetPlayerVehicleID(playerid);
- GetVehicleZAngle(currentveh, angle);
- SetVehicleZAngle(currentveh, angle);
- SendClientMessage(playerid, WHITE, "Your vehicle has been fliped!");
- return 1;
- }
- COMMAND:stats(playerid,params[])
- {
- new string[250], pDeaths, player1, player, h, m, s;
- if(sscanf(params, "r", player))
- {
- player1 = playerid;
- }
- else
- {
- player1 = player;
- }
- if(IsPlayerConnected(player1))
- {
- TotalGameTime(player1, h, m, s);
- if(PlayerInfo[player1][Deaths] == 0) { pDeaths = 1; }
- else { pDeaths = PlayerInfo[player1][Deaths]; }
- #if USE_VIP_SYSTEM == true
- format(string, sizeof(string), "\n{FEFEFE}Stats of the player: %s\n\n{FEFEFE}Kills:\t\t%d\nDeaths:\t\t%d\nK/D:\t\t%0.2f\nScore:\t\t%d\nMoney:\t\t$%d\nVIP Level:\t%d\nHours:\t\t%d\nMinutes\t%d\nSeconds:\t%d\nRegister date:\t%s",GetName(player1), PlayerInfo[player1][Kills], PlayerInfo[player1][Deaths],Float:PlayerInfo[player1][Kills]/Float:pDeaths,GetPlayerScore(player1),GetPlayerMoney(player1),PlayerInfo[player1][VIPLevel],h,m,s,PlayerInfo[player1][RegDate]);
- #else
- format(string, sizeof(string), "\n{FEFEFE}Stats of the player: %s\n\n{FEFEFE}Kills:\t\t%d\nDeaths:\t\t%d\nK/D:\t\t%0.2f\nScore:\t\t%d\nMoney:\t\t$%d\nHours:\t\t%d\nMinutes\t%d\nSeconds:\t%d\nRegister date:\t%s",GetName(player1), PlayerInfo[player1][Kills], PlayerInfo[player1][Deaths],Float:PlayerInfo[player1][Kills]/Float:pDeaths,GetPlayerScore(player1),GetPlayerMoney(player1),h,m,s,PlayerInfo[player1][RegDate]);
- #endif
- ShowPlayerDialog(playerid, STATS_DIALOG, DIALOG_STYLE_MSGBOX, " ", string, "OK", "");
- }
- else
- {
- SendClientMessage(playerid, RED, "Player is not connected!");
- }
- return 1;
- }
- COMMAND:aka(playerid,params[])
- {
- if(PlayerInfo[playerid][AdminLevel] >= LEVEL_aka)
- {
- new player;
- if(sscanf(params, "r", player))
- {
- SendClientMessage(playerid, RED, "Usage: /aka <playerid>");
- return 1;
- }
- new IP[16];
- #if USE_MYSQL == true
- GetPlayerIp(player, IP, sizeof(IP));
- GetUsersByIp(playerid, IP);
- #else
- if(IsPlayerConnected(player) && player != INVALID_PLAYER_ID)
- {
- new string[256];
- GetPlayerIp(player,IP,sizeof(IP));
- format(string,sizeof(string),"Names: %s", dini_Get("/aka.txt",IP));
- SendClientMessage(playerid,LIGHT_GREEN,string);
- }
- #endif
- }
- else
- {
- SendClientMessage(playerid, RED, NO_PERM);
- }
- return 1;
- }
- COMMAND:report(playerid,params[])
- {
- new player, reason[128];
- if(sscanf(params, "rs[128]", player, reason))
- {
- return SendClientMessage(playerid,RED,"Usage: /report <playerid/part of nick> <reason>");
- }
- PlayerInfo[player][ReportCount]++;
- if(IsPlayerConnected(player) && player != INVALID_PLAYER_ID && player != playerid && PlayerInfo[player][AdminLevel] == 0)
- {
- if(strlen(reason) < 4)
- {
- SendClientMessage(playerid, RED, "Please write more");
- return 1;
- }
- new hour,minute,second, string[128];
- gettime(hour,minute,second);
- format(string, sizeof(string), "||NewReport|| %s(%d) reported %s(%d) Reason: %s |@%d:%d:%d|", GetName(playerid), playerid, GetName(player), player, reason, hour, minute, second);
- AdminMSG(RED,string);
- format(string, sizeof(string), "Report(%d:%d:%d): %s(%d) reported %s(%d) Reason: %s", hour, minute, second, GetName(playerid), playerid, GetName(player), player, reason);
- for(new i = 1; i < MAX_REPORTS-1; i++) Reports[i] = Reports[i+1];
- Reports[MAX_REPORTS-1] = string;
- SendClientMessage(playerid,YELLOW, "Your report has been sent to online administrators.");
- }
- else
- {
- SendClientMessage(playerid, RED, "You cannot report this player");
- }
- return 1;
- }
- COMMAND:reports(playerid,params[])
- {
- #pragma unused params
- if(PlayerInfo[playerid][AdminLevel] >= LEVEL_reports)
- {
- new rReportCount;
- for(new i = 1; i < MAX_REPORTS; i++)
- {
- if(strcmp(Reports[i], "<none>", true) != 0)
- {
- rReportCount++;
- SendClientMessage(playerid,WHITE,Reports[i]);
- }
- }
- if(rReportCount == 0)
- {
- SendClientMessage(playerid,WHITE,"There have been no reports");
- }
- }
- else
- {
- SendClientMessage(playerid, RED, NO_PERM);
- }
- return 1;
- }
- COMMAND:warn(playerid,params[])
- {
- if(PlayerInfo[playerid][AdminLevel] >= LEVEL_warn)
- {
- new player, reason[128];
- if(sscanf(params, "rs[128]", player, reason))
- {
- SendClientMessage(playerid,RED,"Usage: /warn <playerid/part of nick> <reason>");
- return 1;
- }
- if(PlayerInfo[player][AdminLevel] == MAX_ADMIN_LEVEL)
- {
- SendClientMessage(playerid,RED,"ERROR: You cannot use this command on this admin");
- return 1;
- }
- if(IsPlayerConnected(player) && player != INVALID_PLAYER_ID && player != playerid)
- {
- new string[128];
- PlayerInfo[player][Warnings]++;
- if(PlayerInfo[player][Warnings] == MAX_WARNINGS)
- {
- format(string, sizeof(string), "**\"%s\" has been kicked. (Reason: %s) (Warning: %d/%d)", GetName(player), reason, PlayerInfo[player][Warnings], MAX_WARNINGS);
- SendClientMessageToAll(GREY, string);
- PlayerInfo[player][KickCount]++;
- #if PRINT_BYKICK == true
- printf("[KICK]: %s has been kicked", GetName(playerid));
- #endif
- Kick(player);
- }
- else
- {
- format(string, sizeof(string), "**Administrator \"%s\" has given \"%s\" a kick warning. (Reason: %s) (Warning: %d/%d)", GetName(playerid), GetName(player), reason, PlayerInfo[player][Warnings], MAX_WARNINGS);
- SendClientMessageToAll(YELLOW, string);
- }
- }
- else
- {
- SendClientMessage(playerid, RED, "ERROR: Player is not connected or invalid");
- }
- }
- else
- {
- SendClientMessage(playerid, RED, NO_PERM);
- }
- return 1;
- }
- //==============================================================================
- //------------------------------------------------------------------------------
- // Stocks
- //------------------------------------------------------------------------------
- //==============================================================================
- stock ShowPlayerLoginDialog(playerid)
- {
- new string[256];
- format(string, sizeof(string), ""white"Welcome back on "blue""#SERVER_NAME""white", "grey"%s"white"!\nThe name that you are using is registered.\n\nPlease enter the password:", GetName(playerid));
- ShowPlayerDialog(playerid, LOGIN_DIALOG, DIALOG_STYLE_PASSWORD, "Login", string, "Login", "");
- return 1;
- }
- stock ShowPlayerRegisterDialog(playerid)
- {
- new string[256];
- format(string, sizeof(string), ""white"Welcome on "blue""#SERVER_NAME""white","grey" %s!\n"white"Your name "grey" %s "white"is not registered.\n\nPlease enter a password for your new account:", GetName(playerid), GetName(playerid));
- ShowPlayerDialog(playerid, REGISTER_DIALOG, DIALOG_STYLE_PASSWORD, "Registration", string, "Register", "");
- return 1;
- }
- stock GetUsersByIp(playerid, IP[])
- {
- new query[128];
- format(query, sizeof(query), "SELECT * FROM `"#MYSQL_TABLE"` WHERE `LastIP` = '%s'", IP);
- if(mysql_ping(gSQL))
- {
- mysql_query(query, _THREAD_GET_AKA, playerid, gSQL);
- return 1;
- }
- return 0;
- }
- stock SavePlayer(playerid)
- {
- new h, m, s, Float:health, Float:armour, Float:POS[3];
- TotalGameTime(playerid, h, m, s);
- GetPlayerPos(playerid, POS[0], POS[1], POS[2]);
- GetPlayerHealth(playerid, health);
- GetPlayerArmour(playerid, armour);
- #if USE_MYSQL == true
- new query[789];
- format(query, sizeof(query), "UPDATE `"#MYSQL_TABLE"` SET `XPos` = %.2f, `YPos` = %.2f, `ZPos` = %.2f, `AdminLevel` = %d, `VIPLevel` = %d, `WantedLevel` = %d, \
- `Kills` = %d, `Deaths` = %d, `Money` = %d, `Score` = %d, `Health` = %.2f, `Armour` = %.2f, `Hours` = %d, `Minutes` = %d, `Seconds` = %d, `LastSkin` = %d, `KickCount` = %d, `SpawnCount` = %d, `ReportCount` = %d \
- WHERE `PlayerName` = '%s'",
- POS[0],
- POS[1],
- POS[2],
- PlayerInfo[playerid][AdminLevel],
- PlayerInfo[playerid][VIPLevel],
- GetPlayerWantedLevel(playerid),
- PlayerInfo[playerid][Kills],
- PlayerInfo[playerid][Deaths],
- GetPlayerMoney(playerid),
- GetPlayerScore(playerid),
- health,
- armour,
- h,
- m,
- s,
- PlayerInfo[playerid][LastSkin],
- PlayerInfo[playerid][KickCount],
- PlayerInfo[playerid][SpawnCount],
- PlayerInfo[playerid][ReportCount],
- GetName(playerid));
- if(mysql_ping(gSQL))
- {
- mysql_query(query, _THREAD_SAVE_PLAYER, 0, gSQL);
- }
- #else
- new file[128];
- format(file, sizeof(file), "/%s/%s.ini", DINI_PATH, GetName(playerid));
- dini_FloatSet(file, "XPos", POS[0]);
- dini_FloatSet(file, "YPos", POS[1]);
- dini_FloatSet(file, "ZPos", POS[2]);
- dini_IntSet(file, "AdminLevel", PlayerInfo[playerid][AdminLevel]);
- #if USE_VIP_SYSTEM == true
- dini_IntSet(file, "VIPLevel", PlayerInfo[playerid][VIPLevel]);
- #endif
- dini_IntSet(file, "WantedLevel", GetPlayerWantedLevel(playerid));
- dini_IntSet(file, "Kills", PlayerInfo[playerid][Kills]);
- dini_IntSet(file, "Deaths", PlayerInfo[playerid][Deaths]);
- dini_IntSet(file, "Money", GetPlayerMoney(playerid));
- dini_IntSet(file, "Score", GetPlayerScore(playerid));
- dini_FloatSet(file, "Health", health);
- dini_FloatSet(file, "Armour", armour);
- dini_IntSet(file, "Hours", h);
- dini_IntSet(file, "Minutes", m);
- dini_IntSet(file, "Seconds", s);
- dini_IntSet(file, "KickCount", PlayerInfo[playerid][KickCount]);
- dini_IntSet(file, "LastSkin", PlayerInfo[playerid][LastSkin]);
- dini_IntSet(file, "SpawnCount", PlayerInfo[playerid][SpawnCount]);
- dini_IntSet(file, "ReportCount", PlayerInfo[playerid][ReportCount]);
- dini_IntSet(file, "KickCount", PlayerInfo[playerid][KickCount]);
- #endif
- }
- stock MySQLCheckAutoLogin(playerid, ip[])
- {
- new query[256];
- format(query, sizeof(query), "SELECT `LastIP` FROM `"#MYSQL_TABLE"` WHERE `PlayerName` = '%s' AND `LastIP` = '%s'", GetName(playerid), ip);
- if(mysql_ping(gSQL))
- {
- mysql_query(query, _CHECK_AUTO_LOGIN, playerid, gSQL);
- return 1;
- }
- return 0;
- }
- stock CreateAccount(playerid, password[])
- {
- new IP[16], Date[16], year, month, day;
- getdate(year, month, day);
- GetPlayerIp(playerid, IP, sizeof(IP));
- format(Date, sizeof(Date), "%d/%d/%d", day, month, year);
- #if USE_MYSQL == true
- new query[300];
- PlayerInfo[playerid][RegDate] = Date;
- mysql_real_escape_string(password, password);
- format(query, sizeof(query), "INSERT INTO `"#MYSQL_TABLE"` (`PlayerName`, `Hash`, `LastIP`, `Status`, `RegDate`) VALUES ('%s', MD5('%s'), '%s', 1, '%s')", GetName(playerid), password, IP, Date);
- if(mysql_ping(gSQL))
- {
- mysql_query(query, _THREAD_CREATE_PLAYER, playerid, gSQL);
- }
- #else
- new file[128];
- format(file, sizeof(file), "/%s/%s.ini", DINI_PATH, GetName(playerid));
- dini_Create(file);
- dini_IntSet(file, "Status", 1);
- dini_Set(file, "Hash", MD5_Hash(password));
- dini_Set(file, "LastIP", IP);
- dini_Set(file, "RegDate", Date);
- if(strlen(dini_Get("/aka.txt", IP)) == 0)
- {
- dini_Set("/aka.txt", IP, GetName(playerid));
- }
- else
- {
- new string[256];
- format(string,sizeof(string),"%s,%s", dini_Get("/aka.txt", IP), GetName(playerid));
- dini_Set("/aka.txt", IP, string);
- }
- SendClientMessage(playerid,LIGHT_GREEN,"Account successfully created. Welcome!");
- PlayerInfo[playerid][Logged] = true;
- PlayerInfo[playerid][RegDate] = Date;
- SavePlayer(playerid);
- #endif
- }
- stock CheckPlayerPassword(playerid, hash[])
- {
- #if USE_MYSQL == true
- new query[256];
- mysql_real_escape_string(hash, hash);
- format(query, sizeof(query), "SELECT `Hash` FROM `"#MYSQL_TABLE"` WHERE `PlayerName` = '%s' AND `Hash`= MD5('%s')", GetName(playerid), hash);
- if(mysql_ping(gSQL))
- {
- mysql_query(query, _CHECK_PASSWORD, playerid, gSQL);
- }
- #else
- new file[128];
- format(file, sizeof(file), "/%s/%s.ini", DINI_PATH, GetName(playerid));
- if(!strcmp(dini_Get(file, "Hash"), MD5_Hash(hash), true))
- {
- LoadPlayer(playerid);
- LogPlayerIn(playerid);
- if(PlayerInfo[playerid][AdminLevel] > 0)
- {
- new string[128];
- format(string,sizeof(string),"Successfully logged in. (Adminlevel %d)", PlayerInfo[playerid][AdminLevel]);
- SendClientMessage(playerid,GREEN,string);
- } else SendClientMessage(playerid,GREEN,"Successfully logged in!");
- }
- else
- {
- SendClientMessage(playerid,RED,"Login failed! Incorrect password");
- PlayerInfo[playerid][FailLogin]++;
- printf("LOGIN: %s has failed to login, Wrong password Attempt (%d)", GetName(playerid), PlayerInfo[playerid][FailLogin]);
- if(PlayerInfo[playerid][FailLogin] == MAX_FAIL_LOGINS)
- {
- #if PRINT_BYKICK == true
- printf("%s has been kicked (Failed Logins)",GetName(playerid));
- #endif
- Kick(playerid);
- }else ShowPlayerLoginDialog(playerid);
- }
- #endif
- return 1;
- }
- stock GivePlayerScore(playerid,amount)
- {
- SetPlayerScore(playerid,GetPlayerScore(playerid)+amount);
- return 1;
- }
- stock ExistAccount(playerid)
- {
- #if USE_MYSQL == true
- new query[128];
- format(query, sizeof(query), "SELECT * FROM `"#MYSQL_TABLE"` WHERE `PlayerName` = '%s'", GetName(playerid));
- if(mysql_ping(gSQL))
- {
- mysql_query(query, _THREAD_ACCOUNT_EXIST, playerid, gSQL);
- }
- #else
- new file[128];
- format(file, sizeof(file), "/%s/%s.ini", DINI_PATH, GetName(playerid));
- if(dini_Exists(file))
- {
- if(IsPlayerDiniBanned(playerid))
- {
- new string[128];
- format(string, sizeof(string), ""red"Your account has been banned!"white"\n\nBanned by:\t %s\nReason:\t %s\nBan Date:\t %s", dini_Get(file, "BannedBy"), dini_Get(file, "BanReason"), dini_Get(file, "BanDate"));
- ShowPlayerDialog(playerid, BAN_DIALOG, DIALOG_STYLE_MSGBOX, " ", string, "OK", "");
- KickEx(playerid);
- }
- else
- {
- #if USE_AUTO_LOGIN == true
- new lastusedIP[16], IP[16];
- GetPlayerIp(playerid, IP, sizeof(IP));
- format(lastusedIP, sizeof(lastusedIP), "%s", dini_Get(file, "LastIP"));
- if(!strcmp(IP, lastusedIP, true))
- {
- SendClientMessage(playerid, GREEN, "SERVER: You will get auto logged in now");
- LoadPlayer(playerid);
- LogPlayerIn(playerid);
- SendClientMessage(playerid, GREEN, "You have been automatically logged in");
- }else ShowPlayerLoginDialog(playerid);
- #else
- ShowPlayerLoginDialog(playerid);
- #endif
- }
- }
- else
- {
- ShowPlayerRegisterDialog(playerid);
- }
- #endif
- return 1;
- }
- stock LogPlayerOut(playerid)
- {
- #if USE_MYSQL == true
- new query[128];
- format(query, sizeof(query), "UPDATE `"#MYSQL_TABLE"` SET `LastSkin` = %d, `Status` = 0 WHERE `PlayerName` = '%s'", GetPlayerSkin(playerid), GetName(playerid));
- if(mysql_ping(gSQL))
- {
- mysql_query(query, _THREAD_PLAYER_LOGOUT, playerid, gSQL);
- }
- #else
- new file[128];
- format(file, sizeof(file), "/%s/%s.ini", DINI_PATH, GetName(playerid));
- dini_IntSet(file, "Status", 0);
- dini_IntSet(file, "LastSkin", GetPlayerSkin(playerid));
- #endif
- return 1;
- }
- stock LogPlayerIn(playerid)
- {
- new IP[16];
- GetPlayerIp(playerid, IP, sizeof(IP));
- #if USE_MYSQL == true
- new query[128];
- format(query, sizeof(query), "UPDATE `"#MYSQL_TABLE"` SET `LastIP` = '%s', `Status` = 1 WHERE `PlayerName` = '%s'", IP, GetName(playerid));
- if(mysql_ping(gSQL))
- {
- mysql_query(query, _THREAD_PLAYER_LOGIN, playerid, gSQL);
- }
- #else
- new file[128];
- format(file, sizeof(file), "/%s/%s.ini", DINI_PATH, GetName(playerid));
- dini_IntSet(file, "Status", 1);
- dini_Set(file, "LastIP", IP);
- #endif
- return 1;
- }
- #if USE_MYSQL == false
- stock IsPlayerDiniBanned(playerid)
- {
- new file[128];
- format(file, sizeof(file), "/%s/%s.ini", DINI_PATH, GetName(playerid));
- if(dini_Int(file, "Status") == 2) return true;
- return false;
- }
- #else
- stock LoadMySQLBanStat(playerid)
- {
- new query[256];
- format(query,sizeof(query),"SELECT `BannedBy`, `BanReason`, `BanDate` FROM `"#MYSQL_TABLE"` WHERE `PlayerName` = '%s'", GetName(playerid));
- if(mysql_ping(gSQL))
- {
- mysql_query(query, _FETCH_BAN_STAT, playerid, gSQL);
- return 1;
- }
- return 0;
- }
- stock IsPlayerMySQLBanned(playerid)
- {
- new query[128];
- format(query, sizeof(query), "SELECT `Status` FROM `"#MYSQL_TABLE"` WHERE `PlayerName` = '%s' AND `Status` = 2", GetName(playerid));
- if(mysql_ping(gSQL))
- {
- mysql_query(query, _THREAD_IS_BANNED, playerid, gSQL);
- return 1;
- }
- return 0;
- }
- #endif
- stock UpdatePlayerPass(playerid, newpass[])
- {
- #if USE_MYSQL == true
- new query[128];
- mysql_real_escape_string(newpass, newpass);
- format(query, sizeof(query), "UPDATE `"#MYSQL_TABLE"` SET `Hash` = MD5('%s') WHERE `PlayerName` = '%s'", newpass, GetName(playerid));
- if(mysql_ping(gSQL))
- {
- mysql_query(query, _UPDATE_PLAYER_PW, playerid, gSQL);
- }
- #else
- new file[128];
- format(file, sizeof(file), "/%s/%s.ini", DINI_PATH, GetName(playerid));
- dini_Set(file, "Hash", newpass);
- #endif
- return 1;
- }
- stock CreateBan(playerid, adminname[], reason[])
- {
- new Date[16], year, month, day;
- getdate(year, month, day);
- format(Date, sizeof(Date), "%d/%d/%d", day, month, year);
- #if USE_MYSQL == true
- new query[256];
- mysql_real_escape_string(reason, reason);
- mysql_real_escape_string(adminname, adminname);
- format(query, sizeof(query), "UPDATE `"#MYSQL_TABLE"` SET `Status` = 2, `BannedBy` = '%s', `BanReason` = '%s', `BanDate` = '%s' WHERE `PlayerName` = '%s'", adminname, reason, Date, GetName(playerid));
- if(mysql_ping(gSQL))
- {
- mysql_query(query, _THREAD_BAN_USER, 0, gSQL);
- }
- #else
- new file[128];
- format(file, sizeof(file), "/%s/%s.ini", DINI_PATH, GetName(playerid));
- dini_IntSet(file, "Status", 2);
- dini_Set(file, "BannedBy", adminname);
- dini_Set(file, "BanReason", reason);
- dini_Set(file, "BanDate", Date);
- #endif
- return 1;
- }
- stock LoadPlayer(playerid)
- {
- #if LOAD_PLAYER_POS == true
- SetPVarInt(playerid, "1stSpawn", 1);
- #endif
- #if USE_MYSQL == true
- new query[634];
- format(query,sizeof(query),"SELECT `XPos`,`YPos`,`ZPos`,`AdminLevel`,`VIPLevel`,`WantedLevel`,`Kills`,`Deaths`,`Money`,`Score`,`Health`,`Armour`,`Hours`,`Minutes`,`Seconds`,`KickCount`,`LastSkin`,`SpawnCount`,`ReportCount`,`RegDate` FROM `"#MYSQL_TABLE"` WHERE `PlayerName` = '%s'", GetName(playerid));
- if(mysql_ping(gSQL))
- {
- mysql_query(query, _THREAD_LOAD_PLAYER, playerid, gSQL);
- }
- #else
- new file[128], date[16];
- format(file, sizeof(file), "/%s/%s.ini", DINI_PATH, GetName(playerid));
- PlayerInfo[playerid][XPos] = dini_Float(file, "XPos");
- PlayerInfo[playerid][YPos] = dini_Float(file, "YPos");
- PlayerInfo[playerid][ZPos] = dini_Float(file, "ZPos");
- PlayerInfo[playerid][Health] = dini_Float(file, "Health");
- PlayerInfo[playerid][Armour] = dini_Float(file, "Armour");
- PlayerInfo[playerid][AdminLevel] = dini_Int(file, "AdminLevel");
- PlayerInfo[playerid][VIPLevel] = dini_Int(file, "VIPLevel");
- SetPlayerWantedLevel(playerid, dini_Int(file, "WantedLevel"));
- PlayerInfo[playerid][Kills] = dini_Int(file, "Kills");
- PlayerInfo[playerid][Deaths] = dini_Int(file, "Deaths");
- GivePlayerMoney(playerid, dini_Int(file, "Money"));
- SetPlayerScore(playerid, dini_Int(file, "Score"));
- PlayerInfo[playerid][Hours] = dini_Int(file, "Hours");
- PlayerInfo[playerid][Minutes] = dini_Int(file, "Minutes");
- PlayerInfo[playerid][Seconds] = dini_Int(file, "Seconds");
- PlayerInfo[playerid][LastSkin] = dini_Int(file, "LastSkin");
- PlayerInfo[playerid][KickCount] = dini_Int(file, "KickCount");
- PlayerInfo[playerid][SpawnCount] = dini_Int(file, "SpawnCount");
- PlayerInfo[playerid][ReportCount]= dini_Int(file, "ReportCount");
- format(date, sizeof(date), "%s", dini_Get(file, "RegDate"));
- PlayerInfo[playerid][RegDate] = date;
- PlayerInfo[playerid][Logged] = true;
- #endif
- return 1;
- }
- #if USE_MYSQL == true
- stock ConnectToDatabase()
- {
- gSQL = mysql_connect(MYSQL_HOST, MYSQL_USER, MYSQL_DB, MYSQL_PASS);
- if(mysql_ping(gSQL) == 1)
- {
- printf("Successfully connected to MySQL server | %s", MYSQL_HOST);
- }
- else
- {
- printf("Cannot connect to MySQL Server | %s aborting...", MYSQL_HOST);
- SendRconCommand("exit");
- }
- return 1;
- }
- stock MySQLBanUser(playerid, admin[], reason[])
- {
- new query[128], date[16], year, month, day;
- getdate(year, month, day);
- format(date, sizeof(date), "%d/%d/%d", day, month, year);
- format(query, sizeof(query), "UPDATE `"#MYSQL_TABLE"` SET `Status` = 2, `BannedBy` = '%s', `BanReason` = '%s', `BanDate` = '%s' WHERE `PlayerName` = '%s'", admin, reason, date, GetName(playerid));
- if(mysql_ping(gSQL))
- {
- mysql_query(query, _THREAD_BAN_USER, playerid, gSQL);
- }
- return 1;
- }
- #else
- stock DiniBanPlayer(playerid, admin[], reason[])
- {
- new file[128], date[16], year, month, day;
- getdate(year, month, day);
- format(date, sizeof(date), "%d/%d/%d", day, month, year);
- format(file, sizeof(file), "/%s/%s.ini", DINI_PATH, GetName(playerid));
- dini_IntSet(file, "Status", 2);
- dini_Set(file, "BannedBy", admin);
- dini_Set(file, "BanReason", reason);
- dini_Set(file, "BanDate", date);
- Kick(player);
- return 1;
- }
- #endif
- stock KickEx(playerid)
- {
- SetTimerEx("Kick_Delay",1264,false,"d",playerid);
- return 1;
- }
- public Kick_Delay(playerid)
- {
- Kick(playerid);
- return 1;
- }
- stock GetName(playerid)
- {
- new name[MAX_PLAYER_NAME];
- GetPlayerName(playerid, name, MAX_PLAYER_NAME);
- return name;
- }
- TotalGameTime(playerid, &h=0, &m=0, &s=0)
- {
- PlayerInfo[playerid][TotalTime] = ( (gettime() - PlayerInfo[playerid][ConnectTime]) + (PlayerInfo[playerid][Hours]*60*60) + (PlayerInfo[playerid][Minutes]*60) + (PlayerInfo[playerid][Seconds]) );
- h = floatround(PlayerInfo[playerid][TotalTime] / 3600, floatround_floor);
- m = floatround(PlayerInfo[playerid][TotalTime] / 60, floatround_floor) % 60;
- s = floatround(PlayerInfo[playerid][TotalTime] % 60, floatround_floor);
- return PlayerInfo[playerid][TotalTime];
- }
- #if ENABLE_SPECATE == true
- stock AdvanceSpectate(playerid)
- {
- if(ConnectedPlayers() == 2) { StopSpectate(playerid); return 1; }
- if(GetPlayerState(playerid) == PLAYER_STATE_SPECTATING && PlayerInfo[playerid][SpecID] != INVALID_PLAYER_ID)
- {
- for(new x=PlayerInfo[playerid][SpecID]+1; x<=MAX_PLAYERS; x++)
- {
- if(x == MAX_PLAYERS) x = 0;
- if(IsPlayerConnected(x) && x != playerid)
- {
- if(GetPlayerState(x) == PLAYER_STATE_SPECTATING && PlayerInfo[x][SpecID] != INVALID_PLAYER_ID || (GetPlayerState(x) != 1 && GetPlayerState(x) != 2 && GetPlayerState(x) != 3))
- {
- continue;
- }
- else
- {
- StartSpectate(playerid, x);
- break;
- }
- }
- }
- }
- return 1;
- }
- stock StartSpectate(playerid, specplayerid)
- {
- for(new x=0; x<MAX_PLAYERS; x++)
- {
- if(GetPlayerState(x) == PLAYER_STATE_SPECTATING && PlayerInfo[x][SpecID] == playerid)
- {
- AdvanceSpectate(x);
- }
- }
- SetPlayerInterior(playerid,GetPlayerInterior(specplayerid));
- TogglePlayerSpectating(playerid, 1);
- if(IsPlayerInAnyVehicle(specplayerid))
- {
- PlayerSpectateVehicle(playerid, GetPlayerVehicleID(specplayerid));
- PlayerInfo[playerid][SpecID] = specplayerid;
- PlayerInfo[playerid][SpecType] = ADMIN_SPEC_TYPE_VEHICLE;
- }
- else
- {
- PlayerSpectatePlayer(playerid, specplayerid);
- PlayerInfo[playerid][SpecID] = specplayerid;
- PlayerInfo[playerid][SpecType] = ADMIN_SPEC_TYPE_PLAYER;
- }
- new string[100], Float:hp, Float:ar;
- GetPlayerHealth(specplayerid, hp); GetPlayerArmour(specplayerid, ar);
- format(string,sizeof(string),"~n~~n~~n~~n~~n~~n~~n~~n~~w~%s - id:%d~n~< sprint - jump >~n~hp:%0.1f ar:%0.1f $%d", GetName(specplayerid),specplayerid,hp,ar,GetPlayerMoney(specplayerid));
- GameTextForPlayer(playerid,string,25000,3);
- return 1;
- }
- stock StopSpectate(playerid)
- {
- TogglePlayerSpectating(playerid, 0);
- PlayerInfo[playerid][SpecID] = INVALID_PLAYER_ID;
- PlayerInfo[playerid][SpecType] = ADMIN_SPEC_TYPE_NONE;
- GameTextForPlayer(playerid,"~n~~n~~n~~w~Spectate mode ended",1000,3);
- return 1;
- }
- stock ReverseSpectate(playerid)
- {
- if(ConnectedPlayers() == 2) { StopSpectate(playerid); return 1; }
- if(GetPlayerState(playerid) == PLAYER_STATE_SPECTATING && PlayerInfo[playerid][SpecID] != INVALID_PLAYER_ID)
- {
- for(new x=PlayerInfo[playerid][SpecID]-1; x>=0; x--)
- {
- if(x == 0) x = MAX_PLAYERS;
- if(IsPlayerConnected(x) && x != playerid)
- {
- if(GetPlayerState(x) == PLAYER_STATE_SPECTATING && PlayerInfo[x][SpecID] != INVALID_PLAYER_ID || (GetPlayerState(x) != 1 && GetPlayerState(x) != 2 && GetPlayerState(x) != 3))
- {
- continue;
- }
- else
- {
- StartSpectate(playerid, x);
- break;
- }
- }
- }
- }
- return 1;
- }
- #endif
- ShowPlayerVehicleSpawnDialog(playerid)
- {
- ShowPlayerDialog(playerid, VEHICLE_DIALOG, DIALOG_STYLE_LIST, "Vehicle Spawn", ""white"Airplanes\nHelicopters\nBikes\nConvertibles\nIndustrial\nLowriders\nOff Road\nPublic Service Vehicles\nSaloons\nSport Vehicles\nStation Wagons\nBoats\nTrailers\nUnique Vehicles\nRC Vehicles", "Select", "Cancel" );
- return 1;
- }
- CarSpawner(playerid,model)
- {
- new Float:x, Float:y, Float:z, Float:angle;
- GetPlayerPos(playerid, x, y, z);
- GetPlayerFacingAngle(playerid, angle);
- new vehicleid = CreateVehicle(model, x, y, z, angle, -1, -1, -1);
- PlayerInfo[playerid][Vehicle] = vehicleid;
- SetVehicleVirtualWorld(vehicleid, GetPlayerVirtualWorld(playerid));
- LinkVehicleToInterior(vehicleid, GetPlayerInterior(playerid));
- SetVehicleNumberPlate(PlayerInfo[playerid][Vehicle], "NG-Stunting");
- SetVehicleToRespawn(PlayerInfo[playerid][Vehicle]);
- PutPlayerInVehicle(playerid, vehicleid, 0);
- return 1;
- }
- //==============================================================================
- //------------------------------------------------------------------------------
- // Costum Publics
- //------------------------------------------------------------------------------
- //==============================================================================
- #if USE_OPC_DELAY == true
- public ExecCheckTimerForPlayer(playerid)
- {
- PlayerInfo[playerid][PingTimer] = SetTimerEx("CheckPlayerPing", PINGCHECK_TIME*1000, true, "d", playerid);
- return 1;
- }
- #endif
- public ConnectedPlayers()
- {
- new Connected;
- for(new i = 0; i < MAX_PLAYERS; i++) if(IsPlayerConnected(i)) Connected++;
- return Connected;
- }
- public Jail1(playerid)
- {
- TogglePlayerControllable(playerid,false);
- new Float:x, Float:y, Float:z;
- GetPlayerPos(playerid,x,y,z);
- SetPlayerCameraPos(playerid,x+10,y,z+10);
- SetPlayerCameraLookAt(playerid,x,y,z);
- SetTimerEx("Jail2",1000,0,"d",playerid);
- }
- public Jail2(playerid)
- {
- new Float:x, Float:y, Float:z;
- GetPlayerPos(playerid,x,y,z);
- SetPlayerCameraPos(playerid,x+7,y,z+5);
- SetPlayerCameraLookAt(playerid,x,y,z);
- if(GetPlayerState(playerid) == PLAYER_STATE_ONFOOT) SetPlayerSpecialAction(playerid,SPECIAL_ACTION_HANDSUP);
- GameTextForPlayer(playerid,"~r~Busted By Admins",3000,3);
- SetTimerEx("Jail3",1000,0,"d",playerid);
- }
- public Jail3(playerid)
- {
- new Float:x, Float:y, Float:z;
- GetPlayerPos(playerid,x,y,z);
- SetPlayerCameraPos(playerid,x+3,y,z);
- SetPlayerCameraLookAt(playerid,x,y,z);
- }
- public JailPlayer(playerid)
- {
- TogglePlayerControllable(playerid,true);
- SetPlayerPos(playerid,197.6661,173.8179,1003.0234);
- SetPlayerInterior(playerid,3);
- SetCameraBehindPlayer(playerid);
- PlayerInfo[playerid][JailTimer] = SetTimerEx("UnjailPlayer",PlayerInfo[playerid][JailTime],0,"d",playerid);
- PlayerInfo[playerid][Jailed] = true;
- }
- public UnjailPlayer(playerid)
- {
- KillTimer(PlayerInfo[playerid][JailTimer]);
- PlayerInfo[playerid][JailTime] = 0;
- PlayerInfo[playerid][Jailed] = false;
- SetPlayerInterior(playerid,0);
- SetPlayerPos(playerid, 0.0, 0.0, 0.0);
- SpawnPlayer(playerid);
- PlayerPlaySound(playerid,1057,0.0,0.0,0.0);
- GameTextForPlayer(playerid,"~g~Released ~n~From Jail",3000,3);
- }
- public unmute(playerid)
- {
- PlayerInfo[playerid][Muted] = false;
- PlayerInfo[playerid][MuteTimer] = -1;
- return 1;
- }
- public CheckPlayerPing(playerid)
- {
- #if IS_ADMIN_IMMUNE == true
- if(IsPlayerAdmin(playerid) || PlayerInfo[playerid][AdminLevel] >= 1)
- {
- KillTimer(PlayerInfo[playerid][PingTimer]); //killing the ping timer for the admin so that it will not check again for that player
- return 1; //returning 1 to close the function for the player
- }
- #endif
- if(GetPlayerPing(playerid) >= MAX_PING)
- {
- PlayerInfo[playerid][PingExceeds]++;
- if(PlayerInfo[playerid][PingExceeds] >= MAX_EXCEEDS)
- {
- #if SEND_MSG_BYKICK == true
- new string[128];
- format(string, sizeof(string), ""white"Info: "yellow"%s "white"has been kicked from the server. (Reason: High Ping: %d | Allowed %d)", GetName(playerid), GetPlayerPing(playerid), MAX_PING);
- SendClientMessageToAll(RED, string);
- #endif
- KillTimer(PlayerInfo[playerid][PingTimer]);
- #if PRINT_BYKICK == true
- printf("[PING KICK]: %s has been kicked (ping: %d)", GetName(playerid), GetPlayerPing(playerid));
- #endif
- Kick(playerid);
- }
- #if SEND_PMSG_BYEXCEED == true
- new pstring[128];
- format(pstring, sizeof(pstring), ""white"Info: Your ping exceeded the limit of %d |Your ping: %d|", MAX_PING, GetPlayerPing(playerid));
- SendClientMessage(playerid, RED, pstring);
- #endif
- #if SEND_ADM_BYEXCEED == true
- new string[128];
- format(string, sizeof(string), ""white"*** {FFE600}%s {FAFAFA}exceeded max ping limit of %d |Ping: %d|", GetName(playerid), MAX_PING, GetPlayerPing(playerid));
- for(new i=0; i <= MAX_PLAYERS; i++)
- {
- if(!IsPlayerConnected(i) || IsPlayerNPC(i)) continue;
- if(PlayerInfo[i][AdminLevel] >= 1)
- {
- SendClientMessage(i, RED, string);
- }
- }
- #endif
- }
- return 1;
- }
- public VIPMSG(color,const string[])
- {
- for(new i = 0; i < MAX_PLAYERS; i++)
- {
- if((IsPlayerNPC(i)) || (!IsPlayerConnected(i))) continue;
- if((PlayerInfo[i][VIPLevel] >= 1)) SendClientMessage(i, color, string);
- }
- return 1;
- }
- public AdminMSG(color,const string[])
- {
- for(new i = 0; i < MAX_PLAYERS; i++)
- {
- if((IsPlayerNPC(i)) || (!IsPlayerConnected(i))) continue;
- if((PlayerInfo[i][AdminLevel] >= 1)) SendClientMessage(i, color, string);
- }
- return 1;
- }
- #if USE_RANDOM_MSGS == true
- public RandomClientMessage()
- {
- new randommsg = random(sizeof(RandomMessages));
- SendClientMessageToAll(BLUE, RandomMessages[randommsg]);
- return 1;
- }
- #endif
Advertisement
Add Comment
Please, Sign In to add comment