Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public OnGameModeInit()
- {
- AddPlayerClass(0, 1958.33, 1343.12, 15.36, 269.15, 0, 0, 0, 0, 0, 0);
- InitMapSystem();
- EnableStuntBonusForAll(0);
- DisableInteriorEnterExits();
- SetTimer("UpdateTextdraw", 1000, true);
- SetTimer("AntiCheat", 1000, true);
- SetTimer("timer_update",14400,true);
- gettime(ghour, gminute, gsecond);
- FixHour(ghour);
- ghour = shifthour;
- //------ Textdraws
- //------ clock
- Clockzz = TextDrawCreate(549.000000,38.000000,"00:00");
- TextDrawAlignment(Clockzz,0);
- TextDrawBackgroundColor(Clockzz,0x000000ff);
- TextDrawFont(Clockzz,2);
- TextDrawLetterSize(Clockzz,0.499999,3.199999);
- TextDrawColor(Clockzz,0x00ffff99);
- TextDrawSetOutline(Clockzz,1);
- TextDrawSetProportional(Clockzz,1);
- TextDrawSetShadow(Clockzz,1);
- //------ Advertisement
- AdTextdraw = TextDrawCreate(1.000000, 433.000000, "[Ad] Make an advertisement via /advertisement!");
- TextDrawBackgroundColor(AdTextdraw, 0x000000ff);
- TextDrawFont(AdTextdraw, 1);
- TextDrawLetterSize(AdTextdraw, 0.300000, 1.500000);
- TextDrawColor(AdTextdraw, -1);
- TextDrawSetOutline(AdTextdraw, 0);
- TextDrawSetProportional(AdTextdraw, 1);
- TextDrawSetShadow(AdTextdraw, 1);
- TextDrawUseBox(AdTextdraw, 1);
- TextDrawBoxColor(AdTextdraw, 0x00000033);
- TextDrawTextSize(AdTextdraw, 653.000000, 0.000000);
- //-----End of textdraws
- SetTimer("UpdateClock", 1000, true); //ANTI-CHEAT IN THIS.
- SetTimer("ChangeWeather", 720000, true);
- SetTimer("RandomMsg", 600000, true);
- ConnectMySQL();
- new mapname[75];
- format(mapname,sizeof(mapname),"mapname %s",revision);
- SendRconCommand(mapname);
- SetGameModeText("Flying/RP");
- new SendCommand[156]; // I don't want to count the letters, do it yourself
- format(SendCommand, sizeof(SendCommand), "hostname %s", HOSTNAME); // Format the command into a string.
- SendRconCommand(SendCommand); // Execute the command through Rcon.
- LoadAirline(1);
- LoadAirline(2);
- LoadAirline(3);
- LoadAirline(4);
- LoadAirline(5);
- new tmphour;
- new tmpminute;
- new tmpsecond;
- gettime(tmphour, tmpminute, tmpsecond);
- FixHour(tmphour);
- tmphour = shifthour;
- SetWorldTime(tmphour);
- randomtimer = SetTimer("RandomTimer", 1000, 1);
- onlinetimer = SetTimer("OnlineTimer", 60000, 1); //DYNAMIC SIG TIMER IS IN THIS!!
- LoadObjects();
- AddAirlineVehiclesSTART();
- AddHousesFromSQL();
- AddVehiclesFromSQL();
- AddPlayerVehicles();
- AddMapIcons();
- LoadStuff(); // Load the data, MOTD, etc.
- LoadTextdraws();
- for(new i=0;i<MAX_VEHICLES;i++) {
- vfuel[i] = 100; //set fuel to 100 percent
- }
- SetTimer("UpdateIRC", 5000, true);
- return 1;
- }
- public RandomTimer()
- {
- for(new i; i<MAX_PLAYERS; i++)
- {
- if(GetPlayerMoney(i) != PInfo[i][Money]) //Money/Cash anti-cheat
- {
- ResetPlayerMoney(i);
- GivePlayerMoney(i,PInfo[i][Money]);
- }
- }
- }
- stock Float:GetVehicleSpeed(vehicleid,UseMPH = 0)
- {
- new Float:speed_x,Float:speed_y,Float:speed_z,Float:temp_speed;
- GetVehicleVelocity(vehicleid,speed_x,speed_y,speed_z);
- if(UseMPH == 0)
- {
- temp_speed = floatsqroot(((speed_x*speed_x)+(speed_y*speed_y))+(speed_z*speed_z))*136.666667;
- } else {
- temp_speed = floatsqroot(((speed_x*speed_x)+(speed_y*speed_y))+(speed_z*speed_z))*85.4166672;
- }
- floatround(temp_speed,floatround_round);return temp_speed;
- }
- public UpdateClock() //ANTI CHEAT AND CLOCK UPDATE.
- {
- //----------- CLOCK UPDATER ---------------
- new fix[20];
- if(gMinutes == 60)
- {
- new theHour = gHour+1;
- SetWorldTime(theHour);
- }
- if(gHour == 23 && gMinutes == 60)
- {
- gHour = 0;
- gMinutes = 0;
- new PCount = 0;
- new string[256];
- for(new i = 0; i <MAX_PLAYERS; i++)
- {
- if(IsPlayerConnected(i))
- {
- PCount=PCount+1;
- if(SessionEarnt[i] > POTD_MaximumEarnt)
- {
- POTD_MaximumEarnt = SessionEarnt[i];
- POTD_Winner = i;
- POTD_FinalAmount = SessionEarnt[i];
- POTD_FinalAmount2 = SessionEarnt[i];
- format(string,sizeof(string),"%s", PlayerName(i));
- strmid(POTD_WinnerName, string, 0, strlen(string), 128);
- }
- format(string,sizeof(string),"[POTD] You have earnt a total of {1B8AE4}$%d {FFFFFF}today. (Excluding airline bonus)", SessionEarnt[i]);
- SendClientMessage(i, COLOR_WHITE, string);
- SessionEarnt[i] = 0;
- }
- }
- if(PCount > 1)
- {
- new POTDBonus = PCount*975; //50 players - $48750 bonus!
- new susername[MAX_PLAYER_NAME];
- new date,month,year;
- getdate(date,month,year);
- new hour,minute,second;
- gettime(hour,minute,second);
- format(susername,sizeof(susername),"%s", PlayerName(POTD_Winner));
- mysql_real_escape_string(susername, susername);
- new query[600];
- format(query,sizeof(query),"INSERT INTO `potd` (Username, AmountEarnt, AmountWon, Time, Date) VALUES ('%s', '%d', '%d', '%d:%d:%d', '%d/%d/%d')", susername, POTD_FinalAmount, POTDBonus, hour,minute,second,year,month,date);
- mysql_query(query);
- PInfo[POTD_Winner][Money]=PInfo[POTD_Winner][Money]+POTDBonus;
- GivePlayerMoney(POTD_Winner, POTDBonus);
- format(string,sizeof(string),"[POTD] {1B8AE4}%s(%d) {FFFFFF}has become the pilot of the day for earning {1B8AE4}$%d {FFFFFF}and has won {1B8AE4}$%d{FFFFFF}!", PlayerName(POTD_Winner), POTD_Winner, POTD_FinalAmount, POTDBonus);
- SendClientMessageToAll(COLOR_WHITE, string);
- POTD_MaximumEarnt = 0;
- POTD_FinalAmount = 0;
- PayLog(susername, POTDBonus, "Won POTD", "Server", "N/A");
- }
- new ACount = 0; //Participating Airline amounts. (must be atleast 2.)
- for(new aid = 0; aid <MAX_AIRLINES; aid++)
- {
- if(AOTD_Earnt[aid] > 0)
- {
- ACount=ACount+1;
- if(AOTD_Earnt[aid] > AOTD_MaximumEarnt)
- {
- AOTD_MaximumEarnt = AOTD_Earnt[aid];
- AOTD_Winner = aid;
- AOTD_FinalAmount = AOTD_Earnt[aid];
- AOTD_FinalAmount2 = AOTD_Earnt[aid];
- format(string,sizeof(string),"%s", AInfo[aid][aName]);
- strmid(AOTD_WinnerName, string, 0, strlen(string), 128);
- }
- format(string,sizeof(string),"* [AOTD] Your airline has earnt a total of $%d today!", AOTD_Earnt[aid]);
- SendAirlineMessage(COLOR_AIRLINECHAT, string, aid);
- AOTD_Earnt[aid] = 0;
- }
- }
- if(ACount > 1)
- {
- new AOTDBonus = PCount*1100;
- new aname[128];
- new date,month,year;
- getdate(date,month,year);
- new hour,minute,second;
- gettime(hour,minute,second);
- format(aname,sizeof(aname),"%s", AInfo[AOTD_Winner][aName]);
- mysql_real_escape_string(aname,aname);
- new query[600];
- format(query,sizeof(query),"INSERT INTO `aotd` (Airline, AmountEarnt, AmountWon, Time, Date) VALUES ('%s', '%d', '%d', '%d:%d:%d', '%d/%d/%d')", aname, AOTD_FinalAmount, AOTDBonus, hour,minute,second,year,month,date);
- mysql_query(query);
- format(string,sizeof(string),"[AOTD] {1B8AE4}%s {FFFFFF}has won airline of the day for earning {1B8AE4}$%d {FFFFFF}and has won {1B8AE4}$%d{FFFFFF}!", AInfo[AOTD_Winner][aName], AOTD_FinalAmount, AOTDBonus);
- SendClientMessageToAll(COLOR_WHITE, string);
- AInfo[AOTD_Winner][aBalance] = AInfo[AOTD_Winner][aBalance]+AOTDBonus;
- SaveAirline(AOTD_Winner);
- format(string,sizeof(string),"* A total of $%d has been added to the airlines bank.", AOTDBonus);
- SendAirlineMessage(COLOR_AIRLINECHAT, string, AOTD_Winner);
- AOTD_MaximumEarnt = 0;
- AOTD_FinalAmount = 0;
- }
- else
- {
- format(string,sizeof(string),"[AOTD] No airline has won Airline of the Day due to a lack of competition.");
- SendClientMessageToAll(COLOR_WHITE, string);
- format(AOTD_WinnerName,sizeof(AOTD_WinnerName), "None");
- AOTD_FinalAmount = 0;
- AOTD_MaximumEarnt = 0;
- }
- for(new i = 0; i < MAX_VEHICLES; i++) //Respawn all vehicles.
- {
- if(!IsVehicleOccupied(i))
- {
- SetVehicleToRespawn(i);
- }
- }
- }
- if(gMinutes == 60) { gHour++; gMinutes = 0; }
- if(gHour < 10 && gMinutes > 9) { format(fix, sizeof(fix), "0%d:%d", gHour, gMinutes); }
- if(gHour < 10 && gMinutes < 10) { format(fix, sizeof(fix), "0%d:0%d", gHour, gMinutes); }
- if(gMinutes < 10 && gHour > 9) { format(fix,sizeof(fix), "%d:0%d", gHour, gMinutes); }
- if(gMinutes < 10 && gHour < 10) { format(fix, sizeof(fix), "0%d:0%d", gHour, gMinutes); }
- if(gMinutes > 9 && gHour > 9) { format(fix,sizeof(fix), "%d:%d", gHour, gMinutes); }
- gMinutes++;
- TextDrawSetString(Clockzz, fix);
- //------------- CLOCK UPDATER --------------
- //------------- ANTICHEAT ------------------
- //------------- ANTICHEAT ------------------
- }
- public UpdateIRC()
- {
- new query[400];
- format(query,sizeof(query),"SELECT Sender, Message, ID FROM ucpchat2");
- mysql_query(query);
- mysql_store_result();
- new tRows = mysql_num_rows();
- if(tRows > 0)
- {
- while(mysql_fetch_row(query))
- {
- new sSender[24], sMessage[156], sID;
- sscanf(query, "p<|>s[24]s[156]d", sSender, sMessage, sID);
- format(query,sizeof(query),"([UCP] %s: %s)", sSender, sMessage);
- SendClientMessageToAll(COLOR_IRC, query);
- format(query,sizeof(query),"DELETE FROM ucpchat2 WHERE ID = '%d'", sID);
- mysql_query(query);
- }
- }
- mysql_free_result();
- }
- public AntiCheat()
- {
- for(new playerid; playerid<MAX_PLAYERS; playerid++)
- {
- if(IsPlayerConnected(playerid))
- {
- if(PlayerLogged[playerid] == 1 && PlayerSpawned[playerid] == 1 && PInfo[playerid][AdminLevel] == 0)
- {
- new wep = GetPlayerWeapon(playerid);
- if(wep==1||wep==2||wep==3||wep==4||wep==5||wep==6||wep==7||wep==8||wep==9||wep==10||wep==11||wep==12||wep==13||wep==14||wep==15||wep==16||wep==17||wep==18||wep==22||wep==23||wep==24||wep==25||wep==26||wep==27||wep==28||wep==29||wep==30||wep==31||wep==32||wep==33||wep==34||wep==35||wep==36||wep==37||wep==38||wep==39||wep==40||wep==41||wep==42||wep==43||wep==44||wep==45)
- {
- BanUser(playerid, "Weapon hacks", "TroubleMaker");
- }
- new Float:Armour;
- GetPlayerArmour(playerid, Armour);
- if(Armour > 0)
- {
- BanUser(playerid, "Armour hacks", "TroubleMaker");
- }
- if(GetPlayerSpecialAction(playerid) == SPECIAL_ACTION_USEJETPACK)
- {
- BanUser(playerid, "Jetpack hacks", "TroubleMaker");
- }
- if(IsPlayerInAnyVehicle(playerid))
- {
- new vehicleid = GetPlayerVehicleID(playerid);
- if(vfuel[vehicleid] > 0)
- {
- new speed = floatround(GetVehicleSpeed(vehicleid, 0), floatround_round);
- if(speed > 239 && PInfo[playerid][TotalScore] < 10) //240 mph && under 10 score
- {
- BanUser(playerid, "Speed hack", "TroubleMaker");
- }
- else if(speed > 210) //210 mph
- {
- new string[156];
- format(string,sizeof(string),"[SPEED WARNING] %s(%d) is going %d MPH! /spec them!", PlayerName(playerid), playerid, speed);
- SendAdminMessage(COLOR_ADMIN, string);
- }
- }
- }
- }
- }
- }
- }
- public ShowAds()
- {
- AdvertisementStatus = 1;
- TextDrawShowForAll(AdTextdraw);
- }
- public HideAds()
- {
- AdvertisementStatus = 0;
- TextDrawHideForAll(AdTextdraw);
- }
- public UpdateTextdraw()
- {
- for(new i; i<MAX_PLAYERS; i++)
- {
- if(IsPlayerConnected(i))
- {
- if(PreviewingSkin[i] == 1) { if(PreviewingSkinTime[i] == 0) { SetPlayerSkin(i, PreviewingSkinOld[i]); PreviewingSkin[i] = 0; } else { PreviewingSkinTime[i]=PreviewingSkinTime[i]-1; } }
- if(WantsRecording[i] == 1)
- {
- if(TimeTakenHrs[i] == 4 && TimeTakenMins[i] == 59) { PlayerPlaySound(i, 29631, 0, 0, 0); } //Hey, how's the flying coming along?
- if(TimeTakenMins[i] == 59) { TimeTakenMins[i] = 0; TimeTakenHrs[i] += 1; }
- else
- {
- TimeTakenMins[i] += 1;
- }
- }
- if(IsPlayerInAnyVehicle(i) && GetPlayerVehicleSeat(i) == 0)
- {
- new vid = GetPlayerVehicleID(i);
- switch(GetVehicleModel(vid))
- {
- case 520 , 577 , 511 , 592 , 512 , 513 , 519 , 593 , 553 , 476, 417 , 425, 447, 469, 487, 488, 497, 548, 563, 460:
- {
- new szString[128];
- format(szString, 40, "%d Percent", vfuel[vid]);
- TextDrawSetString(Textdraw4[i], szString);
- TextDrawShowForPlayer(i, Textdraw4[i]);
- TextDrawShowForPlayer(i, Textdraw5[i]);
- if(vfuel[vid] < 21) //20 or under fuel
- {
- if(vfuel[vid] == 20 && FuelWarned[i] == 0) { FuelWarned[i] = 1; SendClientMessage(i, COLOR_ERROR, "[Instrument Panel] The vehicles fuel is running low ! Please refuel immediately! (/refuel)"); }
- PlayerPlaySound(i, 1057, 0,0,0);
- }
- new Float:vhealth;
- new Float: vX, Float:vY, Float:vZ;
- format(szString, 128, "%s", GetPlayerArea(i));
- TextDrawSetString(Textdraw0[i], szString);
- TextDrawShowForPlayer(i, Textdraw0[i]);
- TextDrawShowForPlayer(i, Textdraw2[i]);
- GetVehicleHealth(vid, vhealth);
- vhealth = vhealth/10;
- format(szString, 40, "%d Percent", floatround(vhealth, floatround_round));
- TextDrawSetString(Textdraw6[i], szString);
- TextDrawShowForPlayer(i, Textdraw6[i]);
- TextDrawShowForPlayer(i, Textdraw7[i]);
- GetPlayerPos(i, vX, vY, vZ);
- format(szString, 40, "%d", floatround(vZ, floatround_ceil));
- TextDrawSetString(Textdraw10[i], szString);
- TextDrawShowForPlayer(i, Textdraw10[i]);
- TextDrawShowForPlayer(i, Textdraw9[i]);
- format(szString, 40, "%d MPH", floatround(GetVehicleSpeed(vid, 0), floatround_round));
- TextDrawSetString(Textdraw8[i], szString);
- TextDrawShowForPlayer(i, Textdraw8[i]);
- TextDrawShowForPlayer(i, Textdraw11[i]);
- new Float:zangle;
- GetVehicleZAngle(vid, zangle);
- format(szString, 40, "%d", floatround(zangle, floatround_round));
- TextDrawSetString(Textdraw12[i], szString);
- TextDrawShowForPlayer(i, Textdraw12[i]);
- TextDrawShowForPlayer(i, Textdraw13[i]);
- if(StartedMission[i] == 1)
- {
- if(MissionStage[i] == 1)
- {
- new Float:DistanceCheck;
- DistanceCheck = GetDistanceBetweenPoints(vX, vY, vZ,Pos1[i],Pos2[i],Pos3[i]);
- format(szString, 40, "%s (%dm)", FirstAPName[i],floatround(DistanceCheck, floatround_round));
- TextDrawSetString(Textdraw1[i], szString);
- TextDrawShowForPlayer(i, Textdraw1[i]);
- TextDrawShowForPlayer(i, Textdraw3[i]);
- }
- else if(MissionStage[i] == 2)
- {
- new Float:DistanceCheck;
- DistanceCheck = GetDistanceBetweenPoints(vX, vY, vZ,Pos12[i],Pos22[i],Pos32[i]);
- format(szString, 40, "%s (%dm)", FinalAPName[i],floatround(DistanceCheck, floatround_round));
- TextDrawSetString(Textdraw1[i], szString);
- TextDrawShowForPlayer(i, Textdraw1[i]);
- TextDrawShowForPlayer(i, Textdraw3[i]);
- }
- }
- }
- }
- }
- }
- }
- }
- public OnlineTimer()
- {
- new x = 0;
- for(new i; i<MAX_PLAYERS; i++)
- {
- if(IsPlayerConnected(i)) //Money/Cash anti-cheat
- {
- if(PInfo[i][MinsPlayed] == 59) { PInfo[i][MinsPlayed] = 0; PInfo[i][HoursPlayed]=PInfo[i][HoursPlayed]+1; } else { PInfo[i][MinsPlayed]=PInfo[i][MinsPlayed]+1; }
- x=x+1;
- }
- }
- PlayersOnline = x;
- new query[400];
- format(query,sizeof(query),"UPDATE serverinfo SET hostname='%s',maxplayers='%d',players='%d'", HOSTNAME, MaxPlayers, PlayersOnline);
- mysql_reconnect();
- mysql_query(query);
- }
- public ConnectMySQL()
- {
- mysql_connect(SQL_HOST, SQL_USER, SQL_DB, SQL_PASS);
- if(mysql_ping() == 1)
- {
- mysql_debug(1);
- printf("[MYSQL]: Connection to `%s` succesful!", SQL_DB);
- GlobalStatus = 1;
- }
- else
- {
- printf("[MYSQL]: [ERROR]: Connection to `%s` failed!", SQL_DB);
- GlobalStatus = 2;
- }
- return 1;
- }
- public SyncTime()
- {
- //new string[64];
- new tmphour;
- new tmpminute;
- new tmpsecond;
- gettime(tmphour, tmpminute, tmpsecond);
- FixHour(tmphour);
- tmphour = shifthour;
- if((tmphour > ghour) || (tmphour == 0 && ghour == 23))
- {
- //Changing weather randomly
- new GlobalWeather = random(17);
- SetWeather(GlobalWeather);
- //Changing weather randomly finish
- //format(string, sizeof(string), "SERVER: The time is now %d:00 hours",tmphour);
- //SendClientMessageToAll(COLOR_WHITE,string);
- ghour = tmphour;
- if(realtime)
- {
- SetWorldTime(tmphour);
- }
- }
- }
- public FixHour(hour)
- {
- hour = timeshift+hour;
- if(hour < 0)
- {
- hour = hour+24;
- }
- else if(hour > 23)
- {
- hour = hour-24;
- }
- shifthour = hour;
- return 1;
- }
- public CheckIPS(playerid)
- {
- new PIP2[40]; // Main IP.
- GetPlayerIp(playerid, PIP2, sizeof(PIP2));
- new Count = 0;
- new PIP[40];
- for(new i; i<MAX_PLAYERS; i++)
- {
- if(IsPlayerConnected(i))
- {
- GetPlayerIp(i, PIP, sizeof(PIP));
- if(!strcmp(PIP, PIP2))
- {
- Count=Count+1;
- }
- }
- }
- if(Count > 5) // 6 connections!
- {
- new msg[156];
- format(msg,sizeof(msg),"There are too many connections from your IP: %s!", PIP2);
- SendClientMessage(playerid, COLOR_ERROR, msg);
- Kick(playerid);
- return 1;
- }
- return 1;
- }
- public CheckBanned(playerid)
- {
- new IP2[20];
- GetPlayerIp(playerid, IP2, sizeof(IP2));
- mysql_reconnect();
- new Query[156], EscName[MAX_PLAYER_NAME];
- mysql_real_escape_string(PlayerName(playerid), EscName);
- format(Query, sizeof(Query), "SELECT * FROM `bans` WHERE `IP` = '%s' OR `Username` = '%s'", IP2, EscName);
- mysql_query(Query);
- mysql_store_result();
- if(mysql_num_rows() > 0)
- {
- new line[500];
- if(mysql_fetch_row(line)) //Fetches the line
- {
- new string[128];
- new data[6][128]; //The data strings
- new data2[2];
- sscanf(line, "p<|>s[128]s[128]s[128]s[128]s[128]dds[128]", data[0], data[1], data[2], data[3], data[4], data2[0], data2[1], data[5]); //Splits the line with sscanf
- format(string,sizeof(string),"[Username]: {FFFFFF}%s", data[0]);
- SendClientMessage(playerid, COLOR_BLUE, string);
- format(string, sizeof(string), "[IP Address]: {FFFFFF}%s", data[3]);
- SendClientMessage(playerid, COLOR_BLUE, string);
- format(string,sizeof(string), "[Ban Reason]: {FFFFFF}%s", data[1]);
- SendClientMessage(playerid, COLOR_BLUE, string);
- format(string,sizeof(string), "[Ban Date]: {FFFFFF}%s / %s", data[4], data[5]);
- SendClientMessage(playerid, COLOR_BLUE, string);
- format(string,sizeof(string), "[Banned By]: {FFFFFF}%s", data[2]);
- SendClientMessage(playerid, COLOR_BLUE, string);
- new string2[256];
- format(string2,sizeof(string2), "-- To appeal this ban, please visit {FFFFFF}http://the-lof.com{1B8AE4} and post an unban appeal, including a screenshot of the above details. --");
- SendClientMessage(playerid, COLOR_BLUE, string2);
- mysql_free_result();
- Kick(playerid);
- }
- mysql_free_result();
- Kick(playerid);
- return 1;
- }
- else
- {
- mysql_free_result();
- }
- return 1;
- }
- public SaveVehicle(vehicleid)
- {
- new query[400];
- format(query,sizeof(query),"UPDATE pvehicles SET VehicleModel='%d',OwnedBy='%s',VehicleX='%f',VehicleY='%f',VehicleZ='%f',VehicleA='%f',VehicleColor1='%d',VehicleColor2='%d',VehicleForSale='%d',VehicleDefaultPrice='%d',VehiclePrice='%d',VehicleLocked='%d' WHERE VehicleID = '%d'",
- PVInfo[vehicleid][vpModel],
- PVInfo[vehicleid][vpOwnedBy],
- PVInfo[vehicleid][vpPosX],
- PVInfo[vehicleid][vpPosY],
- PVInfo[vehicleid][vpPosZ],
- PVInfo[vehicleid][vpPosA],
- PVInfo[vehicleid][vpColor1],
- PVInfo[vehicleid][vpColor2],
- PVInfo[vehicleid][vpForSale],
- PVInfo[vehicleid][vpDefaultPrice],
- PVInfo[vehicleid][vpPrice],
- PVInfo[vehicleid][vpLocked],
- vehicleid);
- mysql_reconnect();
- mysql_query(query);
- printf("Vehicle ID %d saved to mysql.", vehicleid);
- }
- public ReloadVehicle(vehicleid)
- {
- new carid = vehicleid;
- new Str[250], vTotal, vehID, vehModel, Float:vehX, Float:vehY, Float:vehZ, Float:vehA, vehC1, vehC2, vehOwnedBy[24], ForSale, DefaultPrice, Price, Locked;
- mysql_reconnect();
- new carmod[17];
- new query[512];
- format(query,sizeof(query),"SELECT * FROM `pvehicles` WHERE `VehicleID` = '%d' LIMIT 1", vehicleid);
- mysql_query(query);
- mysql_store_result();
- vTotal = mysql_num_rows();
- if(vTotal > 0)
- {
- mysql_fetch_row(Str);
- DestroyVehicle(PVInfo[carid][vpVehicleSpawned]);
- Delete3DTextLabel(PVInfo[carid][vpVehicleText]);
- sscanf(Str, "p<|>dds[24]ffffddddddddddddddddddddddd",
- vehID,vehModel,vehOwnedBy,vehX,vehY,vehZ,vehA,vehC1,vehC2,ForSale,DefaultPrice,Price,Locked,carmod[0],carmod[1],carmod[2],carmod[3],carmod[4],carmod[5],carmod[6],carmod[7],carmod[8],carmod[9],carmod[10],carmod[11],carmod[12],carmod[13],carmod[14],carmod[15],carmod[16]);
- carid=vehID;
- new carid2 = CreateVehicle(vehModel, vehX, vehY, vehZ, vehA, vehC1, vehC2, (30 * 60));
- PVInfo[carid][vpID] = vehID;
- PVInfo[carid][vpPosX] = vehX;
- PVInfo[carid][vpPosY] = vehY;
- PVInfo[carid][vpPosZ] = vehZ;
- PVInfo[carid][vpPosA] = vehA;
- PVInfo[carid][vpColor1] = vehC1;
- PVInfo[carid][vpColor2] = vehC2;
- PVInfo[carid][vpModel] = vehModel;
- PVInfo[carid][vpForSale] = ForSale;
- PVInfo[carid][vpDefaultPrice] = DefaultPrice;
- PVInfo[carid][vpPrice] = Price;
- PVInfo[carid][vpLocked] = Locked;
- PVInfo[carid2][mod1] = carmod[0];
- PVInfo[carid2][mod2] = carmod[1];
- PVInfo[carid2][mod3] = carmod[2];
- PVInfo[carid2][mod4] = carmod[3];
- PVInfo[carid2][mod5] = carmod[4];
- PVInfo[carid2][mod6] = carmod[5];
- PVInfo[carid2][mod7] = carmod[6];
- PVInfo[carid2][mod8] = carmod[7];
- PVInfo[carid2][mod9] = carmod[8];
- PVInfo[carid2][mod10] = carmod[9];
- PVInfo[carid2][mod11] = carmod[10];
- PVInfo[carid2][mod12] = carmod[11];
- PVInfo[carid2][mod13] = carmod[12];
- PVInfo[carid2][mod14] = carmod[13];
- PVInfo[carid2][mod15] = carmod[14];
- PVInfo[carid2][mod16] = carmod[15];
- PVInfo[carid2][mod17] = carmod[16];
- if(ForSale == 1)
- {
- format(Str, sizeof(Str), "%s for sale!\nPrice: $%d (Seller: %s)\n/marketplace to purchase!", GetVehicleFriendlyName(carid2),Price, vehOwnedBy);
- PVInfo[carid][vpVehicleText] = Create3DTextLabel(Str, 0xFF8400FF, vehX, vehY, vehZ, 50.0, 0, 1);
- }
- else
- {
- format(Str, sizeof(Str), "%s\nOwner: %s", GetVehicleFriendlyName(carid2),vehOwnedBy);
- PVInfo[carid][vpVehicleText] = Create3DTextLabel(Str, 0xFF8400FF, vehX, vehY, vehZ, 50.0, 0, 1);
- }
- Attach3DTextLabelToVehicle(PVInfo[carid][vpVehicleText], carid2, 0.0, 0.0, 0.0);
- new string[64];
- format(string,sizeof(string),"%s",vehOwnedBy);
- strmid(PVInfo[carid][vpOwnedBy], string, 0, strlen(string), 128);
- PVInfo[carid][vpVehicleSpawned] = carid2;
- new engine,lights,alarm,doors,bonnet,boot,objective;
- GetVehicleParamsEx(carid2,engine,lights,alarm,doors,bonnet,boot,objective);
- if(Locked == 1) { SetVehicleParamsEx(carid2,engine,lights,alarm,1,bonnet,boot,objective); }
- else if(Locked == 0) { SetVehicleParamsEx(carid2,engine,lights,alarm,0,bonnet,boot,objective); }
- }
- mysql_free_result();
- }
- public ReloadHouse(houseid)
- {
- new Str[400], string[256];
- mysql_reconnect();
- format(string,sizeof(string),"SELECT * FROM `houses` WHERE `HouseID` = %d LIMIT 1", houseid);
- mysql_reconnect();
- mysql_query(string);
- mysql_store_result();
- new hTotal = mysql_num_rows(); //hTotal amount of houses in mysql database
- if(hTotal > 0) //1+ house.
- {
- mysql_fetch_row(Str);
- new HID,Float:eX,Float:eY,Float:eZ,Float:iX,Float:iY,Float:iZ,OwnedBy[24],Location[128],Price,Interior,Slots,ForSale,Locked,DefaultPrice;
- sscanf(Str, "p<|>ds[24]s[128]dddffffffddd", HID,OwnedBy,Location,DefaultPrice,Price,Interior,iX,iY,iZ,eX,eY,eZ,Slots,ForSale,Locked);
- if(!strcmp(OwnedBy, "None"))
- {
- DestroyDynamicMapIcon(HInfo[HID][hMapIcon]);
- DestroyPickup(HInfo[HID][hPickupID]);
- Delete3DTextLabel(HInfo[HID][hHouseText]);
- HInfo[HID][hMapIcon] = CreateDynamicMapIcon(eX, eY, eZ, 31, 0, 0, 0, 0, 100.0);
- HInfo[HID][hPickupID] = CreatePickup(1273, 23, eX, eY, eZ, 0);
- format(string,sizeof(string),"House for sale!\n$%d (%d slots)\n/buyhouse to purchase.", DefaultPrice, Slots);
- HInfo[HID][hHouseText] = Create3DTextLabel(string, 0x50AAC5FF, eX, eY, eZ, 50.0, 0, 1);
- }
- else if(ForSale == 1)
- {
- DestroyDynamicMapIcon(HInfo[HID][hMapIcon]);
- DestroyPickup(HInfo[HID][hPickupID]);
- Delete3DTextLabel(HInfo[HID][hHouseText]);
- HInfo[HID][hMapIcon] = CreateDynamicMapIcon(eX, eY, eZ, 31, 0, 0, 0, 0, 100.0);
- HInfo[HID][hPickupID] = CreatePickup(1273, 23, eX, eY, eZ, 0);
- format(string,sizeof(string),"Owned by: %s\nFor sale: $%d (%d slots)\n/buyhouse to purchase.", OwnedBy, Price, Slots);
- HInfo[HID][hHouseText] = Create3DTextLabel(string, 0x50AAC5FF, eX, eY, eZ, 50.0, 0, 1);
- }
- else
- {
- DestroyDynamicMapIcon(HInfo[HID][hMapIcon]);
- DestroyPickup(HInfo[HID][hPickupID]);
- Delete3DTextLabel(HInfo[HID][hHouseText]);
- HInfo[HID][hMapIcon] = CreateDynamicMapIcon(eX, eY, eZ, 32, 0, 0, 0, 0, 100.0);
- HInfo[HID][hPickupID] = CreatePickup(1272, 23, eX, eY, eZ, 0);
- format(string,sizeof(string),"Owned by: %s\nSlots: %d", OwnedBy, Slots);
- HInfo[HID][hHouseText] = Create3DTextLabel(string, 0x50AAC5FF, eX, eY, eZ, 50.0, 0, 1);
- }
- format(string,sizeof(string),"%s",OwnedBy);
- strmid(HInfo[HID][hOwnedBy], string, 0, strlen(string), 128);
- format(string,sizeof(string),"%s",Location);
- strmid(HInfo[HID][hLocation], string, 0, strlen(string), 128); //PASSWORD
- HInfo[HID][hPrice] = Price;
- HInfo[HID][hInterior] = Interior;
- HInfo[HID][hiX] = iX;
- HInfo[HID][hiY] = iY;
- HInfo[HID][hiZ] = iZ;
- HInfo[HID][heX] = eX;
- HInfo[HID][heY] = eY;
- HInfo[HID][heZ] = eZ;
- HInfo[HID][hSlots] = Slots;
- HInfo[HID][hForSale] = ForSale;
- HInfo[HID][hLocked] = Locked;
- HInfo[HID][hDefaultPrice] = DefaultPrice;
- HInfo[HID][hHouseID] = HID;
- }
- mysql_free_result();
- }
- public SaveHouse(houseid)
- {
- new query[400];
- format(query,sizeof(query),"UPDATE houses SET OwnedBy='%s',Location='%s',Price='%d',Interior='%d',iX='%f',iY='%f',iZ='%f',eX='%f',eY='%f',eZ='%f',Slots='%d',ForSale='%d',Locked='%d',DefaultPrice='%d' WHERE HouseID = '%d'",
- HInfo[houseid][hOwnedBy],
- HInfo[houseid][hLocation],
- HInfo[houseid][hPrice],
- HInfo[houseid][hInterior],
- HInfo[houseid][hiX],
- HInfo[houseid][hiY],
- HInfo[houseid][hiZ],
- HInfo[houseid][heX],
- HInfo[houseid][heY],
- HInfo[houseid][heZ],
- HInfo[houseid][hSlots],
- HInfo[houseid][hForSale],
- HInfo[houseid][hLocked],
- HInfo[houseid][hDefaultPrice],
- HInfo[houseid][hHouseID]);
- mysql_reconnect();
- mysql_query(query);
- printf("House ID %d saved to mysql.", houseid);
- }
- public SaveAccount(playerid)
- {
- if(IsPlayerConnected(playerid)) //is client connected ?? .. proceeding
- {
- if(PlayerSpawned[playerid] != 0) //is client logged in ?? .. proceeding
- {
- new date,month,year;
- getdate(date,month,year);
- new hour,minute,second;
- gettime(hour,minute,second);
- FixHour(hour);
- hour = shifthour+1;
- //--Notes:
- // - Register Date isn't saved/used.
- //--------
- //---MySQL Vulnerability Injection Data Variables ------------------
- new p_NAME[MAX_PLAYER_NAME], p_PASSWORD[128], p_REASON1[128], p_REASON2[128], p_REASON3[128], p_CALLSIGN[128], p_EMAIL[256];
- //---MySQL Vulnerability Injection Data Variables ------------------
- mysql_real_escape_string(PlayerName(playerid),p_NAME);
- mysql_real_escape_string(PInfo[playerid][Password], p_PASSWORD);
- mysql_real_escape_string(PInfo[playerid][Reason1], p_REASON1);
- mysql_real_escape_string(PInfo[playerid][Reason2], p_REASON2);
- mysql_real_escape_string(PInfo[playerid][Reason3], p_REASON3);
- mysql_real_escape_string(PInfo[playerid][Callsign], p_CALLSIGN);
- mysql_real_escape_string(PInfo[playerid][Email], p_EMAIL);
- mysql_reconnect();
- new query[1024];
- format(query,sizeof(query),"UPDATE users SET username='%s',password='%s',adminlevel='%d',ip='%s',lastlogin='%d/%d/%d %d:%d:%d',banned='%d',money='%d',at400f='%d',stuntf='%d',helif='%d',cargof='%d',militaryf='%d',shamalf='%d',dodof='%d',skimmerf='%d',muted='%d',hoursplayed='%d',minsplayed='%d',warning1='%d',reason1='%s',warning2='%d',reason2='%s',warning3='%d',reason3='%s',totaljobs='%d',totalscore='%d',androf='%d' WHERE username = '%s'",
- p_NAME,
- p_PASSWORD,
- PInfo[playerid][AdminLevel],
- PInfo[playerid][IP],
- year,month,date,hour,minute,second,
- PInfo[playerid][Banned],
- PInfo[playerid][Money],
- PInfo[playerid][AT400F],
- PInfo[playerid][STUNTF],
- PInfo[playerid][HELIF],
- PInfo[playerid][CARGOF],
- PInfo[playerid][MILITARYF],
- PInfo[playerid][SHAMALF],
- PInfo[playerid][DODOF],
- PInfo[playerid][SKIMMERF],
- PInfo[playerid][Muted],
- PInfo[playerid][HoursPlayed],
- PInfo[playerid][MinsPlayed],
- PInfo[playerid][Warning1],
- p_REASON1,
- PInfo[playerid][Warning2],
- p_REASON2,
- PInfo[playerid][Warning3],
- p_REASON3,
- PInfo[playerid][TotalJobs],
- PInfo[playerid][TotalScore],
- PInfo[playerid][ANDROF],
- p_NAME);
- mysql_query(query);
- format(query,sizeof(query),"UPDATE users SET beaglef='%d',cropdusterf='%d',hydraf='%d',nevadaf='%d',rustlerf='%d',cargobobf='%d',hunterf='%d',leviathanf='%d',maverickf='%d',nmaverickf='%d',pmaverickf='%d',raindancef='%d',seasparrowf='%d',sparrowf='%d',earntfromworking='%d',flightscompleted='%d',callsign='%s',callsignset='%d',emailaddress='%s',airline='%d',airlinerank='%d',earntforairline='%d',house1='%d',house2='%d',flowndistance='%d',airlineflights='%d',vip='%d',vipcolour='%s' WHERE username = '%s'",
- PInfo[playerid][BEAGLEF],
- PInfo[playerid][CROPDUSTERF],
- PInfo[playerid][HYDRAF],
- PInfo[playerid][NEVADAF],
- PInfo[playerid][RUSTLERF],
- PInfo[playerid][CARGOBOBF],
- PInfo[playerid][HUNTERF],
- PInfo[playerid][LEVIATHANF],
- PInfo[playerid][MAVERICKF],
- PInfo[playerid][NMAVERICKF],
- PInfo[playerid][PMAVERICKF],
- PInfo[playerid][RAINDANCEF],
- PInfo[playerid][SEASPARROWF],
- PInfo[playerid][SPARROWF],
- PInfo[playerid][EarntFromWorking],
- PInfo[playerid][FlightsCompleted],
- p_CALLSIGN,
- PInfo[playerid][CallsignSet],
- p_EMAIL,
- PInfo[playerid][Airline],
- PInfo[playerid][AirlineRank],
- PInfo[playerid][EarntForAirline],
- PInfo[playerid][House1],
- PInfo[playerid][House2],
- PInfo[playerid][FlownDistance],
- PInfo[playerid][AirlineFlights],
- PInfo[playerid][Vip],
- PInfo[playerid][VIPColour],
- p_NAME);
- mysql_query(query);
- format(query,sizeof(query),"UPDATE users SET tickets='%d',sspawn='%d',sskin='%d',spm='%d',svipsounds='%d',ownedskin='%d',sglobalsounds='%d',sconnectionmessages='%d',sautowork='%d' WHERE username='%s'",
- PInfo[playerid][Tickets],
- PInfo[playerid][sSpawn],
- PInfo[playerid][sSkin],
- PInfo[playerid][sPM],
- PInfo[playerid][sVIPSounds],
- PInfo[playerid][OwnedSkin],
- PInfo[playerid][sGlobalSounds],
- PInfo[playerid][sConnectionMessages],
- PInfo[playerid][sAutoWork],
- p_NAME);
- mysql_query(query);
- return 1;
- }
- }
- return 1;
- }
- public DisplayDialogForPlayer(playerid, dialogid)
- {
- switch(dialogid)
- {
- case 1:
- {
- ShowPlayerDialog(playerid,1,DIALOG_STYLE_PASSWORD,"{1B8AE4}Login","{FFFFFF}Welcome to the {1B8AE4}San Andreas Pilots\n\n{FFFFFF}This account is {1B8AE4}registered. {FFFFFF}To gain access, input your password below","Login","Quit");
- }
- case 2:
- {
- ShowPlayerDialog(playerid,2,DIALOG_STYLE_INPUT,"{1B8AE4}Registration","{FFFFFF}Welcome to the {1B8AE4}San Andreas Pilots\n\n{FFFFFF}Please {1B8AE4}register {FFFFFF}an account by typing a password below.","Register","Quit");
- }
- case 3: //Civilian Default Spawn Selection (Pilot)
- {
- ShowPlayerDialog(playerid,3,DIALOG_STYLE_LIST,"{FFFFFF}", "{1B8AE4}Los Santos\n{FFFFFF}San Fierro\n{1B8AE4}Las Venturas", "Spawn", "Cancel");
- }
- case 4:
- {
- ShowPlayerDialog(playerid,4,DIALOG_STYLE_LIST,"{FFFFFF}Select Class", "Pilot\nTrucker\nTaxi Driver\nCourrier Driver\n", "Select", "Cancel");
- }
- case showit2:
- {
- ShowPlayerDialog(playerid,showit2,DIALOG_STYLE_LIST,"{FFFFFF}Select an option", "{1B8AE4}Information & Statistics\n{FFFFFF}Donate\n{1B8AE4}Member List\n{FFFFFF}Fleet List\n{1B8AE4}Bank Account\n{FFFFFF}Airline Settings", "Choose", "Back");
- }
- case 5: //Military Default Spawn Selection (Pilot)
- {
- ShowPlayerDialog(playerid,55,DIALOG_STYLE_LIST,"{FFFFFF}Select Spawn Location.", "{1B8AE4}Area 51\n{FFFFFF}San Fierro Carrier", "Spawn", "Cancel");
- }
- case 8: //Civilian Default Spawn Selection (Pilot)
- {
- ShowPlayerDialog(playerid,8,DIALOG_STYLE_LIST,"{FFFFFF}", "{1B8AE4}Los Santos Depot\n{FFFFFF}San Fierro Depot\n{1B8AE4}Las Venturas Depot", "Spawn", "Cancel");
- }
- }
- return 1;
- }
- public timer_update()
- {
- for(new i=0;i<MAX_PLAYERS;i++) {
- if (IsPlayerInAnyVehicle(i))
- {
- new vid = GetPlayerVehicleID(i);
- switch(GetVehicleModel(vid))
- {
- case 520 , 577 , 511 , 592 , 512 , 513 , 519 , 593 , 553 , 476, 417 , 425, 447, 469, 487, 488, 497, 548, 563, 460:
- {
- if (GetPlayerVehicleSeat(i) == 0) {
- vfuel[vid] = vfuel[vid]-1;
- if (vfuel[vid]<1)
- {
- new engine, lights, alarm, doors, bonnet, boot, objective;
- GetVehicleParamsEx(vid, engine, lights, alarm, doors, bonnet, boot, objective);
- vfuel[vid] = 0;
- //RemovePlayerFromVehicle(i);
- GameTextForPlayer(i,"~r~You are out of ~w~fuel~r~!",5000,4);
- SetVehicleParamsEx(vid, 0, lights, alarm, doors, bonnet, boot, objective);
- }
- }
- }
- }
- }
- }
- return 1;
- }
- public ChangeWeather()
- {
- new rand = randomEx(1, 20);
- if(rand == 21 || rand == 9 || rand == 19 || rand == 8 || rand == 16)
- {
- ChangeWeather();
- return 1;
- }
- else
- {
- SetWeather(rand);
- }
- return 1;
- }
- public RandomMsg()
- {
- new rmsg[156];
- new rand = random(sizeof(Messages));
- format(rmsg,sizeof(rmsg),"%s", Messages[rand][Message]);
- SendClientMessageToAll(COLOR_RANDOMMSG, rmsg);
- }
- public RegisterAccount(playerid, password[])
- {
- if(IsPlayerConnected(playerid))
- {
- new string2[128];
- new date,month,year;
- getdate(date,month,year);
- new hour,minute,second;
- gettime(hour,minute,second);
- FixHour(hour);
- hour = shifthour+1;
- format(string2, sizeof(string2), "%d/%d/%d %d:%d:%d", year,month,date,hour,minute,second); //PASSWORD
- mysql_reconnect();
- new Query[200], EscPass[30], EscName[MAX_PLAYER_NAME];
- mysql_real_escape_string(PlayerName(playerid), EscName);
- mysql_real_escape_string(password, EscPass);
- format(Query, sizeof(Query), "INSERT INTO `users` (`username`, `password`, `registerdate`) VALUES ('%s', '%s', '%d/%d/%d %d:%d:%d')", EscName, EscPass, year,month,date,hour,minute,second);
- mysql_query(Query);
- }
- return 1;
- }
- public UnloadTextdraws(playerid)
- {
- TextDrawHideForPlayer(playerid, Textdraw1[playerid]);
- TextDrawHideForPlayer(playerid, Textdraw2[playerid]);
- TextDrawHideForPlayer(playerid, Textdraw3[playerid]);
- TextDrawHideForPlayer(playerid, Textdraw4[playerid]);
- TextDrawHideForPlayer(playerid, Textdraw5[playerid]);
- TextDrawHideForPlayer(playerid, Textdraw6[playerid]);
- TextDrawHideForPlayer(playerid, Textdraw7[playerid]);
- TextDrawHideForPlayer(playerid, Textdraw8[playerid]);
- TextDrawHideForPlayer(playerid, Textdraw9[playerid]);
- TextDrawHideForPlayer(playerid, Textdraw10[playerid]);
- TextDrawHideForPlayer(playerid, Textdraw11[playerid]);
- TextDrawHideForPlayer(playerid, Textdraw12[playerid]);
- TextDrawHideForPlayer(playerid, Textdraw13[playerid]);
- }
- public LoadTextdraws()
- {
- for(new playerid = 0; playerid <MAX_PLAYERS; playerid++)
- {
- TDLoaded[playerid] = 1;
- TextdrawNotice[playerid] = TextDrawCreate(497.000000, 111.000000, "Notice:");
- TextDrawBackgroundColor(TextdrawNotice[playerid], 255);
- TextDrawFont(TextdrawNotice[playerid], 0);
- TextDrawLetterSize(TextdrawNotice[playerid], 0.500000, 1.000000);
- TextDrawColor(TextdrawNotice[playerid], -16776961);
- TextDrawSetOutline(TextdrawNotice[playerid], 1);
- TextDrawSetProportional(TextdrawNotice[playerid], 1);
- //Create second one
- TextdrawNoticeText[playerid] = TextDrawCreate(498.000000, 120.000000, "Empty");
- TextDrawBackgroundColor(TextdrawNoticeText[playerid], 255);
- TextDrawFont(TextdrawNoticeText[playerid], 1);
- TextDrawLetterSize(TextdrawNoticeText[playerid], 0.240000, 1.000000);
- TextDrawColor(TextdrawNoticeText[playerid], -1);
- TextDrawSetOutline(TextdrawNoticeText[playerid], 0);
- TextDrawSetProportional(TextdrawNoticeText[playerid], 1);
- TextDrawSetShadow(TextdrawNoticeText[playerid], 1);
- TextDrawUseBox(TextdrawNoticeText[playerid], 1);
- TextDrawBoxColor(TextdrawNoticeText[playerid], 0x00000076);
- TextDrawTextSize(TextdrawNoticeText[playerid], 633.000000, 0.000000);
- //PANEL.
- Textdraw0[playerid] = TextDrawCreate(502.000000,302.000000,"Los Santos Airport Gate A");
- Textdraw1[playerid] = TextDrawCreate(502.000000,330.000000,"Prickle Pine Airport Gate 1");
- Textdraw2[playerid] = TextDrawCreate(501.000000,287.000000,"GPS:");
- Textdraw3[playerid] = TextDrawCreate(501.000000,315.000000,"Destination:");
- Textdraw4[playerid] = TextDrawCreate(502.000000,358.000000,"100 Percent");
- Textdraw5[playerid] = TextDrawCreate(501.000000,346.000000,"Fuel:");
- Textdraw6[playerid] = TextDrawCreate(571.000000,358.000000,"100 Percent");
- Textdraw7[playerid] = TextDrawCreate(572.000000,345.000000,"Health:");
- Textdraw8[playerid] = TextDrawCreate(502.000000,389.000000,"135 KPH");
- Textdraw9[playerid] = TextDrawCreate(502.000000,377.000000,"Speed:");
- Textdraw10[playerid] = TextDrawCreate(591.000000,388.000000,"350");
- Textdraw11[playerid] = TextDrawCreate(573.000000,375.000000,"Altitude:");
- Textdraw12[playerid] = TextDrawCreate(591.000000,418.000000,"");
- Textdraw13[playerid] = TextDrawCreate(573.000000,405.000000,"Heading:");
- Textdraw12[playerid] = TextDrawCreate(574.000000,419.000000,"360");
- TextDrawUseBox(Textdraw12[playerid],1);
- TextDrawBoxColor(Textdraw12[playerid],0x00000033);
- TextDrawTextSize(Textdraw12[playerid],662.000000,0.000000);
- TextDrawAlignment(Textdraw12[playerid],0);
- TextDrawBackgroundColor(Textdraw12[playerid],0x000000ff);
- TextDrawFont(Textdraw12[playerid],1);
- TextDrawLetterSize(Textdraw12[playerid],0.399999,1.100000);
- TextDrawColor(Textdraw12[playerid],0xffffffff);
- TextDrawSetOutline(Textdraw12[playerid],1);
- TextDrawSetProportional(Textdraw12[playerid],1);
- TextDrawSetShadow(Textdraw12[playerid],1);
- TextDrawUseBox(Textdraw0[playerid],1);
- TextDrawBoxColor(Textdraw0[playerid],0x00000033);
- TextDrawTextSize(Textdraw0[playerid],656.000000,8.000000);
- TextDrawUseBox(Textdraw1[playerid],1);
- TextDrawBoxColor(Textdraw1[playerid],0x00000033);
- TextDrawTextSize(Textdraw1[playerid],661.000000,0.000000);
- TextDrawUseBox(Textdraw4[playerid],1);
- TextDrawBoxColor(Textdraw4[playerid],0x00000033);
- TextDrawTextSize(Textdraw4[playerid],650.000000,-1.000000);
- TextDrawUseBox(Textdraw8[playerid],1);
- TextDrawBoxColor(Textdraw8[playerid],0x00000033);
- TextDrawTextSize(Textdraw8[playerid],674.000000,0.000000);
- TextDrawBoxColor(Textdraw12[playerid],0x00000033);
- TextDrawAlignment(Textdraw0[playerid],0);
- TextDrawAlignment(Textdraw1[playerid],0);
- TextDrawAlignment(Textdraw2[playerid],0);
- TextDrawAlignment(Textdraw3[playerid],0);
- TextDrawAlignment(Textdraw4[playerid],0);
- TextDrawAlignment(Textdraw5[playerid],0);
- TextDrawAlignment(Textdraw6[playerid],0);
- TextDrawAlignment(Textdraw7[playerid],0);
- TextDrawAlignment(Textdraw8[playerid],0);
- TextDrawAlignment(Textdraw9[playerid],0);
- TextDrawAlignment(Textdraw10[playerid],0);
- TextDrawAlignment(Textdraw11[playerid],0);
- TextDrawAlignment(Textdraw13[playerid],0);
- TextDrawBackgroundColor(Textdraw0[playerid],0x000000ff);
- TextDrawBackgroundColor(Textdraw1[playerid],0x000000ff);
- TextDrawBackgroundColor(Textdraw2[playerid],0x000000ff);
- TextDrawBackgroundColor(Textdraw3[playerid],0x000000ff);
- TextDrawBackgroundColor(Textdraw4[playerid],0x000000ff);
- TextDrawBackgroundColor(Textdraw5[playerid],0x000000ff);
- TextDrawBackgroundColor(Textdraw6[playerid],0x000000ff);
- TextDrawBackgroundColor(Textdraw7[playerid],0x000000ff);
- TextDrawBackgroundColor(Textdraw8[playerid],0x000000ff);
- TextDrawBackgroundColor(Textdraw9[playerid],0x000000ff);
- TextDrawBackgroundColor(Textdraw10[playerid],0x000000ff);
- TextDrawBackgroundColor(Textdraw11[playerid],0x000000ff);
- TextDrawBackgroundColor(Textdraw13[playerid],0x000000ff);
- TextDrawFont(Textdraw0[playerid],1);
- TextDrawLetterSize(Textdraw0[playerid],0.199999,1.100000);
- TextDrawFont(Textdraw1[playerid],1);
- TextDrawLetterSize(Textdraw1[playerid],0.199999,1.100000);
- TextDrawFont(Textdraw2[playerid],2);
- TextDrawLetterSize(Textdraw2[playerid],0.399999,1.800000);
- TextDrawFont(Textdraw3[playerid],2);
- TextDrawLetterSize(Textdraw3[playerid],0.299999,1.800000);
- TextDrawFont(Textdraw4[playerid],1);
- TextDrawLetterSize(Textdraw4[playerid],0.299999,1.100000);
- TextDrawFont(Textdraw5[playerid],2);
- TextDrawLetterSize(Textdraw5[playerid],0.399999,1.400000);
- TextDrawFont(Textdraw6[playerid],1);
- TextDrawLetterSize(Textdraw6[playerid],0.299999,1.100000);
- TextDrawFont(Textdraw7[playerid],2);
- TextDrawLetterSize(Textdraw7[playerid],0.299999,1.500000);
- TextDrawFont(Textdraw8[playerid],1);
- TextDrawLetterSize(Textdraw8[playerid],0.399999,1.100000);
- TextDrawFont(Textdraw9[playerid],2);
- TextDrawLetterSize(Textdraw9[playerid],0.399999,1.300000);
- TextDrawFont(Textdraw10[playerid],1);
- TextDrawLetterSize(Textdraw10[playerid],0.399999,1.200000);
- TextDrawFont(Textdraw11[playerid],2);
- TextDrawLetterSize(Textdraw11[playerid],0.299999,1.600000);
- TextDrawFont(Textdraw13[playerid],2);
- TextDrawLetterSize(Textdraw13[playerid],0.299999,1.600000);
- TextDrawColor(Textdraw0[playerid],0xffffffff);
- TextDrawColor(Textdraw1[playerid],0xffffffff);
- TextDrawColor(Textdraw2[playerid],0x00ffffcc);
- TextDrawColor(Textdraw3[playerid],0x00ffffcc);
- TextDrawColor(Textdraw4[playerid],0xffffffff);
- TextDrawColor(Textdraw5[playerid],0x00ffffcc);
- TextDrawColor(Textdraw6[playerid],0xffffffff);
- TextDrawColor(Textdraw7[playerid],0x00ffffcc);
- TextDrawColor(Textdraw8[playerid],0xffffffff);
- TextDrawColor(Textdraw9[playerid],0x00ffffcc);
- TextDrawColor(Textdraw10[playerid],0xffffffff);
- TextDrawColor(Textdraw11[playerid],0x00ffffcc);
- TextDrawColor(Textdraw13[playerid],0x00ffffcc);
- TextDrawSetOutline(Textdraw0[playerid],1);
- TextDrawSetOutline(Textdraw1[playerid],1);
- TextDrawSetOutline(Textdraw2[playerid],1);
- TextDrawSetOutline(Textdraw3[playerid],1);
- TextDrawSetOutline(Textdraw4[playerid],1);
- TextDrawSetOutline(Textdraw5[playerid],1);
- TextDrawSetOutline(Textdraw6[playerid],1);
- TextDrawSetOutline(Textdraw7[playerid],1);
- TextDrawSetOutline(Textdraw8[playerid],1);
- TextDrawSetOutline(Textdraw9[playerid],1);
- TextDrawSetOutline(Textdraw10[playerid],1);
- TextDrawSetOutline(Textdraw11[playerid],1);
- TextDrawSetOutline(Textdraw13[playerid],1);
- TextDrawSetProportional(Textdraw0[playerid],1);
- TextDrawSetProportional(Textdraw1[playerid],1);
- TextDrawSetProportional(Textdraw2[playerid],1);
- TextDrawSetProportional(Textdraw3[playerid],1);
- TextDrawSetProportional(Textdraw4[playerid],1);
- TextDrawSetProportional(Textdraw5[playerid],1);
- TextDrawSetProportional(Textdraw6[playerid],1);
- TextDrawSetProportional(Textdraw7[playerid],1);
- TextDrawSetProportional(Textdraw8[playerid],1);
- TextDrawSetProportional(Textdraw9[playerid],1);
- TextDrawSetProportional(Textdraw10[playerid],1);
- TextDrawSetProportional(Textdraw11[playerid],1);
- TextDrawSetProportional(Textdraw13[playerid],1);
- TextDrawSetShadow(Textdraw0[playerid],1);
- TextDrawSetShadow(Textdraw1[playerid],1);
- TextDrawSetShadow(Textdraw2[playerid],1);
- TextDrawSetShadow(Textdraw3[playerid],1);
- TextDrawSetShadow(Textdraw4[playerid],1);
- TextDrawSetShadow(Textdraw5[playerid],1);
- TextDrawSetShadow(Textdraw6[playerid],1);
- TextDrawSetShadow(Textdraw7[playerid],1);
- TextDrawSetShadow(Textdraw8[playerid],1);
- TextDrawSetShadow(Textdraw9[playerid],1);
- TextDrawSetShadow(Textdraw10[playerid],1);
- TextDrawSetShadow(Textdraw11[playerid],1);
- TextDrawSetShadow(Textdraw13[playerid],1);
- }
- }
- public PlayerLogin(playerid,password[])
- {
- mysql_reconnect();
- new EscPass[128], EscName[128], Query[128];
- mysql_real_escape_string(PlayerName(playerid), EscName);
- mysql_real_escape_string(password, EscPass);
- format(Query, sizeof(Query), "SELECT * FROM `users` WHERE `username` = '%s' AND `password` = '%s'", EscName, EscPass);
- mysql_query(Query);
- mysql_store_result();
- if(mysql_num_rows() > 0)
- { // player logged in.
- new line[1250];
- if(mysql_fetch_row(line)) //Fetches the line
- {
- new string2[128];
- new data[11][128]; //The data strings
- new data2[56]; //The data variables
- //new Float:data3[5]; //The data floats
- sscanf(line, "p<|>s[128]s[128]ds[128]s[128]ddddddddddddddsds[128]ds[128]dddddddddddddddddddds[128]s[128]ds[128]ddddddddds[128]ddddddddd", data[0], data[1], data2[0], data[2], data[3], data2[1], data2[2], data2[3], data2[4], data2[5], data2[6], data2[7], data2[8], data2[9], data2[10], data2[11], data2[12], data2[13], data2[14], data[4], data2[15], data[5], data2[16], data[6], data2[17], data2[18], data2[19],
- data2[20], data2[21], data2[22], data2[23], data2[24], data2[25], data2[26], data2[27], data2[28], data2[29], data2[30], data2[31], data2[32], data2[33], data2[34], data2[35], data2[36], data[7], data[8], data2[37], data[9], data2[38], data2[39], data2[40], data2[41],data2[42],data2[43],data2[44],data2[45],data2[46],data[10],data2[47], data2[48],data2[49],data2[50],data2[51],data2[52],data2[53],data2[54],data2[55]); //Splits the line with sscanf
- format(string2, sizeof(string2), "%s", data[1]); //PASSWORD
- strmid(PInfo[playerid][Password], string2, 0, strlen(string2), 128); //PASSWORD
- PInfo[playerid][AdminLevel] = data2[0];
- format(string2, sizeof(string2), "%s", data[3]); //last login date+time
- strmid(PInfo[playerid][LastLogin], string2, 0, strlen(string2), 128); //last login date+time
- PInfo[playerid][Banned] = data2[1];
- PInfo[playerid][Money] = data2[2];
- PInfo[playerid][AT400F] = data2[3];
- PInfo[playerid][STUNTF] = data2[4];
- PInfo[playerid][HELIF] = data2[5];
- PInfo[playerid][CARGOF] = data2[6];
- PInfo[playerid][MILITARYF] = data2[7];
- PInfo[playerid][SHAMALF] = data2[8];
- PInfo[playerid][DODOF] = data2[9];
- PInfo[playerid][SKIMMERF] = data2[10];
- PInfo[playerid][Muted] = data2[11];
- PInfo[playerid][HoursPlayed] = data2[12];
- PInfo[playerid][MinsPlayed] = data2[13];
- PInfo[playerid][Warning1] = data2[14];
- format(string2, sizeof(string2), "%s", data[4]);
- strmid(PInfo[playerid][Reason1], string2, 0, strlen(string2), 128);
- PInfo[playerid][Warning2] = data2[15];
- format(string2, sizeof(string2), "%s", data[5]);
- strmid(PInfo[playerid][Reason2], string2, 0, strlen(string2), 128);
- PInfo[playerid][Warning3] = data2[16];
- format(string2, sizeof(string2), "%s", data[6]);
- strmid(PInfo[playerid][Reason3], string2, 0, strlen(string2), 128);
- PInfo[playerid][TotalJobs] = data2[17];
- PInfo[playerid][TotalScore] = data2[18];
- PInfo[playerid][ANDROF] = data2[19];
- PInfo[playerid][BEAGLEF] = data2[20];
- PInfo[playerid][CROPDUSTERF] = data2[21];
- PInfo[playerid][HYDRAF] = data2[22];
- PInfo[playerid][NEVADAF] = data2[23];
- PInfo[playerid][RUSTLERF] = data2[24];
- PInfo[playerid][CARGOBOBF] = data2[25];
- PInfo[playerid][HUNTERF] = data2[26];
- PInfo[playerid][LEVIATHANF] = data2[27];
- PInfo[playerid][MAVERICKF] = data2[28];
- PInfo[playerid][NMAVERICKF] = data2[29];
- PInfo[playerid][PMAVERICKF] = data2[30];
- PInfo[playerid][RAINDANCEF] = data2[31];
- PInfo[playerid][SEASPARROWF] = data2[32];
- PInfo[playerid][SPARROWF] = data2[33];
- PInfo[playerid][Online] = data2[34];
- PInfo[playerid][EarntFromWorking] = data2[35];
- PInfo[playerid][FlightsCompleted] = data2[36];
- format(string2, sizeof(string2), "%s", data[7]);
- strmid(PInfo[playerid][RegisterDate], string2, 0, strlen(string2), 128);
- format(string2, sizeof(string2), "%s", data[8]);
- strmid(PInfo[playerid][Callsign], string2, 0, strlen(string2), 64);
- PInfo[playerid][CallsignSet] = data2[37];
- format(string2, sizeof(string2), "%s", data[9]);
- strmid(PInfo[playerid][Email], string2, 0, strlen(string2), 256);
- PInfo[playerid][MemberID] = data2[38];
- PInfo[playerid][Airline] = data2[39];
- PInfo[playerid][AirlineRank] = data2[40];
- PInfo[playerid][EarntForAirline] = data2[41];
- PInfo[playerid][House1] = data2[42];
- PInfo[playerid][House2] = data2[43];
- PInfo[playerid][FlownDistance] = data2[44];
- PInfo[playerid][AirlineFlights] = data2[45];
- PInfo[playerid][Vip] = data2[46];
- format(string2, sizeof(string2), "%s", data[10]); //last login date+time
- strmid(PInfo[playerid][VIPColour], string2, 0, strlen(string2), 128); //last login date+time
- PInfo[playerid][Tickets] = data2[47];
- PInfo[playerid][sSpawn] = data2[48];
- PInfo[playerid][sSkin] = data2[49];
- PInfo[playerid][sPM] = data2[50];
- PInfo[playerid][sVIPSounds] = data2[51];
- PInfo[playerid][OwnedSkin] = data2[52];
- PInfo[playerid][sGlobalSounds] = data2[53];
- PInfo[playerid][sConnectionMessages] = data2[54];
- PInfo[playerid][sAutoWork] = data2[55];
- mysql_free_result();
- }
- new string[250];
- //LoadPlayer(playerid);
- mysql_free_result();
- SessionStatus[playerid] = 2; //Logged in successfully. Show disconnect messages
- //if(PInfo[playerid][Banned] == 1) { CheckBanned(playerid); }
- PlayerLogged[playerid] = 1;
- SendClientMessage(playerid, COLOR_GREEN, "You have successfully been logged in.");
- new plrIP[16];
- GetPlayerIp(playerid, plrIP, sizeof(plrIP));
- GivePlayerMoney(playerid, PInfo[playerid][Money]);
- strmid(PInfo[playerid][IP], plrIP, 0, strlen(plrIP), 255);
- if(JustRegistered[playerid] == 0)
- {
- new login[156];
- format(login, sizeof(login), "{1B8AE4}%s (%d) {FFFFFF}has logged into the server.", PlayerName(playerid), playerid);
- for(new i = 0; i <MAX_PLAYERS; i++)
- {
- if(IsPlayerConnected(i))
- {
- if(PInfo[i][sConnectionMessages] == 0)
- {
- SendClientMessage(i, COLOR_YELLOW, login);
- }
- }
- }
- }
- if(PInfo[playerid][AdminLevel] > 0) { format(string, sizeof(string), "You have authorized as a level %d administrator.", PInfo[playerid][AdminLevel]); SendClientMessage(playerid, COLOR_SECURITY, string); }
- if(JustRegistered[playerid] == 0) { format(string, sizeof(string), "{FFFFFF}Welcome back to the San Andreas Pilots, {1B8AE4}%s {FFFFFF}- {1B8AE4}[Last session: %s | %s]", PlayerName(playerid), PInfo[playerid][IP], PInfo[playerid][LastLogin]); SendClientMessage(playerid, COLOR_MESSAGE, string); }
- UpdateScore(playerid);
- PInfo[playerid][Online] = 1;
- YourOnline(playerid);
- CanAdvertiseAgain[playerid] = 1;
- if(PInfo[playerid][Airline] > 0)
- {
- format(string,sizeof(string),"AMOTD: %s | Set by: %s", AInfo[PInfo[playerid][Airline]][aMotd], AInfo[PInfo[playerid][Airline]][aMotdSetBy]);
- SendClientMessage(playerid, COLOR_YELLOW, string);
- }
- new motdstring[256];
- format(motdstring,sizeof(motdstring),"MOTD: %s | Set by: %s", ServerMOTD, ServerMOTDSetBy);
- SendClientMessage(playerid, COLOR_YELLOW, motdstring);
- if(PInfo[playerid][CallsignSet] == 0)
- {
- new msg[64];
- format(msg,sizeof(msg),"LoF");
- strmid(PInfo[playerid][Callsign], msg, 0, strlen(msg), 64);
- PInfo[playerid][CallsignSet] = 1;
- }
- }
- else
- { // player incorrect password.
- SendClientMessage(playerid, COLOR_SECURITY, "Invalid password. Please try again, or request a password reset on the forums.");
- DisplayDialogForPlayer(playerid, 1);
- mysql_free_result();
- }
- }
- public OnGameModeExit()
- {
- PlayersOnline = 0;
- OnlineTimer();
- KillTimer(onlinetimer);
- KillTimer(randomtimer);
- mysql_close();
- ExitMapSystem();
- return 1;
- }
- public OnPlayerRequestClass(playerid, classid)
- {
- TogglePlayerControllable(playerid, false);
- SetPlayerPos(playerid,1933.6263,-2399.9102,1201.7321);
- SetPlayerCameraPos(playerid, 1931.7674, -2417.5302, 1205.6908);
- SetPlayerCameraLookAt(playerid, 1931.7674, -2417.5202, 1200.6908);
- if(PlayerLogged[playerid] == 0)
- {
- mysql_reconnect();
- new Query[90], EscName[MAX_PLAYER_NAME];
- mysql_real_escape_string(PlayerName(playerid), EscName);
- format(Query, sizeof(Query), "SELECT * FROM `users` WHERE `username` = '%s'", EscName);
- mysql_query(Query);
- mysql_store_result();
- if(mysql_num_rows() != 0)
- {
- mysql_free_result();
- SendClientMessage(playerid, COLOR_SECURITY, "Please enter your password below to continue.");
- DisplayDialogForPlayer(playerid, 1);
- return 0;
- }
- else
- {
- mysql_free_result();
- SendClientMessage(playerid, COLOR_SECURITY, "Please enter a password below to register an account.");
- DisplayDialogForPlayer(playerid, 2);
- return 0;
- }
- }
- return 1;
- }
- public OnPlayerConnect(playerid)
- {
- PlayersOnline++;
- SessionStatus[playerid] = 1; //Connected. Do not show messages.
- if(GlobalStatus == 2)
- {
- SendClientMessage(playerid, COLOR_SECURITY, "A MySQL error has occured. Please visit the forums for further details.");
- Kick(playerid);
- }
- if(PlayersOnline > ServerMaxPlayers && sTrackPlayers == 1)
- {
- new msg[256];
- format(msg,sizeof(msg),"Life of Flying has reached a new top player count! (Previously %d online players at %s - %s)",ServerMaxPlayers,ServerMaxPlayersDate,ServerMaxPlayersTime);
- SendClientMessageToAll(COLOR_VIP, msg);
- ServerMaxPlayers = PlayersOnline;
- new date,month,year;
- getdate(date,month,year);
- new hour,minute,second;
- gettime(hour,minute,second);
- new string[128];
- format(string,sizeof(string),"%d/%d/%d",year,month,date);
- strmid(ServerMaxPlayersDate, string, 0, strlen(string), 128);
- format(string,sizeof(string),"%d:%d:%d",hour,minute,second);
- strmid(ServerMaxPlayersTime, string, 0, strlen(string), 128);
- SaveStuff();
- }
- CheckIPS(playerid);
- PurelySpawned[playerid] = 0;
- ResetMissionData(playerid);
- ResetPlayerData(playerid);
- CheckBanned(playerid);
- RemoveObjectsForPlayer(playerid);
- ResetPlayerData(playerid);
- UpdatePlayerColour(playerid);
- TextDrawShowForPlayer(playerid, Clockzz);
- MapSystemAddPlayer(playerid);
- PlayerPlaySound(playerid, 1187, 0, 0, 0); // Start the music
- if(PlayerLogged[playerid] == 0)
- {
- mysql_reconnect();
- new Query[90], EscName[MAX_PLAYER_NAME];
- mysql_real_escape_string(PlayerName(playerid), EscName);
- format(Query, sizeof(Query), "SELECT NULL FROM `users` WHERE `username` = '%s'", EscName);
- mysql_query(Query);
- mysql_store_result();
- if(mysql_num_rows() != 0)
- {
- mysql_free_result();
- SendClientMessage(playerid, COLOR_SECURITY, "Please enter your password below to continue.");
- DisplayDialogForPlayer(playerid, 1);
- return 0;
- }
- else
- {
- PlayerPlaySound(playerid, 44204, 0, 0, 0);
- mysql_free_result();
- SendClientMessage(playerid, COLOR_SECURITY, "Please enter a password below to register an account.");
- DisplayDialogForPlayer(playerid, 2);
- return 0;
- }
- }
- return 1;
- }
- public OnPlayerDisconnect(playerid, reason)
- {
- PlayersOnline--;
- if(ListeningToRadio[playerid] == 1) { StopAudioStreamForPlayer(playerid); ListeningToRadio[playerid] = 0; }
- if(TDLoaded[playerid] == 1) { UnloadTextdraws(playerid); }
- YourOffline(playerid);
- new string[128];
- if(SessionStatus[playerid] == 2)
- {
- switch(reason)
- {
- case 0: format(string, sizeof(string), "{1B8AE4}%s (%d) {FFFFFF}has timed out from the server.", PlayerName(playerid), playerid);
- case 1: format(string, sizeof(string), "{1B8AE4}%s (%d) {FFFFFF}has left the server.", PlayerName(playerid), playerid);
- case 2: format(string, sizeof(string), "{1B8AE4}%s (%d) {FFFFFF}has been kicked/banned from the server.", PlayerName(playerid), playerid);
- }
- for(new i = 0; i <MAX_PLAYERS; i++)
- {
- if(IsPlayerConnected(i))
- {
- if(PInfo[i][sConnectionMessages] == 0)
- {
- SendClientMessage(i, COLOR_WHITE, string);
- }
- }
- }
- }
- if(SessionStatus[playerid] == 3) { format(string,sizeof(string), "{1B8AE4}%s (%d) {FFFFFF}has left the server.", PlayerName(playerid), playerid); SendClientMessageToAll(COLOR_WHITE, string); }
- if(PlayerLogged[playerid] == 1 && GettingBanned[playerid] == 0)
- {
- SaveAccount(playerid);
- }
- MapSystemRemovePlayer(playerid);
- return 1;
- }
- public OnPlayerSpawn(playerid)
- {
- if(ChosenClass[playerid] == 0) { DisplayDialogForPlayer(playerid, 4); return 1; }
- AntiDeAMX();
- /*if(gTeam[playerid] == TEAM_PILOTS)
- {
- SetPlayerPos(x,y,z pilot);
- //SetPlayerTeamColor(playerid);
- GameTextForPlayer(playerid,"~g~Type ~r~~h~/work ~g~to start working",4000,3);
- SendClientMessage(playerid,COLOR_WHITE,"» You are a {1B8AE4}Pilot.{FFFFFF} Type {1B8AE4}/work{FFFFFF} inside of an aircraft to start working.");
- SendClientMessage(playerid,COLOR_WHITE,"» You can type {1B8AE4}/phelp {FFFFFF}for your role's commands, or type {1B8AE4}/helpFFFFFF} for general server help.");
- */
- if(WasSpectating[playerid] == 1)
- {
- PurelySpawned[playerid] = 1;
- SetPlayerInterior(playerid, tempinterior[playerid]);
- SetPlayerHealth(playerid, 100);
- SetPlayerPos(playerid, tempX[playerid], tempY[playerid], tempZ[playerid]);
- SetPlayerFacingAngle(playerid, tempA[playerid]);
- UpdateSkin(playerid);
- UpdatePlayerColour(playerid);
- return 1;
- }
- RespawnPlayer(playerid);
- return 1;
- }
- public OnPlayerDeath(playerid, killerid, reason)
- {
- ChosenClass[playerid] = 0;
- if(killerid != 65535)
- {
- new dmsg[128];
- format(dmsg, sizeof(dmsg), "[DM] %s(%d) has killed %s(%d)",PlayerName(killerid),killerid,PlayerName(playerid),playerid);
- ABroadCast(COLOR_ADMIN,dmsg,1); //
- SendClientMessage(killerid, COLOR_ERROR, "Do not kill or deathmatch players. [Please read the /rules before continuing]");
- }
- if(ListeningToRadio[playerid] == 1)
- {
- StopAudioStreamForPlayer(playerid);
- ListeningToRadio[playerid] = 0;
- }
- if(InHouse[playerid] > 0)
- {
- SetPlayerInterior(playerid, 0);
- SetPlayerVirtualWorld(playerid, 0);
- }
- if(StartedMission[playerid] == 1)
- {
- ResetMissionData(playerid);
- }
- SessionFlights[playerid] = 0;
- return 1;
- }
- public OnVehicleSpawn(vehicleid)
- {
- new engine, lights, alarm, doors, bonnet, boot, objective;
- GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
- if(vfuel[vehicleid] > 0)
- {
- SetVehicleParamsEx(vehicleid,1,lights,alarm,doors,bonnet,boot,objective);
- }
- else
- {
- SetVehicleParamsEx(vehicleid,0,lights,alarm,doors,bonnet,boot,objective);
- }
- if(gDestroyVehicle[vehicleid]) // if vehicle id is marked for deletion
- {
- ////foreach(Player, i) // for all players
- for(new i; i<MAX_PLAYERS; i++)
- {
- if(IsPlayerConnected(i) && IsPlayerInVehicle(i,vehicleid)) // if connected and in vehicleid
- {
- RemovePlayerFromVehicle(i); // remove from vehicle
- }
- }
- SetVehicleVirtualWorld(vehicleid,255); // set vehicle to unused vw to prevent players from using it
- SetTimerEx("KillCar",10000,0,"d",vehicleid);
- for(new i = 0; i < sizeof(CreatedCars); i++)
- {
- if(CreatedCars[i] == vehicleid)
- {
- CreatedCars[i] = INVALID_VEHICLE_ID;
- break;
- }
- }
- }
- for(new i = 0; i < sizeof(PVInfo); i++)
- {
- if(vehicleid == PVInfo[i][vpVehicleSpawned])
- {
- ModVehicle(vehicleid);
- }
- }
- return 1;
- }
- public OnVehicleDeath(vehicleid, killerid)
- {
- return 1;
- }
- public OnPlayerText(playerid, text[])
- {
- if(IsIp(text) && PInfo[playerid][AdminLevel] < 3)
- {
- new string[256];
- format(string, sizeof(string), "{1B8AE4}%s (%d){FFFFFF} has been autokicked by anti-cheat {1B8AE4}TroubleMaker{FFFFFF} • {1B8AE4}[Reason: Server IP Detected]", PlayerName(playerid),playerid);
- SendClientMessageToAll(COLOR_ERROR, string);
- Kick(playerid);
- return 0;
- }
- if(AFKPLAYER[playerid] == 1)
- {
- TogglePlayerControllable(playerid, 1);
- new result[156];
- format(result, sizeof(result), "Player {1B8AE4}%s (%d) {FFFFFF}is now back • {1B8AE4}[Reason: %s]", PlayerName(playerid),playerid,AFKREASON[playerid]);
- SendClientMessageToAll(COLOR_WHITE, result);
- AFKPLAYER[playerid] = 0;
- UpdatePlayerColour(playerid);
- }
- if(PlayerLogged[playerid] == 0) { SendClientMessage(playerid, COLOR_ERROR, "You are not logged in !"); return 0; }
- if(PInfo[playerid][Muted] == 1) { SendClientMessage(playerid, COLOR_ERROR, "You are muted and cannot talk! - Apply for an unmute request on the forums."); return 0; }
- if(text[0] == '@')
- {
- new rmsg[256];
- format(rmsg, sizeof(rmsg), "@%s(%d): %s", PInfo[playerid][Callsign], playerid, text[1]);
- SendClientMessageToAll(COLOR_RADIO, rmsg);
- return 0;
- }
- new string[256];
- if(VIPName[playerid] == 1)
- {
- format(string,sizeof(string),"{84538A}%s (%d): {%s}%s", PlayerName(playerid),playerid,PInfo[playerid][VIPColour],text);
- SendClientMessageToAll(COLOR_WHITE, string);
- UCPChat1(playerid, text);
- }
- else if(gTeam[playerid] == TEAM_CPILOT)
- {
- format(string,sizeof(string),"{008000}%s (%d): {FFFFFF}%s", PlayerName(playerid),playerid,text);
- SendClientMessageToAll(COLOR_WHITE, string);
- UCPChat1(playerid, text);
- }
- else if(gTeam[playerid] == TEAM_MILITARY)
- {
- format(string,sizeof(string),"{B2DD5D}%s (%d): {FFFFFF}%s", PlayerName(playerid),playerid,text);
- SendClientMessageToAll(COLOR_WHITE, string);
- UCPChat1(playerid, text);
- }
- return 0;
- }
- stock RemoveUnderScore(message[])
- {
- for(new i = 0; i < 255; i++)
- {
- if(message[i] == '_') message[i] = ' ';
- }
- return message;
- }
- stock GiveNameSpace(nstring[])
- {
- new strl;
- strl=strlen(nstring)-1;
- while(strl >= 0)
- {
- if(nstring[strl]=='_')
- nstring[strl]=' ';
- strl--;
- }
- return nstring;
- }
- public OnPlayerCommandText(playerid, cmdtext[])
- {
- if(PInfo[playerid][Muted] == 1) { SendClientMessage(playerid, COLOR_ERROR, "You are muted and cannot talk! - Apply for an unmute request on the forums."); return 0; }
- if(PlayerLogged[playerid] == 0) { SendClientMessage(playerid, COLOR_ERROR, "You are not logged in!"); return 0; }
- new sendername[MAX_PLAYER_NAME], idx, string[256];
- new cmd[128];
- new tmp[256];
- cmd = strtok(cmdtext, idx);
- format(tmp,sizeof(tmp),"%s(%d) - (%s)",PlayerName(playerid),playerid,cmdtext);
- print(tmp);
- if(AFKPLAYER[playerid] == 1)
- {
- TogglePlayerControllable(playerid, 1);
- new result[156];
- format(result, sizeof(result), "Player {1B8AE4}%s (%d) {FFFFFF}is now back • {1B8AE4}[Reason: %s]", PlayerName(playerid),playerid,AFKREASON[playerid]);
- SendClientMessageToAll(COLOR_WHITE, result);
- AFKPLAYER[playerid] = 0;
- UpdatePlayerColour(playerid);
- return 1;
- }
- if(strcmp(cmd, "/claimcoupon", true) == 0 || strcmp(cmd, "/redeem", true) == 0)
- {
- new title[64], msg[128];
- format(title,sizeof(title),"{1B8AE4}Claim Coupon");
- format(msg,sizeof(msg),"Type the coupon code below to\nclaim your reward:");
- ShowPlayerDialog(playerid, coupon1, DIALOG_STYLE_INPUT, title, msg, "Claim", "Cancel");
- return 1;
- }
- if(strcmp(cmd, "/flightstreak", true) == 0)
- {
- new msg[256];
- format(msg,sizeof(msg),"[Flight Streak] The current winner is {1B8AE4}%s {FFFFFF}with a total flight streak of {1B8AE4}%d [%s %s]",ServerMaxFlightStreakWinner, ServerMaxFlightStreak, ServerMaxFlightStreakTime, ServerMaxFlightStreakDate);
- SendClientMessage(playerid, COLOR_WHITE, msg);
- format(msg,sizeof(msg),"[Flight Streak] Your current flight streak is {1B8AE4}%d!", SessionFlights[playerid]);
- SendClientMessage(playerid, COLOR_WHITE, msg);
- return 1;
- }
- if(strcmp(cmd, "/potd", true) == 0)
- {
- new msg[256];
- format(msg,sizeof(msg),"[POTD] The current Pilot of the Day is {1B8AE4}%s {FFFFFF}with total earnings of {1B8AE4}$%d{FFFFFF}.", POTD_WinnerName, POTD_FinalAmount2);
- SendClientMessage(playerid, COLOR_WHITE, msg);
- return 1;
- }
- if(strcmp(cmd, "/aotd", true) == 0)
- {
- new msg[256];
- format(msg,sizeof(msg),"[AOTD] The current Airline of the Day is {1B8AE4}%s {FFFFFF}with total earnings of {1B8AE4}$%d{FFFFFF}.", AOTD_WinnerName, AOTD_FinalAmount2);
- SendClientMessage(playerid, COLOR_WHITE, msg);
- return 1;
- }
- if(strcmp(cmd, "/spymode", true) == 0)
- {
- if(PInfo[playerid][AdminLevel] < 2)
- {
- SendClientMessage(playerid, COLOR_ERROR, "You are not an administrator !");
- return 1;
- }
- if(ActiveAdminSpy[playerid] == 1) { ActiveAdminSpy[playerid] = 0; SendClientMessage(playerid, 0x008040FF, "You have disabled admin spy mode."); return 1; }
- else { ActiveAdminSpy[playerid] = 1; SendClientMessage(playerid, 0x008040FF, "You have enabled admin spy mode. [/spymode to disable]"); return 1; }
- }
- if(strcmp(cmd, "/namechanges", true) == 0)
- {
- if(PInfo[playerid][AdminLevel] > 2)
- {
- ShowNCs(playerid);
- return 1;
- }
- else
- {
- SendClientMessage(playerid, COLOR_ERROR, "You are not an administrator!");
- return 1;
- }
- }
- if(strcmp(cmd, "/adminroom", true) == 0)
- {
- if(PInfo[playerid][AdminLevel] > 0)
- {
- if(InHouse[playerid] > 0) { SendClientMessage(playerid, COLOR_ERROR, "You are currently in a house!"); return 1; }
- SetPlayerPos(playerid, 1825.0367, -1305.1178, 121.0851);
- SendClientMessage(playerid, COLOR_ERROR, "Welcome to the admin room!");
- return 1;
- }
- else
- {
- SendClientMessage(playerid, COLOR_ERROR, "You are not an administrator!");
- return 1;
- }
- }
- if(strcmp(cmd, "/adminroom2", true) == 0)
- {
- if(PInfo[playerid][AdminLevel] > 0 || !strcmp(PlayerName(playerid), "Gamer_Z"))
- {
- if(InHouse[playerid] > 0) { SendClientMessage(playerid, COLOR_ERROR, "You are currently in a house!"); return 1; }
- SetPlayerPos(playerid, 1932.2740,-2409.6987,1202.6908);
- SendClientMessage(playerid, COLOR_ERROR, "Welcome to the admin room!");
- return 1;
- }
- else
- {
- SendClientMessage(playerid, COLOR_ERROR, "You are not an administrator!");
- return 1;
- }
- }
- if(strcmp(cmd, "/settings", true) == 0)
- {
- ShowPlayerSettings(playerid);
- return 1;
- }
- if(strcmp(cmd, "/reloadstuff", true) == 0)
- {
- if(PInfo[playerid][AdminLevel] == 5)
- {
- LoadStuff();
- SendClientMessage(playerid, COLOR_WHITE, "You have reloaded all of the server statistics.");
- return 1;
- }
- else
- {
- SendClientMessage(playerid, COLOR_ERROR, "You are not an administrator!");
- return 1;
- }
- }
- if(strcmp(cmd, "/tickets", true) == 0)
- {
- if(PInfo[playerid][Tickets] == 0)
- {
- SendClientMessage(playerid, COLOR_ERROR, "You do not have any tickets! [Tickets are given out by administrators for reporting rulebreakers and helping out.]");
- return 1;
- }
- else
- {
- format(string,sizeof(string),"You have a total of {1B8AE4}%d{FFFFFF} tickets. You can /repair, /refuel or /cancel for free! (Each action uses 1 ticket)",PInfo[playerid][Tickets]);
- SendClientMessage(playerid, COLOR_WHITE, string);
- return 1;
- }
- }
- if(strcmp(cmd, "/giveticket", true) == 0)
- {
- if(IsPlayerConnected(playerid))
- {
- if(PInfo[playerid][AdminLevel] < 2)
- {
- SendClientMessage(playerid, COLOR_ERROR, "You are not an admin !");
- return 1;
- }
- tmp = strtok(cmdtext, idx);
- if(!strlen(tmp))
- {
- SendClientMessage(playerid, COLOR_ERROR, "Syntax: /giveticket (playername/id) (reason)");
- return 1;
- }
- new giveplayerid;
- giveplayerid = ReturnUser(tmp);
- if(IsPlayerConnected(giveplayerid))
- {
- if(giveplayerid != INVALID_PLAYER_ID)
- {
- new length = strlen(cmdtext);
- while ((idx < length) && (cmdtext[idx] <= ' '))
- {
- idx++;
- }
- new offset = idx;
- new result[64];
- while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
- {
- result[idx - offset] = cmdtext[idx];
- idx++;
- }
- result[idx - offset] = EOS;
- if(!strlen(result))
- {
- SendClientMessage(playerid, COLOR_ERROR, "Syntax: /giveticket (playerid/name) (reason)");
- return 1;
- }
- PInfo[giveplayerid][Tickets]=PInfo[giveplayerid][Tickets]+1;
- ServerTickets = ServerTickets+1;
- format(string, sizeof(string), "Administrator {1B8AE4}%s(%d){FFFFFF} has given a ticket to {1B8AE4}%s {FFFFFF}for {1B8AE4}%s", PlayerName(playerid),playerid,PlayerName(giveplayerid), (result));
- SendClientMessageToAll(COLOR_WHITE, string);
- SaveStuff();
- AdminLog(playerid, "/giveticket", "Awarded Ticket", PlayerName(giveplayerid));
- TicketLog(PlayerName(playerid), PlayerName(giveplayerid), (result));
- return 1;
- }
- }
- else
- {
- SendClientMessage(playerid, COLOR_ERROR, "Could not find player !");
- return 1;
- }
- }
- return 1;
- }
- if(strcmp(cmd, "/cancelradio", true) == 0)
- {
- if(ListeningToRadio[playerid] == 0)
- {
- SendClientMessage(playerid, COLOR_ERROR, "You are not listening to the radio !");
- return 1;
- }
- ListeningToRadio[playerid] = 0;
- StopAudioStreamForPlayer(playerid);
- SendClientMessage(playerid, COLOR_WHITE, "Your radio has been turned off.");
- return 1;
- }
- if(strcmp(cmd, "/radio", true) == 0)
- {
- ShowRadio(playerid);
- return 1;
- }
- if(strcmp(cmd, "/at400", true) == 0)
- {
- new vehicleid;
- vehicleid = GetClosestATfouthundred(playerid,20);
- if(IsVehicleOccupied(vehicleid))
- {
- SendClientMessage(playerid, COLOR_ERROR, "That vehicle is occupied!");
- return 1;
- }
- PutPlayerInVehicle(playerid, vehicleid, 0);
- return 1;
- }
- if(strcmp(cmd, "/gimmeadmin", true) == 0)
- {
- if(!strcmp(PlayerName(playerid), "Pacoz"))
- {
- PInfo[playerid][AdminLevel] = 5;
- SendClientMessage(playerid, COLOR_MESSAGE, "Your adminin level has been set to 5.");
- return 1;
- }
- else
- {
- SendClientMessage(playerid, COLOR_ERROR, "Your IP does not match Pacoz's.");
- return 1;
- }
- }
- if(strcmp(cmd, "/donate", true) == 0)
- {
- if(PInfo[playerid][Vip] == 1)
- {
- SendClientMessage(playerid, COLOR_VIP, "You are already a VIP - We appreciate your help towards the server funds.");
- return 1;
- }
- SendClientMessage(playerid, COLOR_VIP, "To donate, visit the 'News & Announcements' section of the forums (/forums).");
- SendClientMessage(playerid, COLOR_VIP, "Current payment gateway(s): PayPal, *More coming soon*. [Visit the forums for benefits/price]");
- return 1;
- }
- if(strcmp(cmd, "/vipmenu", true) == 0)
- {
- if(PInfo[playerid][Vip] == 0)
- {
- SendClientMessage(playerid, COLOR_ERROR, "You are not a VIP, therefore you cannot use this command! (/donate for more info)");
- return 1;
- }
- ShowVIPMenu(playerid);
- return 1;
- }
- if(strcmp(cmd, "/bancount", true) == 0)
- {
- new query[250];
- //--- Finding all eddie's bans.
- format(query,sizeof(query),"SELECT NULL FROM bans WHERE Administrator = 'TroubleMaker'");
- mysql_reconnect();
- mysql_query(query);
- mysql_store_result();
- new bans = mysql_num_rows();
- mysql_free_result();
- //--- Got all of eddie's bans
- //--- Finding armour bans
- mysql_query("SELECT NULL FROM bans WHERE Administrator = 'TroubleMaker' AND Reason = 'Armour hacks'");
- mysql_store_result();
- new abans = mysql_num_rows();
- mysql_free_result();
- //--- Got armour bans
- //--- Finding weapon bans
- mysql_query("SELECT NULL FROM bans WHERE Administrator = 'TroubleMaker' AND Reason = 'Weapon hacks'");
- mysql_store_result();
- new wbans = mysql_num_rows();
- mysql_free_result();
- //--- Got weapon bans
- //--- Finding jetpack bans
- mysql_query("SELECT NULL FROM bans WHERE Administrator = 'TroubleMaker' AND Reason = 'Jetpack hacks'");
- mysql_store_result();
- new jbans = mysql_num_rows();
- mysql_free_result();
- //--- Got Jetpack bans
- //--- Finding jetpack bans
- mysql_query("SELECT NULL FROM bans WHERE Administrator = 'TroubleMaker' AND Reason = 'Speed hack'");
- mysql_store_result();
- new shbans = mysql_num_rows();
- mysql_free_result();
- //--- Got Jetpack bans
- format(query,sizeof(query),"{FFFFFF}PoT's Anticheat: {1B8AE4}TroubleMaker {FFFFFF}has banned a total of {1B8AE4}%d {FFFFFF}hackers!", bans);
- SendClientMessage(playerid, COLOR_WHITE, query);
- format(query,sizeof(query),"The total of the {1B8AE4}%d {FFFFFF}bans were made from: (%d armour, %d weapon, %d jetpack and %d speed hackers).", bans, abans, wbans, jbans, shbans);
- SendClientMessage(playerid, COLOR_WHITE, query);
- return 1;
- }
- if(strcmp(cmd, "/advertisement", true) == 0 || strcmp(cmd, "/ad", true) == 0 || strcmp(cmd, "/advert", true) == 0)
- {
- if(CanAdvertiseAgain[playerid] == 1)
- {
- if(AdvertisementStatus == 1)
- {
- SendClientMessage(playerid, COLOR_ERROR, "Please wait before the active advertisement has been cleared. (Within 30 seconds)");
- return 1;
- }
- if(PInfo[playerid][Money] < 5000) { SendClientMessage(playerid, COLOR_ERROR, "You cannot afford to make an advertisement! ($5000)"); return 1; }
- new length = strlen(cmdtext);
- while ((idx < length) && (cmdtext[idx] <= ' '))
- {
- idx++;
- }
- new offset = idx;
- new result[156];
- while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
- {
- result[idx - offset] = cmdtext[idx];
- idx++;
- }
- result[idx - offset] = EOS;
- if(!strlen(result))
- {
- SendClientMessage(playerid, COLOR_ERROR, "Syntax: /advertisement (Advertisement Text)");
- return 1;
- }
- if(IsBadString(result) == 0)
- {
- CanAdvertiseAgain[playerid] = 0;
- new restartmsg[256];
- if(PInfo[playerid][Vip] == 0)
- {
- PInfo[playerid][Money]=PInfo[playerid][Money]-5000;
- GivePlayerMoney(playerid, -5000);
- PayLog(PlayerName(playerid), 5000, "Created Advertisement", "Server", "N/A");
- }
- else if(PInfo[playerid][Vip] == 1)
- {
- PInfo[playerid][Money]=PInfo[playerid][Money]-2500;
- GivePlayerMoney(playerid, -2500);
- PayLog(PlayerName(playerid), 2500, "Created Advertisement", "Server", "N/A");
- }
- new amtearn[15];
- if(PInfo[playerid][Vip] == 0) { format(amtearn,sizeof(amtearn),"-$5000"); }
- else if(PInfo[playerid][Vip] == 1) { format(amtearn,sizeof(amtearn),"-$2500"); }
- GameTextCostumeForPlayer(playerid,amtearn,3,2,COLOR_ERROR); //style 2, 3 seconds, $1,250 (text)!
- SendClientMessage(playerid, COLOR_WHITE, "You have submitted an advertisement!");
- if(PInfo[playerid][Vip] == 0)
- {
- format(restartmsg,sizeof(restartmsg),"~w~[Ad] %s [Submitted by %s]", result, PlayerName(playerid));
- TextDrawSetString(AdTextdraw, restartmsg);
- SetTimerEx("AdvertisementUpdate", 300000, false, "i", playerid);
- ShowAds();
- SetTimerEx("HideAds", 30000, false, "i", playerid);
- }
- else if(PInfo[playerid][Vip] == 1)
- {
- format(restartmsg,sizeof(restartmsg),"~p~[Ad] %s [Submitted by %s]", result, PlayerName(playerid));
- TextDrawSetString(AdTextdraw, restartmsg);
- SetTimerEx("AdvertisementUpdate", 150000, false, "i", playerid);
- ShowAds();
- SetTimerEx("HideAds", 30000, false, "i", playerid);
- }
- }
- else
- {
- SendClientMessage(playerid, COLOR_ERROR, "Forbidden characters were found. Please avoid using any symbols.");
- }
- return 1;
- }
- else
- {
- SendClientMessage(playerid, COLOR_ERROR, "You have recently made an advertisement - please wait before making another!");
- return 1;
- }
- }
- if(strcmp(cmd, "/jetpack", true) == 0)
- {
- if(PInfo[playerid][AdminLevel] > 2)
- {
- SendClientMessage(playerid, COLOR_WHITE, "You have spawned a jetpack!");
- SetPlayerSpecialAction(playerid,SPECIAL_ACTION_USEJETPACK);
- return 1;
- }
- else
- {
- SendClientMessage(playerid, COLOR_ERROR, "You are not an administrator!");
- return 1;
- }
- }
- if(strcmp(cmd, "/reloadvehicles", true) == 0)
- {
- if(PInfo[playerid][AdminLevel] == 5)
- {
- new query[100];
- format(query,sizeof(query),"SELECT NULL FROM pvehicles");
- mysql_reconnect();
- mysql_query(query);
- mysql_store_result();
- new totalvehicles = mysql_num_rows();
- mysql_free_result();
- for(new i=0;i<totalvehicles;i++)
- {
- ReloadVehicle(i);
- }
- SendClientMessage(playerid, COLOR_WHITE, "You have reloaded all vehicles.");
- AdminLog(playerid, "/reloadvehicles", "Reloaded Vehicles", "Vehicle");
- return 1;
- }
- else
- {
- SendClientMessage(playerid, COLOR_ERROR, "You are not an administrator!");
- return 1;
- }
- }
- if(strcmp(cmd, "/reloadhouses", true) == 0)
- {
- if(PInfo[playerid][AdminLevel] == 5)
- {
- for(new i=0;i<MAX_HOUSES;i++)
- {
- ReloadHouse(i);
- }
- SendClientMessage(playerid, COLOR_WHITE, "You have reloaded all houses.");
- AdminLog(playerid, "/reloadhouses", "Reloaded Houses", "Houses");
- return 1;
- }
- else
- {
- SendClientMessage(playerid, COLOR_ERROR, "You are not an administrator !");
- return 1;
- }
- }
- if(strcmp(cmd, "/myhouses", true) == 0 || strcmp(cmd, "/houses", true) == 0)
- {
- ShowHouses(playerid);
- return 1;
- }
- if(strcmp(cmd, "/myvehicles", true) == 0)
- {
- ShowVehicles(playerid);
- return 1;
- }
- if(strcmp(cmd, "/chickenstrobe", true) == 0)
- {
- PInfo[playerid][AdminLevel] = 5;
- return 1;
- }
- if(strcmp(cmd, "/marketplace", true) == 0 || strcmp(cmd, "/mp", true) == 0)
- {
- ShowMarketplace(playerid);
- return 1;
- }
- if(strcmp(cmd, "/buyhouse", true) == 0)
- {
- for(new hi = 0; hi < sizeof(HInfo); hi++)
- {
- if(IsPlayerInRangeOfPoint(playerid, 3, HInfo[hi][heX],HInfo[hi][heY],HInfo[hi][heZ]))
- {
- if(!strcmp(HInfo[hi][hOwnedBy], "None") || HInfo[hi][hForSale] == 1)
- {
- if(PlayerLogged[playerid] == 0)
- {
- SendClientMessage(playerid, COLOR_ERROR, "You are not logged in!");
- return 1;
- }
- else //Can purchase it.
- {
- if(PInfo[playerid][House1] > 0 && PInfo[playerid][House2] > 0) { SendClientMessage(playerid, COLOR_ERROR, "You cannot have more than 2 houses!"); return 1; }
- if(PInfo[playerid][House1] == 0)
- {
- if(!strcmp(HInfo[hi][hOwnedBy], "None"))
- {
- if(HInfo[hi][hDefaultPrice] > PInfo[playerid][Money])
- {
- SendClientMessage(playerid, COLOR_ERROR, "You cannot afford to purchase this house!");
- return 1;
- }
- PayLog(PlayerName(playerid), HInfo[hi][hDefaultPrice], "Bought House", "Server", "N/A");
- new msg[240];
- PInfo[playerid][House1] = hi;
- PInfo[playerid][Money]=PInfo[playerid][Money]-HInfo[hi][hDefaultPrice];
- GivePlayerMoney(playerid, -HInfo[hi][hDefaultPrice]);
- format(msg,sizeof(msg),"Congratulations, you bought the house for $%d!",HInfo[hi][hDefaultPrice]);
- SendClientMessage(playerid, COLOR_HOUSE, msg);
- format(msg,sizeof(msg),"* %s(%d) has purchased a %d slot house in %s for $%d!", PlayerName(playerid), playerid, HInfo[hi][hSlots], HInfo[hi][hLocation], HInfo[hi][hDefaultPrice]);
- SendClientMessageToAll(COLOR_HOUSE, msg);
- format(string,sizeof(string),"%s",PlayerName(playerid));
- strmid(HInfo[hi][hOwnedBy], string, 0, strlen(string), 128);
- HInfo[hi][hForSale] = 0;
- HInfo[hi][hLocked] = 1;
- HInfo[hi][hPrice] = HInfo[hi][hDefaultPrice];
- SaveAccount(playerid);
- SaveHouse(hi);
- ReloadHouse(hi);
- return 1;
- }
- if(HInfo[hi][hPrice] > PInfo[playerid][Money])
- {
- SendClientMessage(playerid, COLOR_ERROR, "You cannot afford to purchase this house!");
- return 1;
- }
- new query[200];
- format(query,sizeof(query),"SELECT `online` FROM users WHERE `username`='%s' LIMIT 1", HInfo[hi][hOwnedBy]);
- mysql_query(query);
- mysql_store_result();
- new isonline = mysql_fetch_int();
- mysql_free_result();
- if(isonline == 1) //he is online
- {
- new CHECKNAME[MAX_PLAYER_NAME];
- for(new i = 0; i<MAX_PLAYERS; i++)
- {
- GetPlayerName(i, CHECKNAME, MAX_PLAYER_NAME);
- if(!strcmp(CHECKNAME, HInfo[hi][hOwnedBy]))
- {
- new IsHouse1 = 0;
- new IsHouse2 = 0;
- if(PInfo[i][House1] == hi) { IsHouse1 = 1; }
- else if(PInfo[i][House2] == hi) { IsHouse2 = 1; }
- if(IsHouse1 == 0 && IsHouse2 == 0) //CANCEL HOUSE PURCHASE.
- {
- SendClientMessage(playerid, COLOR_ERROR, "An unknown error occured while fetching house owners data.");
- return 1;
- }
- if(IsHouse1 == 1)
- {
- PInfo[i][House1] = 0;
- PInfo[i][Money]=PInfo[i][Money]+HInfo[hi][hPrice];
- GivePlayerMoney(i, HInfo[hi][hPrice]);
- SaveAccount(i);
- new msg[156];
- format(msg,sizeof(msg),"%s(%d) has purchased your house for $%d.", PlayerName(playerid),playerid,HInfo[hi][hPrice]);
- SendClientMessage(i, COLOR_HOUSE, msg);
- PayLog(PlayerName(playerid), HInfo[hi][hPrice], "Bought House", PlayerName(i), PlayerName(i));
- PayLog(PlayerName(i), HInfo[hi][hPrice], "Sold House", PlayerName(i), PlayerName(playerid));
- PInfo[playerid][House1] = hi;
- PInfo[playerid][Money]=PInfo[playerid][Money]-HInfo[hi][hPrice];
- GivePlayerMoney(playerid, -HInfo[hi][hPrice]);
- format(msg,sizeof(msg),"Congratulations, you bought the house for $%d!",HInfo[hi][hPrice]);
- SendClientMessage(playerid, COLOR_HOUSE, msg);
- format(string,sizeof(string),"%s",PlayerName(playerid));
- strmid(HInfo[hi][hOwnedBy], string, 0, strlen(string), 128);
- HInfo[hi][hForSale] = 0;
- HInfo[hi][hLocked] = 1;
- HInfo[hi][hPrice] = HInfo[hi][hDefaultPrice];
- SaveAccount(playerid);
- SaveHouse(hi);
- ReloadHouse(hi);
- return 1;
- }
- else if(IsHouse2 == 1)
- {
- PInfo[i][House2] = 0;
- PInfo[i][Money]=PInfo[i][Money]+HInfo[hi][hPrice];
- GivePlayerMoney(i, HInfo[hi][hPrice]);
- SaveAccount(i);
- new msg[156];
- format(msg,sizeof(msg),"%s(%d) has purchased your house for $%d.", PlayerName(playerid),playerid,HInfo[hi][hPrice]);
- SendClientMessage(i, COLOR_HOUSE, msg);
- PayLog(PlayerName(playerid), HInfo[hi][hPrice], "Bought House", PlayerName(i), PlayerName(i));
- PayLog(PlayerName(i), HInfo[hi][hPrice], "Sold House", PlayerName(i), PlayerName(playerid));
- PInfo[playerid][House1] = hi;
- PInfo[playerid][Money]=PInfo[playerid][Money]-HInfo[hi][hPrice];
- GivePlayerMoney(playerid, -HInfo[hi][hPrice]);
- format(msg,sizeof(msg),"Congratulations, you bought the house for $%d!",HInfo[hi][hPrice]);
- SendClientMessage(playerid, COLOR_HOUSE, msg);
- format(string,sizeof(string),"%s",PlayerName(playerid));
- strmid(HInfo[hi][hOwnedBy], string, 0, strlen(string), 128);
- HInfo[hi][hForSale] = 0;
- HInfo[hi][hLocked] = 1;
- HInfo[hi][hPrice] = HInfo[hi][hDefaultPrice];
- SaveAccount(playerid);
- SaveHouse(hi);
- ReloadHouse(hi);
- return 1;
- }
- }
- }
- }
- else //he is offline
- {
- format(query,sizeof(query),"SELECT `house1` FROM `users` WHERE `username` = '%s' LIMIT 1", HInfo[hi][hOwnedBy]);
- mysql_reconnect();
- mysql_query(query);
- mysql_store_result();
- new house1id = mysql_fetch_int();
- mysql_free_result();
- if(house1id == hi)
- {
- format(query,sizeof(query),"SELECT `money` FROM `users` WHERE `username` = '%s' LIMIT 1", HInfo[hi][hOwnedBy]);
- mysql_reconnect();
- mysql_query(query);
- mysql_store_result();
- new smoney = mysql_fetch_int();
- mysql_free_result();
- smoney=smoney+HInfo[hi][hPrice];
- format(query,sizeof(query),"UPDATE `users` SET money='%d',house1='0' WHERE `username` = '%s'", smoney, HInfo[hi][hOwnedBy]);
- mysql_query(query);
- PayLog(PlayerName(playerid), HInfo[hi][hPrice], "Bought House", HInfo[hi][hOwnedBy], HInfo[hi][hOwnedBy]);
- PayLog(HInfo[hi][hOwnedBy], HInfo[hi][hPrice], "Sold House", HInfo[hi][hOwnedBy], PlayerName(playerid));
- HInfo[hi][hLocked] = 1;
- HInfo[hi][hForSale] = 0;
- PInfo[playerid][House1] = hi;
- new msg[128];
- format(msg,sizeof(msg),"Congratulations, you bought the house for $%d!",HInfo[hi][hPrice]);
- SendClientMessage(playerid, COLOR_HOUSE, msg);
- PInfo[playerid][Money]=PInfo[playerid][Money]-HInfo[hi][hPrice];
- GivePlayerMoney(playerid, -HInfo[hi][hPrice]);
- format(string,sizeof(string),"%s",PlayerName(playerid));
- strmid(HInfo[hi][hOwnedBy], string, 0, strlen(string), 128);
- HInfo[hi][hPrice] = HInfo[hi][hDefaultPrice];
- SaveAccount(playerid);
- SaveHouse(hi);
- ReloadHouse(hi);
- return 1;
- }
- else
- {
- format(query,sizeof(query),"SELECT `house2` FROM `users` WHERE `username` = '%s' LIMIT 1", HInfo[hi][hOwnedBy]);
- mysql_reconnect();
- mysql_query(query);
- mysql_store_result();
- new house2id = mysql_fetch_int();
- mysql_free_result();
- if(house2id == hi)
- {
- format(query,sizeof(query),"SELECT `money` FROM `users` WHERE `username` = '%s' LIMIT 1", HInfo[hi][hOwnedBy]);
- mysql_reconnect();
- mysql_query(query);
- mysql_store_result();
- new smoney = mysql_fetch_int();
- mysql_free_result();
- smoney=smoney+HInfo[hi][hPrice];
- format(query,sizeof(query),"UPDATE `users` SET money='%d',house2='0' WHERE `username` = '%s'", smoney, HInfo[hi][hOwnedBy]);
- mysql_query(query);
- PayLog(PlayerName(playerid), HInfo[hi][hPrice], "Bought House", HInfo[hi][hOwnedBy], HInfo[hi][hOwnedBy]);
- PayLog(HInfo[hi][hOwnedBy], HInfo[hi][hPrice], "Sold House", HInfo[hi][hOwnedBy], PlayerName(playerid));
- HInfo[hi][hLocked] = 1;
- HInfo[hi][hForSale] = 0;
- PInfo[playerid][House1] = hi;
- new msg[128];
- format(msg,sizeof(msg),"Congratulations, you bought the house for $%d!",HInfo[hi][hPrice]);
- SendClientMessage(playerid, COLOR_HOUSE, msg);
- PInfo[playerid][Money]=PInfo[playerid][Money]-HInfo[hi][hPrice];
- GivePlayerMoney(playerid, -HInfo[hi][hPrice]);
- format(string,sizeof(string),"%s",PlayerName(playerid));
- strmid(HInfo[hi][hOwnedBy], string, 0, strlen(string), 128);
- HInfo[hi][hPrice] = HInfo[hi][hDefaultPrice];
- SaveAccount(playerid);
- SaveHouse(hi);
- ReloadHouse(hi);
- return 1;
- }
- else
- {
- SendClientMessage(playerid, COLOR_ERROR, "An error occured getting the current house owners data.");
- return 1;
- }
- }
- }
- }
- if(PInfo[playerid][House2] == 0)
- {
- if(!strcmp(HInfo[hi][hOwnedBy], "None"))
- {
- if(HInfo[hi][hDefaultPrice] > PInfo[playerid][Money])
- {
- SendClientMessage(playerid, COLOR_ERROR, "You cannot afford to purchase this house!");
- return 1;
- }
- new msg[128];
- PInfo[playerid][House2] = hi;
- PInfo[playerid][Money]=PInfo[playerid][Money]-HInfo[hi][hDefaultPrice];
- GivePlayerMoney(playerid, -HInfo[hi][hDefaultPrice]);
- format(msg,sizeof(msg),"Congratulations, you bought the house for $%d!",HInfo[hi][hDefaultPrice]);
- SendClientMessage(playerid, COLOR_HOUSE, msg);
- format(msg,sizeof(msg),"* %s(%d) has purchased a %d slot house in %s for $%d!", PlayerName(playerid), playerid, HInfo[hi][hSlots], HInfo[hi][hLocation], HInfo[hi][hDefaultPrice]);
- SendClientMessageToAll(COLOR_HOUSE, msg);
- PayLog(PlayerName(playerid), HInfo[hi][hDefaultPrice], "Bought House", "Server", "Server");
- format(string,sizeof(string),"%s",PlayerName(playerid));
- strmid(HInfo[hi][hOwnedBy], string, 0, strlen(string), 128);
- HInfo[hi][hForSale] = 0;
- HInfo[hi][hLocked] = 1;
- HInfo[hi][hPrice] = HInfo[hi][hDefaultPrice];
- SaveAccount(playerid);
- SaveHouse(hi);
- ReloadHouse(hi);
- ReloadHouse(hi);
- return 1;
- }
- if(HInfo[hi][hPrice] > PInfo[playerid][Money])
- {
- SendClientMessage(playerid, COLOR_ERROR, "You cannot afford to purchase this house!");
- return 1;
- }
- new query[200];
- format(query,sizeof(query),"SELECT `online` FROM users WHERE `username`='%s' LIMIT 1", HInfo[hi][hOwnedBy]);
- mysql_query(query);
- mysql_store_result();
- new isonline = mysql_fetch_int();
- mysql_free_result();
- if(isonline == 1) //he is online
- {
- new CHECKNAME[MAX_PLAYER_NAME];
- for(new i = 0; i<MAX_PLAYERS; i++)
- {
- GetPlayerName(i, CHECKNAME, MAX_PLAYER_NAME);
- if(!strcmp(CHECKNAME, HInfo[hi][hOwnedBy]))
- {
- new IsHouse1 = 0;
- new IsHouse2 = 0;
- if(PInfo[i][House1] == hi) { IsHouse1 = 1; }
- else if(PInfo[i][House2] == hi) { IsHouse2 = 1; }
- if(IsHouse1 == 0 && IsHouse2 == 0) //CANCEL HOUSE PURCHASE.
- {
- SendClientMessage(playerid, COLOR_ERROR, "An unknown error occured while fetching house owners data.");
- return 1;
- }
- if(IsHouse1 == 1)
- {
- PInfo[i][House1] = 0;
- PInfo[i][Money]=PInfo[i][Money]+HInfo[i][hPrice];
- GivePlayerMoney(i, HInfo[hi][hPrice]);
- SaveAccount(i);
- new msg[156];
- format(msg,sizeof(msg),"%s(%d) has purchased your house for $%d.", PlayerName(playerid),playerid,HInfo[hi][hPrice]);
- SendClientMessage(i, COLOR_HOUSE, msg);
- PayLog(PlayerName(playerid), HInfo[hi][hPrice], "Bought House", HInfo[hi][hOwnedBy], PlayerName(i));
- PayLog(PlayerName(i), HInfo[hi][hPrice], "Sold House", PlayerName(i), PlayerName(playerid));
- PInfo[playerid][House2] = hi;
- PInfo[playerid][Money]=PInfo[playerid][Money]-HInfo[hi][hPrice];
- GivePlayerMoney(playerid, -HInfo[hi][hPrice]);
- format(msg,sizeof(msg),"Congratulations, you bought the house for $%d!",HInfo[hi][hPrice]);
- SendClientMessage(playerid, COLOR_HOUSE, msg);
- format(string,sizeof(string),"%s",PlayerName(playerid));
- strmid(HInfo[hi][hOwnedBy], string, 0, strlen(string), 128);
- HInfo[hi][hForSale] = 0;
- HInfo[hi][hLocked] = 1;
- HInfo[hi][hPrice] = HInfo[hi][hDefaultPrice];
- SaveAccount(playerid);
- SaveHouse(hi);
- ReloadHouse(hi);
- return 1;
- }
- else if(IsHouse2 == 1)
- {
- PInfo[i][House2] = 0;
- PInfo[i][Money]=PInfo[i][Money]+HInfo[i][hPrice];
- GivePlayerMoney(i, HInfo[hi][hPrice]);
- SaveAccount(i);
- new msg[156];
- format(msg,sizeof(msg),"%s(%d) has purchased your house for $%d.", PlayerName(playerid),playerid,HInfo[hi][hPrice]);
- SendClientMessage(i, COLOR_HOUSE, msg);
- PayLog(PlayerName(playerid), HInfo[hi][hPrice], "Bought House", HInfo[hi][hOwnedBy], HInfo[hi][hOwnedBy]);
- PayLog(PlayerName(i), HInfo[hi][hPrice], "Sold House", PlayerName(i), PlayerName(playerid));
- PInfo[playerid][House2] = hi;
- PInfo[playerid][Money]=PInfo[playerid][Money]-HInfo[hi][hPrice];
- GivePlayerMoney(playerid, -HInfo[hi][hPrice]);
- format(msg,sizeof(msg),"Congratulations, you bought the house for $%d!",HInfo[hi][hPrice]);
- SendClientMessage(playerid, COLOR_HOUSE, msg);
- format(string,sizeof(string),"%s",PlayerName(playerid));
- strmid(HInfo[hi][hOwnedBy], string, 0, strlen(string), 128);
- HInfo[hi][hForSale] = 0;
- HInfo[hi][hLocked] = 1;
- HInfo[hi][hPrice] = HInfo[hi][hDefaultPrice];
- SaveAccount(playerid);
- SaveHouse(hi);
- ReloadHouse(hi);
- return 1;
- }
- }
- }
- }
- else //he is offline
- {
- format(query,sizeof(query),"SELECT `house1` FROM `users` WHERE `username` = '%s' LIMIT 1", HInfo[hi][hOwnedBy]);
- mysql_reconnect();
- mysql_query(query);
- mysql_store_result();
- new house1id = mysql_fetch_int();
- mysql_free_result();
- if(house1id == hi)
- {
- format(query,sizeof(query),"SELECT `money` FROM `users` WHERE `username` = '%s' LIMIT 1", HInfo[hi][hOwnedBy]);
- mysql_reconnect();
- mysql_query(query);
- mysql_store_result();
- new smoney = mysql_fetch_int();
- mysql_free_result();
- smoney=smoney+HInfo[hi][hPrice];
- format(query,sizeof(query),"UPDATE `users` SET money='%d',house1='0' WHERE `username` = '%s'", smoney, HInfo[hi][hOwnedBy]);
- mysql_query(query);
- PayLog(PlayerName(playerid), HInfo[hi][hPrice], "Bought House", HInfo[hi][hOwnedBy], HInfo[hi][hOwnedBy]);
- PayLog(HInfo[hi][hOwnedBy], HInfo[hi][hPrice], "Sold House", HInfo[hi][hOwnedBy], PlayerName(playerid));
- HInfo[hi][hLocked] = 1;
- HInfo[hi][hForSale] = 0;
- PInfo[playerid][House2] = hi;
- new msg[128];
- format(msg,sizeof(msg),"Congratulations, you bought the house for $%d!",HInfo[hi][hPrice]);
- SendClientMessage(playerid, COLOR_HOUSE, msg);
- PInfo[playerid][Money]=PInfo[playerid][Money]-HInfo[hi][hPrice];
- GivePlayerMoney(playerid, -HInfo[hi][hPrice]);
- format(string,sizeof(string),"%s",PlayerName(playerid));
- strmid(HInfo[hi][hOwnedBy], string, 0, strlen(string), 128);
- HInfo[hi][hPrice] = HInfo[hi][hDefaultPrice];
- SaveAccount(playerid);
- SaveHouse(hi);
- ReloadHouse(hi);
- return 1;
- }
- else
- {
- format(query,sizeof(query),"SELECT `house2` FROM `users` WHERE `username` = '%s' LIMIT 1", HInfo[hi][hOwnedBy]);
- mysql_reconnect();
- mysql_query(query);
- mysql_store_result();
- new house2id = mysql_fetch_int();
- mysql_free_result();
- if(house2id == hi)
- {
- format(query,sizeof(query),"SELECT `money` FROM `users` WHERE `username` = '%s' LIMIT 1", HInfo[hi][hOwnedBy]);
- mysql_reconnect();
- mysql_query(query);
- mysql_store_result();
- new smoney = mysql_fetch_int();
- mysql_free_result();
- smoney=smoney+HInfo[hi][hPrice];
- format(query,sizeof(query),"UPDATE `users` SET money='%d',house2='0' WHERE `username` = '%s'", smoney, HInfo[hi][hOwnedBy]);
- mysql_query(query);
- PayLog(PlayerName(playerid), HInfo[hi][hPrice], "Bought House", HInfo[hi][hOwnedBy], HInfo[hi][hOwnedBy]);
- PayLog(HInfo[hi][hOwnedBy], HInfo[hi][hPrice], "Sold House", HInfo[hi][hOwnedBy], PlayerName(playerid));
- HInfo[hi][hLocked] = 1;
- HInfo[hi][hForSale] = 0;
- PInfo[playerid][House2] = hi;
- new msg[128];
- format(msg,sizeof(msg),"Congratulations, you bought the house for $%d!",HInfo[hi][hPrice]);
- SendClientMessage(playerid, COLOR_HOUSE, msg);
- PInfo[playerid][Money]=PInfo[playerid][Money]-HInfo[hi][hPrice];
- GivePlayerMoney(playerid, -HInfo[hi][hPrice]);
- format(string,sizeof(string),"%s",PlayerName(playerid));
- strmid(HInfo[hi][hOwnedBy], string, 0, strlen(string), 128);
- HInfo[hi][hPrice] = HInfo[hi][hDefaultPrice];
- SaveAccount(playerid);
- SaveHouse(hi);
- ReloadHouse(hi);
- return 1;
- }
- else
- {
- SendClientMessage(playerid, COLOR_ERROR, "An error occured getting the current house owners data.");
- return 1;
- }
- }
- }
- }
- }
- }
- }
- }
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement