Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <a_samp>
- #include <core>
- #include <float>
- #include <dprop>
- #include <vstream>
- #include <float>
- #include <time>
- #include <dini>
- #include "../include/gl_common.inc"
- //#include "../include/gl_spawns.inc"
- #pragma tabsize 0
- //----------------------------------------------------------
- #define COLOR_WHITE 0xFFFFFFFF
- #define COLOR_NORMAL_PLAYER 0xFF4444FF
- #define CITY_LOS_SANTOS 0
- #define CITY_SAN_FIERRO 1
- #define CITY_LAS_VENTURAS 2
- // Class selection globals
- new gPlayerCitySelection[MAX_PLAYERS];
- new gPlayerHasCitySelected[MAX_PLAYERS];
- new gPlayerLastCitySelectionTick[MAX_PLAYERS];
- new Text:txtClassSelHelper;
- new Text:txtLosSantos;
- new Text:txtSanFierro;
- new Text:txtLasVenturas;
- #define LOGINMENU 3
- #define FIGHTMENU 4
- #define BRITISH_GENERAL 5
- #define BRITISH_SOLDIER 6
- #define BRITISH_MEDIC 7
- #define TEAM_BRITISH 8
- #define FRANCE_GENERAL 9
- #define FRANCE_SOLDIER 10
- #define FRANCE_MEDIC 11
- #define TEAM_FRANCE 12
- #define COLOR_GREY 0xAFAFAFAA
- #define COLOR_RED 0xAA3333AA
- #define COLOR_YELLOW 0xFFFF00AA
- #define COLOR_BLUE 0x0000BBAA
- #define COLOR_DARKRED 0x660000AA
- #define COLOR_ORANGE 0xFF9900AA
- #define COLOR_BRIGHTRED 0xFF0000AA
- #define COLOR_INDIGO 0x4B00B0AA
- #define COLOR_VIOLET 0x9955DEEE
- #define COLOR_LIGHTRED 0xFF99AADD
- #define COLOR_SEAGREEN 0x00EEADDF
- #define COLOR_GRAYWHITE 0xEEEEFFC4
- #define COLOR_LIGHTNEUTRALBLUE 0xabcdef66
- #define COLOR_GREENISHGOLD 0xCCFFDD56
- #define COLOR_LIGHTBLUEGREEN 0x0FFDD349
- #define COLOR_NEUTRALBLUE 0xABCDEF01
- #define COLOR_LIGHTCYAN 0xAAFFCC33
- #define COLOR_LEMON 0xDDDD2357
- #define COLOR_MEDIUMBLUE 0x63AFF00A
- #define COLOR_NEUTRAL 0xABCDEF97
- #define COLOR_BLACK 0x00000000
- #define COLOR_NEUTRALGREEN 0x81CFAB00
- #define COLOR_DARKGREEN 0x12900BBF
- #define COLOR_DARKBLUE 0x300FFAAB
- #define COLOR_BLUEGREEN 0x46BBAA00
- #define COLOR_DARKRED 0x660000AA
- #define COLOR_ORANGE 0xFF9900AA
- #define COLOR_PURPLE 0x800080AA
- #define COLOR_GRAD1 0xB4B5B7FF
- #define COLOR_GRAD2 0xBFC0C2FF
- #define COLOR_RED1 0xFF0000AA
- #define COLOR_GREY 0xAFAFAFAA
- #define COLOR_GREEN 0x33AA33AA
- #define COLOR_RED 0xAA3333AA
- #define COLOR_YELLOW 0xFFFF00AA
- #define COLOR_CYAN 0x99FFFFAA
- #define COLOR_TAN 0xFFFFCCAA
- #define COLOR_KHAKI 0x999900AA
- #define COLOR_LIME 0x99FF00AA
- #define COLOR_SYSTEM 0xEFEFF7AA
- #define COLOR_GRAD2 0xBFC0C2FF
- #define COLOR_GRAD4 0xD8D8D8FF
- #define COLOR_GRAD6 0xF0F0F0FF
- #define COLOR_GRAD2 0xBFC0C2FF
- #define COLOR_GRAD3 0xCBCCCEFF
- #define COLOR_GRAD5 0xE3E3E3FF
- #define COLOR_GRAD1 0xB4B5B7FF
- #define ADMIN_RED 0xFB0000FF
- #define YELLOW 0xFFFF00FF
- #define ORANGE 0xF97804FF
- #define LIGHTRED 0xFF8080FF
- #define LIGHTBLUE 0x00C2ECFF
- #define PURPLE 0xB360FDFF
- #define LIGHTGREEN 0x38FF06FF
- #define DARKPINK 0xE100E1FF
- #define NICESKY 0x99FFFFAA
- #define GRAY 0xCECECEFF
- #define NONE 0xFFFFFF00
- #define COLOR_GREEN 0x33AA33AA
- #define COLOR_PURPLE 0x800080AA
- #define COLOR_DARKRED 0x660000AA
- #define COLOR_YELLOW 0xFFFF00AA
- #define COLOR_BLUE 0x0000BBAA
- #define COLOR_ORANGE 0xFF9900AA
- #define COLOR_DARKBROWN 0x80400096
- #define COLOR_GOLD 0xB8860BAA
- #define red 0xFF0000AA
- #define Skater_grey 0x7F7F7FDE
- #define Worker_green 0x096616DB
- #define ProxDetector
- #define COLOR_RED 0xAA3333AA
- #define COLOR_AQUA 0xF0F8FFAA
- #define COLOR_SPRINGGREEN 0x00FF7FAA
- #define COLOR_GREY 0xAFAFAFAA
- #define ADMIN_RED 0xFB0000FF
- #define YELLOW 0xFFFF00FF
- #define ORANGE 0xF97804FF
- #define LIGHTRED 0xFF8080FF
- #define LIGHTBLUE 0x00C2ECFF
- #define PURPLE 0xB360FDFF
- #define LIGHTGREEN 0x38FF06FF
- #define DARKPINK 0xE100E1FF
- #define NICESKY 0x99FFFFAA
- #define GRAY 0xCECECEFF
- #define NONE 0xFFFFFF00
- #pragma unused ret_memcpy
- #define MAX_TEAMKILLS_FORJAIL 2
- #define MAX_TEAMKILLS 3
- #define JAIL_TIME 300000
- new gPlayerClass[MAX_PLAYERS];
- forward OnPlayerRegister(playerid, password[]);
- forward OnPlayerLogin(playerid,password[]);
- forward PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z);
- forward Bomb();
- forward ArmyCap(playerid);
- forward IraqCap(playerid);
- forward Encrypt(string[]);
- forward SetPlayerRandomSpawn(playerid);
- forward Stats(playerid,targetid);
- forward ini_GetValue( line[] );
- forward ini_GetKey( line[] );
- forward SaveStats(playerid);
- forward ArmyTimer();
- new VehicleNames[][] =
- {
- "Landstalker", "Bravura", "Buffalo", "Linerunner", "Perrenial", "Sentinel", "Dumper", "Firetruck", "Trashmaster",
- "Stretch", "Manana", "Infernus", "Voodoo", "Pony", "Mule", "Cheetah", "Ambulance", "Leviathan", "Moonbeam",
- "Esperanto", "Taxi", "Washington", "Bobcat", "Whoopee", "BF Injection", "Hunter", "Premier", "Enforcer",
- "Securicar", "Banshee", "Predator", "Bus", "Rhino", "Barracks", "Hotknife", "Trailer", "Previon", "Coach",
- "Cabbie", "Stallion", "Rumpo", "RC Bandit", "Romero", "Packer", "Monster", "Admiral", "Squalo", "Seasparrow",
- "Pizzaboy", "Tram", "Trailer", "Turismo", "Speeder", "Reefer", "Tropic", "Flatbed", "Yankee", "Caddy", "Solair",
- "Berkley's RC Van", "Skimmer", "PCJ-600", "Faggio", "Freeway", "RC Baron", "RC Raider", "Glendale", "Oceanic",
- "Sanchez", "Sparrow", "Patriot", "Quad", "Coastguard", "Dinghy", "Hermes", "Sabre", "Rustler", "ZR-350", "Walton",
- "Regina", "Comet", "BMX", "Burrito", "Camper", "Marquis", "Baggage", "Dozer", "Maverick", "News Chopper", "Rancher",
- "FBI Rancher", "Virgo", "Greenwood", "Jetmax", "Hotring", "Sandking", "Blista Compact", "Police Maverick",
- "Boxvillde", "Benson", "Mesa", "RC Goblin", "Hotring Racer A", "Hotring Racer B", "Bloodring Banger", "Rancher",
- "Super GT", "Elegant", "Journey", "Bike", "Mountain Bike", "Beagle", "Cropduster", "Stunt", "Tanker", "Roadtrain",
- "Nebula", "Majestic", "Buccaneer", "Shamal", "Hydra", "FCR-900", "NRG-500", "HPV1000", "Cement Truck", "Tow Truck",
- "Fortune", "Cadrona", "FBI Truck", "Willard", "Forklift", "Tractor", "Combine", "Feltzer", "Remington", "Slamvan",
- "Blade", "Freight", "Streak", "Vortex", "Vincent", "Bullet", "Clover", "Sadler", "Firetruck", "Hustler", "Intruder",
- "Primo", "Cargobob", "Tampa", "Sunrise", "Merit", "Utility", "Nevada", "Yosemite", "Windsor", "Monster", "Monster",
- "Uranus", "Jester", "Sultan", "Stratum", "Elegy", "Raindance", "RC Tiger", "Flash", "Tahoma", "Savanna", "Bandito",
- "Freight Flat", "Streak Carriage", "Kart", "Mower", "Dune", "Sweeper", "Broadway", "Tornado", "AT-400", "DFT-30",
- "Huntley", "Stafford", "BF-400", "News Van", "Tug", "Trailer", "Emperor", "Wayfarer", "Euros", "Hotdog", "Club",
- "Freight Box", "Trailer", "Andromada", "Dodo", "RC Cam", "Launch", "Police Car", "Police Car", "Police Car",
- "Police Ranger", "Picador", "S.W.A.T", "Alpha", "Phoenix", "Glendale", "Sadler", "Luggage", "Luggage", "Stairs",
- "Boxville", "Tiller", "Utility Trailer"
- };
- new Text:CreatorTextDraw;
- enum pInfo
- {
- pKills,// Kills
- pTeam, // Team Captures
- pJoins, // When someone rejoins, it will +1
- pKey,
- pDeaths // Deaths
- };
- new PlayerInfo[MAX_PLAYERS][pInfo];
- new gPlayerAccount[MAX_PLAYERS];
- #pragma dynamic 8192
- #pragma tabsize 0
- #define SLOTS 200
- #define MAX_PLAYERS_ 40
- #define COLOR_TEAMORANGE 0xFF990078
- #define COLOR_TEAMRED 0xAA33336E
- #define COLOR_TEAMBLUE 0x006BD774
- #define COLOR_TEAMYELLOW 0xFFFF0085
- #define COLOR_TEAMGREEN 0x33AA3372
- #define COLOR_DEADCONNECT 0x808080AA
- #define COLOR_LIGHTGREEN 0xAAD36B96
- #define COLOR_LIGHTBLUE 0x46C2FF96
- #define COLOR_BROWN 0xBAAA5096
- #define COLOR_ERROR 0xD2691EAA
- #define COLOR_CCTV 0x6D925C96
- #define COLOR_CUSTARD 0xF3D15C96
- #define COLOR_PINK 0xF94F9B96
- new rannum;
- new rGun;
- new rAmmo;
- new Text:Forum2;
- new players = 0;
- new gTeam[MAX_PLAYERS];
- forward Players1();
- forward Float:GetDistanceBetweenPlayers(p1,p2);
- forward GMX();
- forward update_zones(playerid);
- forward AdvertMsg();
- forward RanNumTimer();
- new AdvertMessage[13][100] = // [5] = amount of messages, [100] = amount of characters to give
- {
- {"*>> ss"},
- {"*>> If you belive someone is hacking or breaking the rules. Use /report"},
- {"*>> s"},
- {"*>> s"},
- {"*>> s!"},
- {"*>> Need help? Ask the Admins!"},
- {"*>> Having fun here? Visit our forums s"},
- {"*>> s"},
- {"*>> Rule: Hacking / Cheating is not allowed and equals in a instant ban"},
- {"*>> Rule: Racial Comments against other users is a ban!"},
- {"*>> s"},
- {"*>> s"},
- {"*>> s."}
- };
- // ZONES
- enum zoneinfo {
- zone_name[27],
- Float:zone_minx,
- Float:zone_miny,
- Float:zone_minz,
- Float:zone_maxx,
- Float:zone_maxy,
- Float:zone_maxz
- }
- new Float:zones[][zoneinfo] = {
- { "France", -1213.90, -2892.90, -242.90, 44.60, -768.00, 900.00},
- { "British", -2997.40, -2892.90, -242.90, -1213.90, -1115.50, 900.00}};
- new zoneupdates[MAX_PLAYERS_];
- new player_zone[MAX_PLAYERS_];
- new zoneupdate;
- public update_zones() {
- new line1[10];
- new line2[10];
- for(new i=0; i<MAX_PLAYERS_; i++) {
- if(IsPlayerConnected(i) && zoneupdates[i] == 1) {
- if(IsPlayerInZone(i,player_zone[i])) { }
- else {
- new player_zone_before;
- player_zone_before = player_zone[i];
- player_zone[i] = -1;
- for(new j=0; j<sizeof(zones);j++) {
- if(IsPlayerInZone(i,j) && player_zone[i] == -1) {
- if(player_zone_before == -1) GameTextForPlayer(i,zones[j][zone_name],1500,1);
- else if(strcmp(zones[j][zone_name],zones[player_zone_before][zone_name],true) != 0) GameTextForPlayer(i,zones[j][zone_name],1500,1);
- player_zone[i] = j;
- format(line1,10,"p%dzone",i);
- format(line2,10,"%d",j);
- PropertySet(line1,line2);
- }
- }
- if(player_zone[i] == -1) player_zone[i] = player_zone_before;
- }
- }
- }
- }
- IsPlayerInZone(playerid, zoneid) {
- if(zoneid == -1) return 0;
- new Float:x, Float:y, Float:z;
- GetPlayerPos(playerid,x,y,z);
- if(x >= zones[zoneid][zone_minx] && x < zones[zoneid][zone_maxx]
- && y >= zones[zoneid][zone_miny] && y < zones[zoneid][zone_maxy]
- && z >= zones[zoneid][zone_minz] && z < zones[zoneid][zone_maxz]
- && z < 900.0) return 1;
- return 0;
- }
- #if defined GAMEMODE
- #else
- #endif
- //----------------------------------------------------------
- /*
- public OnPlayerConnect(playerid)
- {
- GameTextForPlayer(playerid,"~w~Grand Larceny",3000,4);
- SendClientMessage(playerid,COLOR_WHITE,"Welcome to Grand Larceny");
- // class selection init vars
- gPlayerCitySelection[playerid] = -1;
- gPlayerHasCitySelected[playerid] = 0;
- gPlayerLastCitySelectionTick[playerid] = GetTickCount();
- //SetPlayerColor(playerid,COLOR_NORMAL_PLAYER);
- return 1;
- }
- */
- //----------------------------------------------------------
- /*
- public OnPlayerSpawn(playerid)
- {
- if(IsPlayerNPC(playerid)) return 1;
- new randSpawn = 0;
- SetPlayerInterior(playerid,0);
- TogglePlayerClock(playerid,0);
- ResetPlayerMoney(playerid);
- GivePlayerMoney(playerid, 30000);
- // if they ever return to class selection make them city
- // select again first
- gPlayerHasCitySelected[playerid] = 0;
- if(CITY_LOS_SANTOS == gPlayerCitySelection[playerid]) {
- randSpawn = random(sizeof(gRandomSpawns_LosSantos));
- SetPlayerPos(playerid,
- gRandomSpawns_LosSantos[randSpawn][0],
- gRandomSpawns_LosSantos[randSpawn][1],
- gRandomSpawns_LosSantos[randSpawn][2]);
- SetPlayerFacingAngle(playerid,gRandomSpawns_LosSantos[randSpawn][3]);
- }
- else if(CITY_SAN_FIERRO == gPlayerCitySelection[playerid]) {
- randSpawn = random(sizeof(gRandomSpawns_SanFierro));
- SetPlayerPos(playerid,
- gRandomSpawns_SanFierro[randSpawn][0],
- gRandomSpawns_SanFierro[randSpawn][1],
- gRandomSpawns_SanFierro[randSpawn][2]);
- SetPlayerFacingAngle(playerid,gRandomSpawns_SanFierro[randSpawn][3]);
- }
- else if(CITY_LAS_VENTURAS == gPlayerCitySelection[playerid]) {
- randSpawn = random(sizeof(gRandomSpawns_LasVenturas));
- SetPlayerPos(playerid,
- gRandomSpawns_LasVenturas[randSpawn][0],
- gRandomSpawns_LasVenturas[randSpawn][1],
- gRandomSpawns_LasVenturas[randSpawn][2]);
- SetPlayerFacingAngle(playerid,gRandomSpawns_LasVenturas[randSpawn][3]);
- }
- //SetPlayerColor(playerid,COLOR_NORMAL_PLAYER);
- SetPlayerSkillLevel(playerid,WEAPONSKILL_PISTOL,200);
- SetPlayerSkillLevel(playerid,WEAPONSKILL_PISTOL_SILENCED,200);
- SetPlayerSkillLevel(playerid,WEAPONSKILL_DESERT_EAGLE,200);
- SetPlayerSkillLevel(playerid,WEAPONSKILL_SHOTGUN,200);
- SetPlayerSkillLevel(playerid,WEAPONSKILL_SAWNOFF_SHOTGUN,200);
- SetPlayerSkillLevel(playerid,WEAPONSKILL_SPAS12_SHOTGUN,200);
- SetPlayerSkillLevel(playerid,WEAPONSKILL_MICRO_UZI,200);
- SetPlayerSkillLevel(playerid,WEAPONSKILL_MP5,200);
- SetPlayerSkillLevel(playerid,WEAPONSKILL_AK47,200);
- SetPlayerSkillLevel(playerid,WEAPONSKILL_M4,200);
- SetPlayerSkillLevel(playerid,WEAPONSKILL_SNIPERRIFLE,200);
- GivePlayerWeapon(playerid,WEAPON_COLT45,100);
- //GivePlayerWeapon(playerid,WEAPON_MP5,100);
- //TogglePlayerClock(playerid, 1);
- return 1;
- }
- */
- //----------------------------------------------------------
- /*
- public OnPlayerDeath(playerid, killerid, reason)
- {
- new playercash;
- if(killerid == INVALID_PLAYER_ID) {
- ResetPlayerMoney(playerid);
- } else {
- playercash = GetPlayerMoney(playerid);
- if(playercash > 0) {
- GivePlayerMoney(killerid, playercash);
- ResetPlayerMoney(playerid);
- }
- }
- return 1;
- }
- */
- //----------------------------------------------------------
- ClassSel_SetupCharSelection(playerid)
- {
- if(gPlayerCitySelection[playerid] == CITY_LOS_SANTOS) {
- SetPlayerInterior(playerid,11);
- SetPlayerPos(playerid,508.7362,-87.4335,998.9609);
- SetPlayerFacingAngle(playerid,0.0);
- SetPlayerCameraPos(playerid,508.7362,-83.4335,998.9609);
- SetPlayerCameraLookAt(playerid,508.7362,-87.4335,998.9609);
- }
- else if(gPlayerCitySelection[playerid] == CITY_SAN_FIERRO) {
- SetPlayerInterior(playerid,3);
- SetPlayerPos(playerid,-2673.8381,1399.7424,918.3516);
- SetPlayerFacingAngle(playerid,181.0);
- SetPlayerCameraPos(playerid,-2673.2776,1394.3859,918.3516);
- SetPlayerCameraLookAt(playerid,-2673.8381,1399.7424,918.3516);
- }
- else if(gPlayerCitySelection[playerid] == CITY_LAS_VENTURAS) {
- SetPlayerInterior(playerid,3);
- SetPlayerPos(playerid,349.0453,193.2271,1014.1797);
- SetPlayerFacingAngle(playerid,286.25);
- SetPlayerCameraPos(playerid,352.9164,194.5702,1014.1875);
- SetPlayerCameraLookAt(playerid,349.0453,193.2271,1014.1797);
- }
- }
- //----------------------------------------------------------
- // Used to init textdraws of city names
- ClassSel_InitCityNameText(Text:txtInit)
- {
- TextDrawUseBox(txtInit, 0);
- TextDrawLetterSize(txtInit,1.25,3.0);
- TextDrawFont(txtInit, 0);
- TextDrawSetShadow(txtInit,0);
- TextDrawSetOutline(txtInit,1);
- TextDrawColor(txtInit,0xEEEEEEFF);
- TextDrawBackgroundColor(txtClassSelHelper,0x000000FF);
- }
- //----------------------------------------------------------
- ClassSel_InitTextDraws()
- {
- // Init our observer helper text display
- txtLosSantos = TextDrawCreate(10.0, 380.0, "Los Santos");
- ClassSel_InitCityNameText(txtLosSantos);
- txtSanFierro = TextDrawCreate(10.0, 380.0, "San Fierro");
- ClassSel_InitCityNameText(txtSanFierro);
- txtLasVenturas = TextDrawCreate(10.0, 380.0, "Las Venturas");
- ClassSel_InitCityNameText(txtLasVenturas);
- // Init our observer helper text display
- txtClassSelHelper = TextDrawCreate(10.0, 415.0,
- " Press ~b~~k~~GO_LEFT~ ~w~or ~b~~k~~GO_RIGHT~ ~w~to switch cities.~n~ Press ~r~~k~~PED_FIREWEAPON~ ~w~to select.");
- TextDrawUseBox(txtClassSelHelper, 1);
- TextDrawBoxColor(txtClassSelHelper,0x222222BB);
- TextDrawLetterSize(txtClassSelHelper,0.3,1.0);
- TextDrawTextSize(txtClassSelHelper,400.0,40.0);
- TextDrawFont(txtClassSelHelper, 2);
- TextDrawSetShadow(txtClassSelHelper,0);
- TextDrawSetOutline(txtClassSelHelper,1);
- TextDrawBackgroundColor(txtClassSelHelper,0x000000FF);
- TextDrawColor(txtClassSelHelper,0xFFFFFFFF);
- }
- //----------------------------------------------------------
- ClassSel_SetupSelectedCity(playerid)
- {
- if(gPlayerCitySelection[playerid] == -1) {
- gPlayerCitySelection[playerid] = CITY_LOS_SANTOS;
- }
- if(gPlayerCitySelection[playerid] == CITY_LOS_SANTOS) {
- SetPlayerInterior(playerid,0);
- SetPlayerCameraPos(playerid,1630.6136,-2286.0298,110.0);
- SetPlayerCameraLookAt(playerid,1887.6034,-1682.1442,47.6167);
- TextDrawShowForPlayer(playerid,txtLosSantos);
- TextDrawHideForPlayer(playerid,txtSanFierro);
- TextDrawHideForPlayer(playerid,txtLasVenturas);
- }
- else if(gPlayerCitySelection[playerid] == CITY_SAN_FIERRO) {
- SetPlayerInterior(playerid,0);
- SetPlayerCameraPos(playerid,-1300.8754,68.0546,129.4823);
- SetPlayerCameraLookAt(playerid,-1817.9412,769.3878,132.6589);
- TextDrawHideForPlayer(playerid,txtLosSantos);
- TextDrawShowForPlayer(playerid,txtSanFierro);
- TextDrawHideForPlayer(playerid,txtLasVenturas);
- }
- else if(gPlayerCitySelection[playerid] == CITY_LAS_VENTURAS) {
- SetPlayerInterior(playerid,0);
- SetPlayerCameraPos(playerid,1310.6155,1675.9182,110.7390);
- SetPlayerCameraLookAt(playerid,2285.2944,1919.3756,68.2275);
- TextDrawHideForPlayer(playerid,txtLosSantos);
- TextDrawHideForPlayer(playerid,txtSanFierro);
- TextDrawShowForPlayer(playerid,txtLasVenturas);
- }
- }
- //----------------------------------------------------------
- ClassSel_SwitchToNextCity(playerid)
- {
- gPlayerCitySelection[playerid]++;
- if(gPlayerCitySelection[playerid] > CITY_LAS_VENTURAS) {
- gPlayerCitySelection[playerid] = CITY_LOS_SANTOS;
- }
- PlayerPlaySound(playerid,1052,0.0,0.0,0.0);
- gPlayerLastCitySelectionTick[playerid] = GetTickCount();
- ClassSel_SetupSelectedCity(playerid);
- }
- //----------------------------------------------------------
- ClassSel_SwitchToPreviousCity(playerid)
- {
- gPlayerCitySelection[playerid]--;
- if(gPlayerCitySelection[playerid] < CITY_LOS_SANTOS) {
- gPlayerCitySelection[playerid] = CITY_LAS_VENTURAS;
- }
- PlayerPlaySound(playerid,1053,0.0,0.0,0.0);
- gPlayerLastCitySelectionTick[playerid] = GetTickCount();
- ClassSel_SetupSelectedCity(playerid);
- }
- //----------------------------------------------------------
- ClassSel_HandleCitySelection(playerid)
- {
- new Keys,ud,lr;
- GetPlayerKeys(playerid,Keys,ud,lr);
- if(gPlayerCitySelection[playerid] == -1) {
- ClassSel_SwitchToNextCity(playerid);
- return;
- }
- // only allow new selection every ~500 ms
- if( (GetTickCount() - gPlayerLastCitySelectionTick[playerid]) < 500 ) return;
- if(Keys & KEY_FIRE) {
- gPlayerHasCitySelected[playerid] = 1;
- TextDrawHideForPlayer(playerid,txtClassSelHelper);
- TextDrawHideForPlayer(playerid,txtLosSantos);
- TextDrawHideForPlayer(playerid,txtSanFierro);
- TextDrawHideForPlayer(playerid,txtLasVenturas);
- TogglePlayerSpectating(playerid,0);
- return;
- }
- if(lr > 0) {
- ClassSel_SwitchToNextCity(playerid);
- }
- else if(lr < 0) {
- ClassSel_SwitchToPreviousCity(playerid);
- }
- }
- //----------------------------------------------------------
- /*
- public OnPlayerRequestClass(playerid, classid)
- {
- if(IsPlayerNPC(playerid)) return 1;
- if(gPlayerHasCitySelected[playerid]) {
- ClassSel_SetupCharSelection(playerid);
- return 1;
- } else {
- if(GetPlayerState(playerid) != PLAYER_STATE_SPECTATING) {
- TogglePlayerSpectating(playerid,1);
- TextDrawShowForPlayer(playerid, txtClassSelHelper);
- gPlayerCitySelection[playerid] = -1;
- }
- }
- return 0;
- }
- */
- //----------------------------------------------------------
- /*
- public OnGameModeInit()
- {
- ShowNameTags(1);
- SetNameTagDrawDistance(40.0);
- EnableStuntBonusForAll(0);
- DisableInteriorEnterExits();
- SetWeather(2);
- //LimitGlobalChatRadius(300.0);
- ClassSel_InitTextDraws();
- // Player Class
- return 1;
- }*/
- //----------------------------------------------------------
- /*
- public OnPlayerUpdate(playerid)
- {
- if(!IsPlayerConnected(playerid)) return 0;
- // changing cities by inputs
- if( !gPlayerHasCitySelected[playerid] &&
- GetPlayerState(playerid) == PLAYER_STATE_SPECTATING ) {
- ClassSel_HandleCitySelection(playerid);
- return 1;
- }
- // No weapons in interiors
- if(GetPlayerInterior(playerid) != 0 && GetPlayerWeapon(playerid) != 0) {
- SetPlayerArmedWeapon(playerid,0); // fists
- return 0; // no syncing until they change their weapon
- }
- // Don't allow minigun
- if(GetPlayerWeapon(playerid) == WEAPON_MINIGUN) {
- Kick(playerid);
- return 0;
- }
- // No jetpacks allowed
- if(GetPlayerSpecialAction(playerid) == SPECIAL_ACTION_USEJETPACK) {
- Kick(playerid);
- return 0;
- }
- return 1;
- }*/
- public OnVehicleSpawn(vehicleid)
- {
- tAxI_OnVehicleSpawn(vehicleid);
- return 1;
- }
- public OnVehicleDeath(vehicleid, killerid)
- {
- tAxI_OnVehicleDeath(vehicleid);
- return 1;
- }
- public Players1()
- {
- for(new x; x < GetMaxPlayers(); x++)
- {
- if(IsPlayerConnected(x))
- {
- new string[128];
- format(string,sizeof(string),"",players,GetMaxPlayers());
- TextDrawSetString(Forum2,string);
- TextDrawShowForPlayer(x,Forum2);
- }
- }
- }
- stock CheckPing(playerid)
- {
- new ping = GetPlayerPing(playerid);
- if(ping > 750)
- {
- Kick(playerid);
- SendClientMessage(playerid,COLOR_PINK, "*[Kick] You have been kicked because your ping exeeds the limit of [750] (Kick To Prevent Lag)");
- }
- }
- public GMX()
- {
- SendRconCommand("gmx");
- return 1;
- }
- public OnPlayerText(playerid, text[])
- {
- if(rannum > 0)
- {
- if(strval(text) == rannum) // or you can use strcmp i guess
- {
- new name[MAX_PLAYER_NAME], string[128];
- new weaponName[65];
- new weapon = GetWeaponName(rGun, weaponName, 64);
- GetPlayerName(playerid, name, sizeof(name));
- format(string, sizeof(string), "Congratulations %s for winning a %s in the reaction test!", name,weapon);
- SendClientMessageToAll(COLOR_TEAMYELLOW, string);
- GivePlayerWeapon(playerid, rGun, 100);
- SetPlayerAmmo(playerid,rGun,rAmmo);
- rannum = 0;
- return 0;
- }
- }
- if(text[0] == '*' && IsPlayerAdmin(playerid)) //This will only work for RCON admins
- {
- GameTextForAll(text[1], 5000, 0);
- return false;
- }
- if(text[0] == '!')
- {
- new string[128]; GetPlayerName(playerid, string, sizeof(string));
- format(string, sizeof(string), "[*May Day!] %s: %s", string, text[1]);
- printf("%s", string);
- if(gTeam[playerid] == FRANCE_GENERAL || gTeam[playerid] == FRANCE_SOLDIER || gTeam[playerid] == FRANCE_MEDIC)
- {
- for(new i; i<MAX_PLAYERS; i++)
- {
- if(IsPlayerConnected(i))
- {
- if(gTeam[i] == FRANCE_GENERAL || gTeam[i] == FRANCE_SOLDIER || gTeam[i] == FRANCE_MEDIC)
- {
- SendClientMessage(i,COLOR_GREEN, string);
- }
- }
- }
- }
- if(gTeam[playerid] == BRITISH_GENERAL || gTeam[playerid] == BRITISH_SOLDIER || gTeam[playerid] == BRITISH_MEDIC)
- {
- for(new i; i<MAX_PLAYERS; i++)
- {
- if(IsPlayerConnected(i))
- {
- if(gTeam[i] == BRITISH_GENERAL || gTeam[i] == BRITISH_SOLDIER || gTeam[i] == BRITISH_MEDIC)
- {
- SendClientMessage(i,COLOR_GREEN, string);
- }
- }
- }
- }
- return 0;
- }
- return 1;
- }
- public Float:GetDistanceBetweenPlayers(p1,p2){
- new Float:x1,Float:y1,Float:z1,Float:x2,Float:y2,Float:z2;
- if (!IsPlayerConnected(p1) || !IsPlayerConnected(p2)){
- return -1.00;
- }
- GetPlayerPos(p1,x1,y1,z1);
- GetPlayerPos(p2,x2,y2,z2);
- return floatsqroot(floatpower(floatabs(floatsub(x2,x1)),2)+floatpower(floatabs(floatsub(y2,y1)),2)+floatpower(floatabs(floatsub(z2,z1)),2));
- }
- public AdvertMsg() return SendClientMessageToAll(COLOR_LIGHTBLUE, AdvertMessage[random(sizeof(AdvertMessage))][0]);
- randarg(...) { return getarg(random(numargs())); }
- public RanNumTimer()
- {
- new string[128];
- rannum = random(999999) + 100000;
- rGun=randarg(14, 16, 24, 26, 27, 34, 35, 37, 38, 42);
- rAmmo= random(150);
- new weaponName[65];
- new weapon = GetWeaponName(rGun, weaponName, 64);
- format(string, sizeof(string), "Are you fast?! First to type %d wins %s with %d ammo", rannum,weapon,rAmmo);
- SendClientMessageToAll(COLOR_TEAMYELLOW, string);
- }
- main()
- {
- print("|_______________________________|");
- print(" lol server");
- print("|_______________________________|");
- }
- public OnGameModeInit()
- {
- SetTimer("ArmyTimer", 8000, 1);
- tAxI_OnGameModeInit();
- AllowInteriorWeapons(1);
- UsePlayerPedAnims();
- ShowPlayerMarkers(PLAYER_MARKERS_MODE_GLOBAL);
- ShowNameTags(1);
- SetNameTagDrawDistance(40.0);
- EnableStuntBonusForAll(0);
- DisableInteriorEnterExits();
- SetWeather(2);
- //LimitGlobalChatRadius(300.0);
- ClassSel_InitTextDraws();
- SetGameModeText("lol");
- //================================== [0 British General ] ===================================================================
- AddPlayerClass(68,1787.853,-1365.913,15.75781,90, 7, 500, 33, 250, 24, 250);
- //================================== [1 British sodlier] ====================================================================
- AddPlayerClass(61,863.4913,-1638.3412,14.9521,176.9822, 8, 500, 33, 25, 32, 250);
- //================================== [2 British medic] ====================================================================
- AddPlayerClass(287,863.4913,-1638.3412,14.9521,176.9822, 8, 500, 33, 25, 32, 250);
- //================================== [3 France general ] ===================================================================
- AddPlayerClass(68,1787.853,-1365.913,15.75781,90, 7, 500, 33, 250, 24, 250);
- //================================== [4 France soldier] ====================================================================
- AddPlayerClass(61,863.4913,-1638.3412,14.9521,176.9822, 8, 500, 33, 25, 32, 250);
- //================================== [5 France medic] ====================================================================
- AddPlayerClass(287,863.4913,-1638.3412,14.9521,176.9822, 8, 500, 33, 25, 32, 250);
- return 1;
- }
- public OnPlayerUpdate(playerid)
- {
- if(!IsPlayerConnected(playerid)) return 0;
- // changing cities by inputs
- if( !gPlayerHasCitySelected[playerid] &&
- GetPlayerState(playerid) == PLAYER_STATE_SPECTATING ) {
- ClassSel_HandleCitySelection(playerid);
- return 1;
- }
- // No weapons in interiors
- if(GetPlayerInterior(playerid) != 0 && GetPlayerWeapon(playerid) != 0) {
- SetPlayerArmedWeapon(playerid,0); // fists
- return 0; // no syncing until they change their weapon
- }
- // Don't allow minigun
- if(GetPlayerWeapon(playerid) == WEAPON_MINIGUN) {
- Kick(playerid);
- return 0;
- }
- // No jetpacks allowed
- if(GetPlayerSpecialAction(playerid) == SPECIAL_ACTION_USEJETPACK) {
- Kick(playerid);
- return 0;
- }
- return 1;
- }
- public OnPlayerRequestClass(playerid, classid)
- {
- if(IsPlayerNPC(playerid)) return 1;
- if(gPlayerHasCitySelected[playerid]) {
- ClassSel_SetupCharSelection(playerid);
- return 1;
- } else {
- if(GetPlayerState(playerid) != PLAYER_STATE_SPECTATING) {
- TogglePlayerSpectating(playerid,1);
- TextDrawShowForPlayer(playerid, txtClassSelHelper);
- gPlayerCitySelection[playerid] = -1;
- }
- }
- gPlayerClass[playerid] = classid;
- switch (classid) {
- case 0:
- {
- GameTextForPlayer(playerid, "~w~General", 500, 6);
- {SetPlayerPos(playerid,354.4405,2030.4860,23.8750);
- SetPlayerFacingAngle(playerid, 357.3909);
- SetPlayerCameraPos(playerid, 354.4252,2032.4153,24.0223);
- SetPlayerCameraLookAt(playerid, 354.4405,2030.4860,23.8750);
- gTeam[playerid] = BRITISH_GENERAL;
- CreateExplosion(354.4405,2030.4860,23.8750, 12, 2); }
- }
- case 1:
- {
- GameTextForPlayer(playerid, "~w~Soldier", 500, 6);
- {SetPlayerPos(playerid,354.4405,2030.4860,23.8750);
- SetPlayerFacingAngle(playerid, 357.3909);
- SetPlayerCameraPos(playerid, 354.4252,2032.4153,24.0223);
- SetPlayerCameraLookAt(playerid, 354.4405,2030.4860,23.8750);
- gTeam[playerid] = BRITISH_SOLDIER;
- CreateExplosion(354.4405,2030.4860,23.8750, 12, 2);}
- }
- case 2:
- {
- GameTextForPlayer(playerid, "~w~British Army Soldier", 500, 6);
- {SetPlayerPos(playerid,354.4405,2030.4860,23.8750);
- SetPlayerFacingAngle(playerid, 357.3909);
- SetPlayerCameraPos(playerid, 354.4252,2032.4153,24.0223);
- SetPlayerCameraLookAt(playerid, 354.4405,2030.4860,23.8750);
- gTeam[playerid] = BRITISH_MEDIC;
- CreateExplosion(354.4405,2030.4860,23.8750, 12, 2); }
- }
- case 3:
- {
- GameTextForPlayer(playerid, "~b~general", 500, 6);
- {SetPlayerPos(playerid, 358.4248,2434.5625,17.0588);
- SetPlayerFacingAngle(playerid, 298.3950);
- SetPlayerCameraPos(playerid, 361.6220,2436.0774,16.7443);
- SetPlayerCameraLookAt(playerid, 358.4248,2434.5625,17.0588);
- gTeam[playerid] = FRANCE_GENERAL;
- CreateExplosion(358.4248,2434.5625,17.0588, 12, 2); }
- }
- case 4:
- {
- GameTextForPlayer(playerid, "~b~Soldier", 500, 6);
- {SetPlayerPos(playerid, 358.4248,2434.5625,17.0588);
- SetPlayerFacingAngle(playerid, 298.3950);
- SetPlayerCameraPos(playerid, 361.6220,2436.0774,16.7443);
- SetPlayerCameraLookAt(playerid, 358.4248,2434.5625,17.0588);
- gTeam[playerid] = FRANCE_SOLDIER;
- CreateExplosion(358.4248,2434.5625,17.0588, 12, 2); }
- }
- case 5:
- {
- GameTextForPlayer(playerid, "~b~medic", 500, 6);
- {SetPlayerPos(playerid, 358.4248,2434.5625,17.0588);
- SetPlayerFacingAngle(playerid, 298.3950);
- SetPlayerCameraPos(playerid, 361.6220,2436.0774,16.7443);
- SetPlayerCameraLookAt(playerid, 358.4248,2434.5625,17.0588);
- gTeam[playerid] = FRANCE_MEDIC;
- CreateExplosion(358.4248,2434.5625,17.0588, 12, 2); }
- }
- }
- return 1;
- }
- public OnPlayerConnect(playerid)
- {
- gPlayerCitySelection[playerid] = -1;
- gPlayerHasCitySelected[playerid] = 0;
- gPlayerLastCitySelectionTick[playerid] = GetTickCount();
- new Pname[24];
- SetPlayerColor(playerid,COLOR_DEADCONNECT);
- players++;
- zoneupdates[playerid] = 0;
- player_zone[playerid] = -1;
- GetPlayerName(playerid, Pname, 24);
- new plname[MAX_PLAYER_NAME];
- new playername4[MAX_PLAYER_NAME];
- new string[160];
- SendClientMessage(playerid, LIGHTBLUE, "|| Welcome ! ||");
- SendClientMessage(playerid,COLOR_BRIGHTRED, "|| Hacking/Cheating , Glitching , and ect aren't allowed here ||");
- SendClientMessage(playerid,COLOR_BRIGHTRED, "|| If doing so , it will result as ban or kick . ||");
- SendClientMessage(playerid, LIGHTBLUE, "|| /cmds to view commands to use. ||");
- TextDrawShowForPlayer(playerid, CreatorTextDraw );
- GameTextForPlayer(playerid,"~g~Welcome",4500,1);
- GetPlayerName(playerid, playername4, sizeof(playername4));
- format(string, sizeof(string), "*[JOINED] %s ", playername4);
- SendClientMessageToAll(COLOR_YELLOW, string);
- gPlayerAccount[playerid] = 0;
- PlayerInfo[playerid][pJoins] += 1;
- GetPlayerName(playerid, plname, sizeof(plname));
- format(string, sizeof(string), "%s.ini", plname);
- if(fexist(string))
- {
- gPlayerAccount[playerid] = 1;
- new loginstring[128];
- new loginname[64];
- GetPlayerName(playerid,loginname,sizeof(loginname));
- format(loginstring,sizeof(loginstring),"Welcome. \n \nThat name is registered. please enter your password below:");
- ShowPlayerDialog(playerid,2,DIALOG_STYLE_INPUT,"Login",loginstring,"Login","Exit");
- }
- else
- {
- gPlayerAccount[playerid] = 0;
- new regstring[128];
- new regname[64];
- GetPlayerName(playerid,regname,sizeof(regname));
- format(regstring,sizeof(regstring),"Welcome. \n \nPlease register your account by typing the password below:");
- ShowPlayerDialog(playerid,2,DIALOG_STYLE_INPUT,"Register",regstring,"Register","Exit");
- }
- return 1;
- }
- public OnPlayerDisconnect(playerid, reason)
- {
- players--;
- zoneupdates[playerid] = 0;
- player_zone[playerid] = -1;
- SetPlayerColor(playerid,COLOR_DEADCONNECT);
- SaveStats(playerid);
- new playername4[MAX_PLAYER_NAME];
- GetPlayerName(playerid, playername4, sizeof(playername4));
- new pName[MAX_PLAYER_NAME], string[128];
- GetPlayerName(playerid, pName, sizeof(pName));
- // format(string, sizeof(string), "%s has left the server.", pName);
- SendClientMessageToAll(0xA9A9A9AA, string);
- SendDeathMessage(playerid, playerid, 201);
- return 1;
- }
- public OnPlayerSpawn(playerid)
- {
- if(IsPlayerNPC(playerid)) return 1;
- // new randSpawn = 0;
- SetPlayerInterior(playerid,0);
- TogglePlayerClock(playerid,0);
- ResetPlayerMoney(playerid);
- GivePlayerMoney(playerid, 30000);
- // if they ever return to class selection make them city
- // select again first
- gPlayerHasCitySelected[playerid] = 0;
- /*
- if(CITY_LOS_SANTOS == gPlayerCitySelection[playerid]) {
- i dont remember waht was here
- }
- else if(CITY_SAN_FIERRO == gPlayerCitySelection[playerid]) {
- i dont know what was here
- }
- else if(CITY_LAS_VENTURAS == gPlayerCitySelection[playerid]) {
- i dont know hwat was here
- }
- */
- GameTextForPlayer(playerid, " ", 10, 3);
- zoneupdates[playerid] = 1;
- player_zone[playerid] = -1;
- if(!zoneupdate) zoneupdate = SetTimer("update_zones",1000,4);
- SetPlayerWeather(playerid, 9);
- switch(gTeam[playerid])
- {
- case FRANCE_GENERAL:
- {
- GivePlayerWeapon(playerid, 25, 5000);
- GivePlayerWeapon(playerid, 15, 60);
- GivePlayerWeapon(playerid, 7, 1);
- }
- case FRANCE_SOLDIER:
- {
- GivePlayerWeapon(playerid, 24, 5000);
- GivePlayerWeapon(playerid, 27, 160);
- GivePlayerWeapon(playerid, 7, 301);
- }
- case FRANCE_MEDIC:
- {
- GivePlayerWeapon(playerid, 22, 5000);
- GivePlayerWeapon(playerid, 39, 160);
- GivePlayerWeapon(playerid, 33, 301);
- GivePlayerWeapon(playerid, 16, 150);
- }
- case BRITISH_GENERAL:
- {
- GivePlayerWeapon(playerid, 25, 5000);
- GivePlayerWeapon(playerid, 15, 60);
- GivePlayerWeapon(playerid, 7, 1);
- }
- case BRITISH_SOLDIER:
- {
- GivePlayerWeapon(playerid, 24, 5000);
- GivePlayerWeapon(playerid, 27, 160);
- GivePlayerWeapon(playerid, 7, 301);
- }
- case BRITISH_MEDIC:
- {
- GivePlayerWeapon(playerid, 22, 5000);
- GivePlayerWeapon(playerid, 39, 160);
- GivePlayerWeapon(playerid, 33, 301);
- GivePlayerWeapon(playerid, 16, 150);
- }
- }
- return 0;
- }
- public OnPlayerDeath(playerid, killerid, reason)
- {
- new playercash;
- if(killerid == INVALID_PLAYER_ID) {
- ResetPlayerMoney(playerid);
- } else {
- playercash = GetPlayerMoney(playerid);
- if(playercash > 0) {
- GivePlayerMoney(killerid, playercash);
- ResetPlayerMoney(playerid);
- }
- }
- GetPlayerScore(killerid,1);
- GetPlayerScore(playerid,-1);
- zoneupdates[playerid] = 0;
- player_zone[playerid] = -1;
- SendDeathMessage(killerid, playerid, reason);
- zoneupdates[playerid] = 0;
- player_zone[playerid] = -1;
- return 0;
- }
- public OnPlayerCommandText(playerid, cmdtext[])
- {
- new cmd[256];
- if (strcmp(cmd, "/stats", true) == 0)
- {
- if(IsPlayerConnected(playerid))
- {
- Stats(playerid,playerid);
- }
- return 1;
- }
- if (strcmp("/fstyle", cmdtext, true, 10) == 0)
- {
- if(IsPlayerConnected(playerid))
- {
- ShowPlayerDialog(playerid, FIGHTMENU, DIALOG_STYLE_LIST, "Learn new Moves", "Boxing\nElbow\nKneehead\nKung-Fu\nGrabKick\nNormal", "Learn", "Nevermind");
- }
- return 1;
- }
- //-------------------------------[Stats]--------------------------------------------------------------------------
- return 0;
- }
- public OnPlayerLogin(playerid,password[])
- {
- new string2[64];
- new playername2[MAX_PLAYER_NAME];
- GetPlayerName(playerid, playername2, sizeof(playername2));
- format(string2, sizeof(string2), "%s.ini", playername2);
- new File: UserFile = fopen(string2, io_read);
- if ( UserFile )
- {
- new PassData[256];
- new keytmp[256], valtmp[256];
- fread( UserFile , PassData , sizeof( PassData ) );
- keytmp = ini_GetKey( PassData );
- if( strcmp( keytmp , "Key" , true ) == 0 )
- {
- valtmp = ini_GetValue( PassData );
- strmid(PlayerInfo[playerid][pKey], valtmp, 0, strlen(valtmp)-1, 255);
- }
- if(strcmp(PlayerInfo[playerid][pKey],password, true ) == 0 )
- {
- new key[ 256 ] , val[ 256 ];
- new Data[ 256 ];
- while ( fread( UserFile , Data , sizeof( Data ) ) )
- {
- key = ini_GetKey( Data );
- if( strcmp( key , "Kills" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pKills] = strval( val ); }
- if( strcmp( key , "Deaths" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pDeaths] = strval( val ); }
- if( strcmp( key , "Team" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pTeam] = strval( val ); }
- if( strcmp( key , "Joins" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pJoins] = strval( val ); }
- }//end while
- fclose(UserFile);//close the file after everything has been read in the while
- }
- }
- return 1;
- }
- public OnPlayerRegister(playerid, password[])
- {
- if(IsPlayerConnected(playerid))
- {
- new string3[32];
- new var[32];
- new playername3[MAX_PLAYER_NAME];
- GetPlayerName(playerid, playername3, sizeof(playername3));
- format(string3, sizeof(string3), "%s.ini", playername3);
- new File: hFile = fopen(string3, io_write);
- if (hFile)
- {
- format(var, 32, "Kills=%d\n",PlayerInfo[playerid][pKills]);fwrite(hFile, var);
- format(var, 32, "Deaths=%d\n",PlayerInfo[playerid][pDeaths]);fwrite(hFile, var);
- format(var, 32, "Team=%d\n",PlayerInfo[playerid][pTeam]);fwrite(hFile, var);
- format(var, 32, "Joins=%d\n",PlayerInfo[playerid][pJoins]);fwrite(hFile, var);
- fclose(hFile);
- new loginstring[128];
- new loginname[64];
- GetPlayerName(playerid,loginname,sizeof(loginname));
- format(loginstring,sizeof(loginstring),"Welcome back to San Andreas War. \n \nThat name is in use. Please enter your password",loginname);
- ShowPlayerDialog(playerid,LOGINMENU,DIALOG_STYLE_INPUT,"Login",loginstring,"Login","Exit");
- }
- }
- return 1;
- }
- public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
- {
- tAxI_OnPlayerEnterVehicle(playerid,vehicleid);
- new
- vehid,
- string[64];
- vehid = GetVehicleModel(vehicleid);
- format(string, 100, "Entering %s" ,VehicleNames[vehid - 400]);
- SendClientMessage(playerid, COLOR_LIGHTBLUE,string);
- return 1;
- }
- forward DontCarJack(playerid,jackedplayer, vehicleid);
- public DontCarJack(playerid, jackedplayer, vehicleid)
- {
- if(! (IsPlayerInAnyVehicle(jackedplayer)) ) PutPlayerInVehicle(jackedplayer,vehicleid,0);
- SetTimerEx("DontCarJack2",2000,false,"iii",playerid,jackedplayer,vehicleid);
- }
- forward DontCarJack2(playerid,jackedplayer, vehicleid);
- public DontCarJack2(playerid, jackedplayer, vehicleid)
- {
- if(! (IsPlayerInAnyVehicle(jackedplayer)) ) PutPlayerInVehicle(jackedplayer,vehicleid,0);
- TogglePlayerControllable(playerid, true);
- }
- public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
- {
- new sendername[MAX_PLAYER_NAME];
- new string[256];
- if(dialogid == FIGHTMENU)
- {
- if(response)
- {
- if(listitem == 0)
- {
- SetPlayerFightingStyle (playerid, FIGHT_STYLE_BOXING);
- SendClientMessage(playerid, GREEN, " Fighting style now boxing !");
- }
- if(listitem == 1)
- {
- SetPlayerFightingStyle (playerid, FIGHT_STYLE_ELBOW);
- SendClientMessage(playerid, GREEN, " Fighting style now elbow !");
- }
- if(listitem == 2)
- {
- SetPlayerFightingStyle (playerid, FIGHT_STYLE_KNEEHEAD);
- SendClientMessage(playerid, GREEN, " Fighting style now kneehead !");
- }
- if(listitem == 3)
- {
- SetPlayerFightingStyle (playerid, FIGHT_STYLE_KUNGFU);
- SendClientMessage(playerid, GREEN, " Fighting style now kung-fu !");
- }
- if(listitem == 4)
- {
- SetPlayerFightingStyle (playerid, FIGHT_STYLE_GRABKICK);
- SendClientMessage(playerid, GREEN, " Fighting style now grabkick !");
- }
- if(listitem == 5)
- {
- SetPlayerFightingStyle (playerid, FIGHT_STYLE_NORMAL);
- SendClientMessage(playerid, GREEN, " Fighting style now back to normal !");
- }
- }
- }
- if(response)
- {
- if(dialogid == LOGINMENU || dialogid == 12347)
- {
- if(strlen(inputtext))
- {
- new tmppass[64];
- strmid(tmppass, inputtext, 0, strlen(inputtext), 255);
- Encrypt(tmppass);
- }
- else
- {
- new loginstring[128];
- new loginname[64];
- GetPlayerName(playerid,loginname,sizeof(loginname));
- format(loginstring,sizeof(loginstring),"ERROR: Incorrect password!\n \nPlease enter the correct password:",loginname);
- ShowPlayerDialog(playerid,12347,DIALOG_STYLE_INPUT,"Login",loginstring,"Login","Exit");
- }
- }
- if(dialogid == 2)
- {
- if(strlen(inputtext))
- {
- GetPlayerName(playerid, sendername, sizeof(sendername));
- format(string, sizeof(string), "%s.ini", sendername);
- new File: hFile = fopen(string, io_read);
- if (hFile)
- {
- SendClientMessage(playerid, RED, "That Username is already taken, please choose a different one.");
- fclose(hFile);
- return 1;
- }
- new tmppass[64];
- strmid(tmppass, inputtext, 0, strlen(inputtext), 255);
- Encrypt(tmppass);
- OnPlayerRegister(playerid,tmppass);
- }
- else
- {
- new regstring[128];
- new regname[64];
- GetPlayerName(playerid,regname,sizeof(regname));
- format(regstring,sizeof(regstring),"Welcome, %s\nYou dont have an account.\nPlease register:",regname);
- ShowPlayerDialog(playerid,12345,DIALOG_STYLE_INPUT,"Register",regstring,"Register","Exit");
- }
- }
- }
- return 1;
- }
- public OnPlayerRequestSpawn(playerid)
- {
- return 1;
- }
- public PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z)
- {
- if(IsPlayerConnected(playerid))
- {
- new Float:oldposx, Float:oldposy, Float:oldposz;
- new Float:tempposx, Float:tempposy, Float:tempposz;
- GetPlayerPos(playerid, oldposx, oldposy, oldposz);
- tempposx = (oldposx -x);
- tempposy = (oldposy -y);
- tempposz = (oldposz -z);
- if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
- {
- return 1;
- }
- }
- return 0;
- }
- public OnGameModeExit()
- {
- print("\n~=~=~=~=~=~=~=~=~=~=~=~=~=~=~~=~=~=");
- print(" .: wdawdaw \n");
- print(" .: awdawda :.\n");
- print(" .: dawdawd :.\n");
- print("~=~=~=~=~=~=~=~=~=~=~=~=~=~=~~=~=~=\n");
- return 1;
- }
- public Encrypt(string[])
- {
- for(new x=0; x < strlen(string); x++)
- {
- string[x] += (3^x) * (x % 15);
- if(string[x] > (0xff))
- {
- string[x] -= 256;
- }
- }
- return 1;
- }
- public Stats(playerid,targetid)
- {
- if(IsPlayerConnected(playerid)&&IsPlayerConnected(targetid))
- {
- new deaths = PlayerInfo[targetid][pDeaths];
- new kills = PlayerInfo[targetid][pKills];
- new team = PlayerInfo[targetid][pTeam];
- new joins = PlayerInfo[targetid][pJoins];
- new name[MAX_PLAYER_NAME];
- GetPlayerName(targetid, name, sizeof(name));
- new Float:px,Float:py,Float:pz;
- GetPlayerPos(targetid, px, py, pz);
- new coordsstring[256];
- SendClientMessage(playerid, LIGHTBLUE,"||-----PLAYER STATS--------||");
- format(coordsstring, sizeof(coordsstring),"- Player Name: %s -",name);
- SendClientMessage(playerid, ORANGE,coordsstring);
- format(coordsstring, sizeof(coordsstring), "Info: Kills:[%d] || Deaths:[%d]", kills,deaths);
- SendClientMessage(playerid, ORANGE,coordsstring);
- format(coordsstring, sizeof(coordsstring), "Info: Team:[%s] || Joins:[%d]", team,joins);
- SendClientMessage(playerid, ORANGE,coordsstring);
- SendClientMessage(playerid, LIGHTBLUE,"||-------------------------||");
- }
- }
- stock PlayerName(playerid)
- {
- new name[255];
- GetPlayerName(playerid, name, 255);
- return name;
- }
- public SaveStats(playerid)
- {
- if(IsPlayerConnected(playerid))
- {
- new string3[128];
- format(string3, sizeof(string3), "%s.ini", PlayerName(playerid));
- new File: hFile = fopen(string3, io_write);
- if (hFile)
- {
- new var[32];
- format(var, 32, "Kills=%d\n",PlayerInfo[playerid][pKills]);fwrite(hFile, var);
- format(var, 32, "Deaths=%d\n",PlayerInfo[playerid][pDeaths]);fwrite(hFile, var);
- format(var, 32, "Team=%s\n",PlayerInfo[playerid][pTeam]);fwrite(hFile, var);
- format(var, 32, "Joins=%d\n",PlayerInfo[playerid][pJoins]);fwrite(hFile, var);
- fclose(hFile);
- }
- }
- return 1;
- }
- stock ini_GetKey( line[] )
- {
- new keyRes[256];
- keyRes[0] = 0;
- if ( strfind( line , "=" , true ) == -1 ) return keyRes;
- strmid( keyRes , line , 0 , strfind( line , "=" , true ) , sizeof( keyRes) );
- return keyRes;
- }
- stock ini_GetValue( line[] )
- {
- new valRes[256];
- valRes[0]=0;
- if ( strfind( line , "=" , true ) == -1 ) return valRes;
- strmid( valRes , line , strfind( line , "=" , true )+1 , strlen( line ) , sizeof( valRes ) );
- return valRes;
- }
Advertisement
Add Comment
Please, Sign In to add comment