Guest User

Spawn issues on SA-MP

a guest
Jan 20th, 2014
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 44.91 KB | None | 0 0
  1. /*//==================================//
  2.  
  3. ---------- GAME WARFARE ROLEPLAY --------
  4. Work started on October 1, 2013 at 9:50 PM Central time
  5.  
  6.  
  7. :::LICENSE
  8.    Copyright 2013 GameWarfare Servers
  9.  
  10.    Licensed under the Apache License, Version 2.0 (the "License");
  11.    you may not use this file except in compliance with the License.
  12.    You may obtain a copy of the License at
  13.  
  14.        http://www.apache.org/licenses/LICENSE-2.0
  15.  
  16.    Unless required by applicable law or agreed to in writing, software
  17.    distributed under the License is distributed on an "AS IS" BASIS,
  18.    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  19.    See the License for the specific language governing permissions and
  20.    limitations under the License.
  21.  
  22. */////////////////////////////////////////
  23.  
  24. #include <a_samp>
  25. #include <foreach>
  26. #include <sscanf2>
  27. #include <zcmd>
  28. #include <YSI\y_ini>
  29. #include <LBYC\LB_TDBox>
  30. #include <Zones>
  31. #include <streamer>
  32.  
  33. #define MAX_HOUSES 75000
  34. #define MAX_ZONE 365
  35. #define MAX_HOUSES_IN_ZONE 500
  36.  
  37. #define INFINITE (Float:0x7F800000)
  38.  
  39. enum PlayerInfo
  40. {
  41.     Name,
  42.     Password,
  43.     Money,
  44.     MoneyInBank,
  45.     TimesArrested,
  46.     TimesFined,
  47.     TimesWarned,
  48.     TimesKicked,
  49.     TimesJailed,
  50.     Skin,
  51.     PhoneNumber,
  52.     CarsSold,
  53.     MoneyEarnedFromSoldCars,
  54.     CarNameInSlot1[100],
  55.     CarNameInSlot2[100],
  56.     CarNameInSlot3[100],
  57.     CarNameInSlot4[100],
  58.     CarNameInSlot5[100],
  59.     CarNameInVIPSlot6[100],
  60.     CarNameInVIPSlot7[100],
  61.     CarNameInVIPSlot8[100],
  62.     CarNameInVIPSlot9[100],
  63.     CarNameInVIPSlot10[100],
  64.     HouseIDInSlot1,
  65.     HouseIDInSlot2,
  66.     HouseIDInSlot3,
  67.     HouseIDInVIPSlot4,
  68.     HouseIDInVIPSlot5,
  69.     HouseIDInVIPSlot6,
  70.     HouseIDInVIPSlot7,
  71.     BusinessIDInSlot1,
  72.     BusinessIDInSlot2,
  73.     BusinessIDInVIPSlot3,
  74.     BusinessIDInVIPSlot4,
  75.     BusinessIDInVIPSlot5,
  76.     VIP,
  77.     Admin,
  78.     Kills,
  79.     Deaths,
  80.     InTaxiCompany,
  81.     InSANewsCompany,
  82.     Governor,
  83.     President,
  84.     SecretaryOfState,
  85.     SecretaryOfTheTreasury,
  86.     SecretaryOfDefense,
  87.     AttorneyGeneral,
  88.     SecretaryOfTheInterior,
  89.     SecretaryOfAgriculture,
  90.     SecretaryOfCommerce,
  91.     SecretaryOfLabor,
  92.     SecretaryOfTransportation,
  93.     SecretaryOfEnergy,
  94.     SecretaryOfEducation,
  95.     SecretaryOfVeteransAffairs,
  96.     SecretaryOfHomelandSecurity,
  97.     VicePresident,
  98.     PoliceRank,
  99.     SANGRank,
  100.     SAFMDRank,
  101.     SANewsRank,
  102.     TaxiRank,
  103.     SASDRank,
  104.     SAPDRank,
  105.     GroveRank,
  106.     BallasRank,
  107.     InGrove,
  108.     InBallas,
  109.     PoliceTR,
  110.     InPolice,
  111.     InFBI,
  112.     InSWAT,
  113.     InSANG,
  114.     InSASD,
  115.     InGovernment,
  116.     Helper,
  117.     Float:Slot1CarXPos,
  118.     Float:Slot1CarYPos,
  119.     Float:Slot1CarZPos,
  120.     Float:Slot2CarXPos,
  121.     Float:Slot2CarYPos,
  122.     Float:Slot2CarZPos,
  123.     Float:Slot3CarXPos,
  124.     Float:Slot3CarYPos,
  125.     Float:Slot3CarZPos,
  126.     Float:Slot4CarXPos,
  127.     Float:Slot4CarYPos,
  128.     Float:Slot4CarZPos,
  129.     Float:Slot5CarXPos,
  130.     Float:Slot5CarYPos,
  131.     Float:Slot5CarZPos,
  132.     Float:Slot6CarXPos,
  133.     Float:Slot6CarYPos,
  134.     Float:Slot6CarZPos,
  135.     Float:Slot7CarXPos,
  136.     Float:Slot7CarYPos,
  137.     Float:Slot7CarZPos,
  138.     Float:Slot8CarXPos,
  139.     Float:Slot8CarYPos,
  140.     Float:Slot8CarZPos,
  141.     Float:Slot9CarXPos,
  142.     Float:Slot9CarYPos,
  143.     Float:Slot9CarZPos,
  144.     Float:Slot10CarXPos,
  145.     Float:Slot10CarYPos,
  146.     Float:Slot10CarZPos,
  147.     CarsSoldToDocks,
  148.     SpeakInNewbieChannel,
  149.     Level,
  150.     Points,
  151.     Float:XPos,
  152.     Float:YPos,
  153.     Float:ZPos,
  154.     Float:Health,
  155.     Float:Armor,
  156.     Banned,
  157.     InSAFMD,
  158.     Age,
  159.     Orgin,
  160.     Gender,
  161.     Accent,
  162.     CurrentWarnings,
  163.     IP[16],
  164.     InHouse,
  165.     HousesOwned[2],
  166.     VIPHousesOwned[3],
  167.     CurrentZone[MAX_ZONE_NAME],
  168.     bool:Dead
  169. }
  170.  
  171. enum HouseInfo
  172. {
  173.     HouseAddress[128],
  174.     Float:HouseX,
  175.     Float:HouseY,
  176.     Float:HouseZ,
  177.     bool:Owned,
  178.     Price,
  179.     HouseOwner[24],
  180.     Interior,
  181.     Float:IntX,
  182.     Float:IntY,
  183.     Float:IntZ,
  184.     bool:Locked,
  185.     bool:HousePickup,
  186.     Text3D:DoorTextID,
  187.     DoorText[128],
  188.     HouseName[75],
  189.     DoorPickup,
  190.     bool:Buyable
  191. }
  192.  
  193. enum ZoneInfo
  194. {
  195.     HousesInZone
  196. }
  197.  
  198. enum ServerInfo
  199. {
  200.     Tax,
  201.     MOTD,
  202.     PlayersOnline,
  203.     bool:GangSlot1Used,
  204.     GangSlot1Name[50],
  205.     GangSlot1Members,
  206.     GangSlot1Strikes,
  207.     bool:GangSlot2Used,
  208.     GangSlot2Name[50],
  209.     GangSlot2Members,
  210.     GangSlot2Strikes,
  211.     bool:GangSlot3Used,
  212.     GangSlot3Name[50],
  213.     GangSlot3Members,
  214.     GangSlot3Strikes,
  215.     bool:GangSlot4Used,
  216.     GangSlot4Name[50],
  217.     GangSlot4Members,
  218.     GangSlot4Strikes,
  219.     bool:GangSlot5Used,
  220.     GangSlot5Name[50],
  221.     GangSlot5Members,
  222.     GangSlot5Strikes,
  223.     bool:GangSlot6Used,
  224.     GangSlot6Name[50],
  225.     GangSlot6Members,
  226.     GangSlot6Strikes,
  227.     bool:GangSlot7Used,
  228.     GangSlot7Name[50],
  229.     GangSlot7Members,
  230.     GangSlot7Strikes,
  231.     bool:GangSlot8Used,
  232.     GangSlot8Name[50],
  233.     GangSlot8Members,
  234.     GangSlot8Strikes,
  235.     bool:GangSlot9Used,
  236.     GangSlot9Name[50],
  237.     GangSlot9Members,
  238.     GangSlot9Strikes,
  239.     bool:GangSlot10Used,
  240.     GangSlot10Name[50],
  241.     GangSlot10Members,
  242.     GangSlot10Strikes,
  243.     bool:GangSlot11Used,
  244.     GangSlot11Name[50],
  245.     GangSlot11Members,
  246.     GangSlot11Strikes,
  247.     bool:GangSlot12Used,
  248.     GangSlot12Name[50],
  249.     GangSlot12Members,
  250.     GangSlot12Strikes,
  251.     bool:GangSlot13Used,
  252.     GangSlot13Name[50],
  253.     GangSlot13Members,
  254.     GangSlot13Strikes,
  255.     bool:GangSlot14Used,
  256.     GangSlot14Name[50],
  257.     GangSlot14Members,
  258.     GangSlot14Strikes,
  259.     bool:GangSlot15Used,
  260.     GangSlot15Name[50],
  261.     GangSlot15Members,
  262.     GangSlot15Strikes
  263. }
  264.  
  265. new hInfo[MAX_HOUSES][HouseInfo];
  266. new pInfo[MAX_PLAYERS][PlayerInfo];
  267. new zInfo[MAX_ZONE][ZoneInfo];
  268. new sInfo[ServerInfo];
  269.  
  270. new RandomMessages[][] = {
  271.     "Our forums are www.gamewarfare.net/gwrp",
  272.     "The owner of this server is Zakhar_Hunter.",
  273.     "You can buy sports cars at Steve's Sports Cars in Los Santos.",
  274.     "You can buy airplanes and helicopters at Airmen's Supplies at Easter Bay Airport.",
  275.     "You can buy boats at A Boat's Life at the dock in Las Venturas.",
  276.     "You can buy motorbikes and bikes at Trevor's Bikes in the desert.",
  277.     "There is a lot of things you can receive when you donate.",
  278.     "There are a lot of businesses and houses you can buy.",
  279.     "You can join the police by applying on the forums when you reach the requirements.",
  280.     "You can donate for your own family (gang) and your family's cars.",
  281.     "You can donate for your own car for $12.00",
  282.     "Use /n or /newbie for script/server-related questions.",
  283.     "Welcome to GameWarfare Roleplay.",
  284.     "We have other planned servers.",
  285.     "You can donate for all of our servers at www.gamewarfare.net/donate",
  286.     "You can buy luxury cars at LuxCars, Inc. in Los Santos.",
  287.     "You can buy ordinary cars at Automobiles Empire in San Fierro."
  288. };
  289.  
  290. //Factions
  291. #define FAC_TAXI 0
  292. #define FAC_NEWS 1
  293. #define FAC_SAPD 2
  294. #define FAC_SAFMD 3
  295. #define FAC_FBI 4
  296. #define FAC_SANG 5
  297. #define FAC_
  298.  
  299. //Colors
  300. #define COLOR_BLACK (0x000000FF)
  301. #define COLOR_GREEN (0x00FF00FF)
  302. #define COLOR_RED (0xFF0000FF)
  303. #define COLOR_PINK (0xFF00FFFF)
  304. #define COLOR_YELLOW (0xFFFF00FF)
  305. #define COLOR_LIGHTBLUE (0x00B3E3FF)
  306. #define COLOR_PURPLE (0x9D00FFFF)
  307. #define COLOR_ADMIN 0xFF6C00FF
  308.  
  309. //Dialogs
  310. #define DIALOG_REGISTER   26121
  311. #define DIALOG_LOGIN   746
  312. #define DIALOG_REG-SUCCESS   27331
  313. #define DIALOG_AGE   31780
  314. #define DIALOG_GENDER   24819
  315. #define DIALOG_ORGIN   502
  316. #define DIALOG_ACCENT 5912
  317. #define DIALOG_SEL_HOUSE_INT   31967
  318.  
  319. //Register System Defines
  320. #define PATH "GWRP/Users/%s.ini"
  321.  
  322. //House Defines
  323. #define HPATH "GWRP/Houses/%d.ini"
  324.  
  325. //Timers
  326. forward Tut2(playerid);
  327. forward Tut3(playerid);
  328. forward Tut4(playerid);
  329. forward Tut5(playerid);
  330. forward Tut6(playerid);
  331. forward FinalTut(playerid);
  332. forward Spawn(playerid);
  333.  
  334.  
  335. //Textdraws
  336. new Text:SERVERNAME;
  337. new Text:SERVERVERSION;
  338.  
  339. new Iterator:Houses<MAX_HOUSES>;
  340.  
  341. //RANDOM
  342. new HouseCount = 0;
  343.  
  344.  
  345.  
  346. main()
  347. {
  348.     print("\n----------------------------------");
  349.     print(" -| GameWarfare Roleplay -- 1.0.0 |-");
  350.     print("----------------------------------\n");
  351. }
  352.  
  353. public OnGameModeInit()
  354. {
  355.     // Don't use these lines if it's a filterscript
  356.     SetGameModeText("GameWarfare Roleplay");
  357.     AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
  358.     SERVERNAME = TextDrawCreate(166, 358, "GameWarfare Roleplay");
  359.     TextDrawFont(SERVERNAME, 1);
  360.     TextDrawLetterSize(SERVERNAME, 1.0, 1.5);
  361.     TextDrawColor(SERVERNAME, 0xC4D414FF);
  362.     TextDrawSetOutline(SERVERNAME, 1);
  363.     TextDrawSetProportional(SERVERNAME, true);
  364.     TextDrawSetShadow(SERVERNAME, 7);
  365.  
  366.     SERVERVERSION = TextDrawCreate(230, 425, "Version 1.0.0");
  367.     TextDrawFont(SERVERVERSION, 1);
  368.     TextDrawLetterSize(SERVERVERSION, 1.0, 1.2);
  369.     TextDrawColor(SERVERVERSION, 0xC4D414FF);
  370.     TextDrawSetOutline(SERVERVERSION, 1);
  371.     TextDrawSetProportional(SERVERVERSION, true);
  372.     TextDrawSetShadow(SERVERVERSION, 7);
  373.     UsePlayerPedAnims();
  374.     DisableInteriorEnterExits();
  375.  
  376.     SetTimer("RandomMsgs", 180000, 1);
  377.     return 1;
  378. }
  379.  
  380. public OnGameModeExit()
  381. {
  382.     return 1;
  383. }
  384.  
  385. public OnPlayerRequestClass(playerid, classid)
  386. {
  387.     SetPlayerInterior(playerid, 14);
  388.     SetPlayerPos(playerid, -1870.80, 59.81, 1056.25);
  389.     SetPlayerCameraPos(playerid, 2286.8579, 2361.1731, 30.6719);
  390.     SetPlayerCameraLookAt(playerid, 2305.8640, 2420.3040, 10.8203);
  391.     return 1;
  392. }
  393.  
  394. public OnPlayerConnect(playerid)
  395. {
  396.     TextDrawShowForPlayer(playerid, SERVERNAME);
  397.     TextDrawShowForPlayer(playerid, SERVERVERSION);
  398.     new string[128];
  399.     new randcam = random(3);
  400.     TogglePlayerSpectating(playerid, 1);
  401.     if(randcam == 0)
  402.     {
  403.         SetPlayerCameraPos(playerid, 1469.7357,-1691.2969,44.0469);
  404.         SetPlayerCameraLookAt(playerid, 1541.2825,-1667.3604,13.5522);
  405.     }
  406.  
  407.     if(randcam == 1)
  408.     {
  409.         SetPlayerCameraPos(playerid, -2188.3616,2283.9673,24.9822);
  410.         SetPlayerCameraLookAt(playerid, -2439.0796,2390.2986,11.7469);
  411.     }
  412.  
  413.     if(randcam == 2)
  414.     {
  415.         SetPlayerCameraPos(playerid, 2286.8579,2361.1731,30.6719);
  416.         SetPlayerCameraLookAt(playerid, 2305.8640, 2420.3040, 10.8203);
  417.     }
  418.  
  419.     if(fexist(UserPath(playerid)))
  420.     {
  421.         INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
  422.         ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT, "GW Roleplay - Login", "\t{00FF00}GameWarfare Roleplay\n\t{FF00FF}Please input your password to login.", "Login", "Quit");
  423.     }
  424.     else
  425.     {
  426.         ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, "GW Roleplay - Register", "\t{00FF00}GameWarfare Roleplay{00FF00}\n\tPlease input your password to register.", "Register", "Quit");
  427.     }
  428.     format(string, sizeof(string), "Welcome to ~y~GameWarfare Roleplay~w~, %s.~n~Current version is ~r~1.0.0.", GetName(playerid));
  429.     TD_SendMessage(playerid, string, "~y~GameWarfare Roleplay");
  430.     sInfo[PlayersOnline]++;
  431.     return 1;
  432. }
  433.  
  434. public OnPlayerDisconnect(playerid, reason)
  435. {
  436.  
  437.     new pIP[16];
  438.     GetPlayerIp(playerid, pIP, sizeof(pIP));
  439.     pInfo[playerid][IP] = pIP;
  440.     new Float:X, Float:Y, Float:Z;
  441.     GetPlayerPos(playerid, X, Y, Z);
  442.     pInfo[playerid][XPos] = X;
  443.     pInfo[playerid][YPos] = Y;
  444.     pInfo[playerid][ZPos] = Z;
  445.     new INI:File = INI_Open(UserPath(playerid));
  446.     INI_SetTag(File,"data");
  447.     INI_WriteString(File, "IP", pInfo[playerid][IP]);
  448.     INI_WriteInt(File, "Banned", pInfo[playerid][Banned]);
  449.     INI_WriteInt(File, "Password", pInfo[playerid][Password]);
  450.     INI_WriteInt(File, "Money", pInfo[playerid][Money]);
  451.     INI_WriteInt(File, "MoneyInBank", pInfo[playerid][MoneyInBank]);
  452.     INI_WriteInt(File, "Level", pInfo[playerid][Level]);
  453.     INI_WriteInt(File, "Points", pInfo[playerid][Points]);
  454.     INI_WriteFloat(File, "Health", pInfo[playerid][Health]);
  455.     INI_WriteFloat(File, "Armor", pInfo[playerid][Armor]);
  456.     INI_WriteInt(File, "Kills", pInfo[playerid][Kills]);
  457.     INI_WriteInt(File, "Deaths", pInfo[playerid][Deaths]);
  458.     INI_WriteInt(File, "TimesArrested", pInfo[playerid][TimesArrested]);
  459.     INI_WriteInt(File, "TimesFined", pInfo[playerid][TimesFined]);
  460.     INI_WriteInt(File, "TimesWarned", pInfo[playerid][TimesWarned]);
  461.     INI_WriteInt(File, "TimesKicked", pInfo[playerid][TimesKicked]);
  462.     INI_WriteInt(File, "TimesJailed", pInfo[playerid][TimesJailed]);
  463.     INI_WriteInt(File, "Skin", pInfo[playerid][Skin]);
  464.     INI_WriteInt(File, "PhoneNumber", pInfo[playerid][PhoneNumber]);
  465.     INI_WriteFloat(File, "XPosition", pInfo[playerid][XPos]);
  466.     INI_WriteFloat(File, "YPosition", pInfo[playerid][YPos]);
  467.     INI_WriteFloat(File, "ZPosition", pInfo[playerid][ZPos]);
  468.     INI_WriteInt(File, "CarsSold", pInfo[playerid][CarsSold]);
  469.     INI_WriteInt(File, "MoneyEarnedFromSoldCars", pInfo[playerid][MoneyEarnedFromSoldCars]);
  470.     INI_WriteString(File, "Slot1Car", pInfo[playerid][CarNameInSlot1]);
  471.     INI_WriteString(File, "Slot2Car", pInfo[playerid][CarNameInSlot2]);
  472.     INI_WriteString(File, "Slot3Car", pInfo[playerid][CarNameInSlot3]);
  473.     INI_WriteString(File, "Slot4Car", pInfo[playerid][CarNameInSlot4]);
  474.     INI_WriteString(File, "Slot5Car", pInfo[playerid][CarNameInSlot5]);
  475.     INI_WriteString(File, "VIPSlot6Car", pInfo[playerid][CarNameInVIPSlot6]);
  476.     INI_WriteString(File, "VIPSlot7Car", pInfo[playerid][CarNameInVIPSlot7]);
  477.     INI_WriteString(File, "VIPSlot8Car", pInfo[playerid][CarNameInVIPSlot8]);
  478.     INI_WriteString(File, "VIPSlot9Car", pInfo[playerid][CarNameInVIPSlot9]);
  479.     INI_WriteString(File, "VIPSlot10Car", pInfo[playerid][CarNameInVIPSlot10]);
  480.     INI_WriteInt(File, "HouseInSlot1", pInfo[playerid][HouseIDInSlot1]);
  481.     INI_WriteInt(File, "HouseInSlot2", pInfo[playerid][HouseIDInSlot2]);
  482.     INI_WriteInt(File, "HouseInSlot3", pInfo[playerid][HouseIDInSlot3]);
  483.     INI_WriteInt(File, "HouseInVIPSlot4", pInfo[playerid][HouseIDInVIPSlot4]);
  484.     INI_WriteInt(File, "HouseInVIPSlot5", pInfo[playerid][HouseIDInVIPSlot5]);
  485.     INI_WriteInt(File, "BusinessInSlot1", pInfo[playerid][BusinessIDInSlot1]);
  486.     INI_WriteInt(File, "BusinessInSlot2", pInfo[playerid][BusinessIDInSlot2]);
  487.     INI_WriteInt(File, "BusinessInVIPSlot3", pInfo[playerid][BusinessIDInVIPSlot3]);
  488.     INI_WriteInt(File, "BusinessInVIPSlot4", pInfo[playerid][BusinessIDInVIPSlot4]);
  489.     INI_WriteInt(File, "BusinessInVIPSlot5", pInfo[playerid][BusinessIDInVIPSlot5]);
  490.     INI_WriteInt(File, "VIP", pInfo[playerid][VIP]);
  491.     INI_WriteInt(File, "Admin", pInfo[playerid][Admin]);
  492.     INI_WriteInt(File, "Helper", pInfo[playerid][Helper]);
  493.     INI_WriteInt(File, "InTaxiCompany", pInfo[playerid][InTaxiCompany]);
  494.     INI_WriteInt(File, "InSANewsCompany", pInfo[playerid][InSANewsCompany]);
  495.     INI_WriteInt(File, "Governor", pInfo[playerid][Governor]);
  496.     INI_WriteInt(File, "InPolice", pInfo[playerid][InPolice]);
  497.     INI_WriteInt(File, "InFBI", pInfo[playerid][InFBI]);
  498.     INI_WriteInt(File, "InSWAT", pInfo[playerid][InSWAT]);
  499.     INI_WriteInt(File, "InSANG", pInfo[playerid][InSANG]);
  500.     INI_WriteInt(File, "InSAFMD", pInfo[playerid][InSAFMD]);
  501.     INI_WriteFloat(File, "Slot1CarXPos", pInfo[playerid][Slot1CarXPos]);
  502.     INI_WriteFloat(File, "Slot1CarYPos", pInfo[playerid][Slot1CarYPos]);
  503.     INI_WriteFloat(File, "Slot1CarZPos", pInfo[playerid][Slot1CarZPos]);
  504.     INI_WriteFloat(File, "Slot2CarXPos", pInfo[playerid][Slot2CarXPos]);
  505.     INI_WriteFloat(File, "Slot2CarYPos", pInfo[playerid][Slot2CarYPos]);
  506.     INI_WriteFloat(File, "Slot2CarZPos", pInfo[playerid][Slot2CarZPos]);
  507.     INI_WriteFloat(File, "Slot3CarXPos", pInfo[playerid][Slot3CarXPos]);
  508.     INI_WriteFloat(File, "Slot3CarYPos", pInfo[playerid][Slot3CarYPos]);
  509.     INI_WriteFloat(File, "Slot3CarZPos", pInfo[playerid][Slot3CarZPos]);
  510.     INI_WriteFloat(File, "Slot4CarXPos", pInfo[playerid][Slot4CarXPos]);
  511.     INI_WriteFloat(File, "Slot4CarYPos", pInfo[playerid][Slot4CarYPos]);
  512.     INI_WriteFloat(File, "Slot4CarZPos", pInfo[playerid][Slot4CarZPos]);
  513.     INI_WriteFloat(File, "Slot5CarXPos", pInfo[playerid][Slot5CarXPos]);
  514.     INI_WriteFloat(File, "Slot5CarYPos", pInfo[playerid][Slot5CarYPos]);
  515.     INI_WriteFloat(File, "Slot5CarZPos", pInfo[playerid][Slot5CarZPos]);
  516.     INI_WriteFloat(File, "Slot6CarXPos", pInfo[playerid][Slot6CarXPos]);
  517.     INI_WriteFloat(File, "Slot6CarYPos", pInfo[playerid][Slot6CarYPos]);
  518.     INI_WriteFloat(File, "Slot6CarZPos", pInfo[playerid][Slot6CarZPos]);
  519.     INI_WriteFloat(File, "Slot7CarXPos", pInfo[playerid][Slot7CarXPos]);
  520.     INI_WriteFloat(File, "Slot7CarYPos", pInfo[playerid][Slot7CarYPos]);
  521.     INI_WriteFloat(File, "Slot7CarZPos", pInfo[playerid][Slot7CarZPos]);
  522.     INI_WriteFloat(File, "Slot8CarXPos", pInfo[playerid][Slot8CarXPos]);
  523.     INI_WriteFloat(File, "Slot8CarYPos", pInfo[playerid][Slot8CarYPos]);
  524.     INI_WriteFloat(File, "Slot8CarZPos", pInfo[playerid][Slot8CarZPos]);
  525.     INI_WriteFloat(File, "Slot9CarXPos", pInfo[playerid][Slot9CarXPos]);
  526.     INI_WriteFloat(File, "Slot9CarYPos", pInfo[playerid][Slot9CarYPos]);
  527.     INI_WriteFloat(File, "Slot9CarZPos", pInfo[playerid][Slot9CarZPos]);
  528.     INI_WriteFloat(File, "Slot10CarXPos", pInfo[playerid][Slot10CarXPos]);
  529.     INI_WriteFloat(File, "Slot10CarYPos", pInfo[playerid][Slot10CarYPos]);
  530.     INI_WriteFloat(File, "Slot10CarZPos", pInfo[playerid][Slot10CarZPos]);
  531.     INI_Close(File);
  532.     sInfo[PlayersOnline]--;
  533.     return 1;
  534. }
  535.  
  536. public OnPlayerSpawn(playerid)
  537. {
  538.     return 1;
  539. }
  540.  
  541. public OnPlayerDeath(playerid, killerid, reason)
  542. {
  543.     return 1;
  544. }
  545.  
  546. public OnVehicleSpawn(vehicleid)
  547. {
  548.     return 1;
  549. }
  550.  
  551. public OnVehicleDeath(vehicleid, killerid)
  552. {
  553.     return 1;
  554. }
  555.  
  556. public OnPlayerText(playerid, text[])
  557. {
  558.     new message[128];
  559.     format(message, sizeof(message), "%s says: [%s Accent] %s", GetName(playerid), pInfo[playerid][Accent], text);
  560.     ProxDetector(30.0, playerid, message, -1);
  561.     return 0;
  562. }
  563.  
  564. public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
  565. {
  566.     return 1;
  567. }
  568.  
  569. public OnPlayerExitVehicle(playerid, vehicleid)
  570. {
  571.     return 1;
  572. }
  573.  
  574. public OnPlayerStateChange(playerid, newstate, oldstate)
  575. {
  576.     return 1;
  577. }
  578.  
  579. public OnPlayerEnterCheckpoint(playerid)
  580. {
  581.     return 1;
  582. }
  583.  
  584. public OnPlayerLeaveCheckpoint(playerid)
  585. {
  586.     return 1;
  587. }
  588.  
  589. public OnPlayerEnterRaceCheckpoint(playerid)
  590. {
  591.     return 1;
  592. }
  593.  
  594. public OnPlayerLeaveRaceCheckpoint(playerid)
  595. {
  596.     return 1;
  597. }
  598.  
  599. public OnRconCommand(cmd[])
  600. {
  601.     return 1;
  602. }
  603.  
  604. public OnPlayerRequestSpawn(playerid)
  605. {
  606.     return 1;
  607. }
  608.  
  609. public OnObjectMoved(objectid)
  610. {
  611.     return 1;
  612. }
  613.  
  614. public OnPlayerObjectMoved(playerid, objectid)
  615. {
  616.     return 1;
  617. }
  618.  
  619. public OnPlayerPickUpPickup(playerid, pickupid)
  620. {
  621.     return 1;
  622. }
  623.  
  624. public OnVehicleMod(playerid, vehicleid, componentid)
  625. {
  626.     return 1;
  627. }
  628.  
  629. public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
  630. {
  631.     return 1;
  632. }
  633.  
  634. public OnVehicleRespray(playerid, vehicleid, color1, color2)
  635. {
  636.     return 1;
  637. }
  638.  
  639. public OnPlayerSelectedMenuRow(playerid, row)
  640. {
  641.     return 1;
  642. }
  643.  
  644. public OnPlayerExitedMenu(playerid)
  645. {
  646.     return 1;
  647. }
  648.  
  649. public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
  650. {
  651.     return 1;
  652. }
  653.  
  654. public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
  655. {
  656.     return 1;
  657. }
  658.  
  659. public OnRconLoginAttempt(ip[], password[], success)
  660. {
  661.     return 1;
  662. }
  663.  
  664. public OnPlayerUpdate(playerid)
  665. {
  666.     return 1;
  667. }
  668.  
  669. public OnPlayerStreamIn(playerid, forplayerid)
  670. {
  671.     return 1;
  672. }
  673.  
  674. public OnPlayerStreamOut(playerid, forplayerid)
  675. {
  676.     return 1;
  677. }
  678.  
  679. public OnVehicleStreamIn(vehicleid, forplayerid)
  680. {
  681.     return 1;
  682. }
  683.  
  684. public OnVehicleStreamOut(vehicleid, forplayerid)
  685. {
  686.     return 1;
  687. }
  688.  
  689. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  690. {
  691.     new pIP[16];
  692.     GetPlayerIp(playerid, pIP, sizeof(pIP));
  693.     new string[128];
  694.     if(dialogid == DIALOG_REGISTER)
  695.     {
  696.         if(response)
  697.         {
  698.             new INI:File = INI_Open(UserPath(playerid));
  699.             INI_SetTag(File,"data");
  700.             GivePlayerMoney(playerid, 30000);
  701.             SetPlayerScore(playerid, 1);
  702.             INI_WriteString(File, "IP", pIP);
  703.             INI_WriteInt(File, "Banned", 0);
  704.             INI_WriteInt(File, "Password", udb_hash(inputtext));
  705.             INI_WriteInt(File, "Money", 30000);
  706.             INI_WriteInt(File, "MoneyInBank", 0);
  707.             INI_WriteInt(File,"Level", 1);
  708.             INI_WriteInt(File,"Points", 0);
  709.             INI_WriteFloat(File,"Health", 100.0);
  710.             INI_WriteFloat(File,"Armor", 0.0);
  711.             INI_WriteInt(File,"Kills", 0);
  712.             INI_WriteInt(File,"Deaths", 0);
  713.             INI_WriteInt(File,"TimesArrested", 0);
  714.             INI_WriteInt(File,"TimesFined", 0);
  715.             INI_WriteInt(File,"TimesWarned", 0);
  716.             INI_WriteInt(File,"TimesKicked", 0);
  717.             INI_WriteInt(File,"TimesJailed", 0);
  718.             INI_WriteInt(File,"CarsSold", 0);
  719.             INI_WriteInt(File,"MoneyEarnedFromSoldCars", 0);
  720.             INI_WriteString(File, "Slot1Car", "None");
  721.             INI_WriteString(File, "Slot2Car", "None");
  722.             INI_WriteString(File, "Slot3Car", "None");
  723.             INI_WriteString(File, "Slot4Car", "None");
  724.             INI_WriteString(File, "Slot5Car", "None");
  725.             INI_WriteString(File, "VIPSlot6Car", "None");
  726.             INI_WriteString(File, "VIPSlot7Car", "None");
  727.             INI_WriteString(File, "VIPSlot8Car", "None");
  728.             INI_WriteString(File, "VIPSlot9Car", "None");
  729.             INI_WriteString(File, "VIPSlot10Car", "None");
  730.             INI_WriteInt(File,"VIP", 0);
  731.             INI_WriteInt(File,"Admin", 0);
  732.             INI_WriteInt(File,"Helper", 0);
  733.             INI_WriteInt(File,"InTaxiCompany", 0);
  734.             INI_WriteInt(File,"InSANewsCompany", 0);
  735.             INI_WriteInt(File,"Governor", 0);
  736.             INI_WriteInt(File,"InPolice", 0);
  737.             INI_WriteInt(File,"InFBI", 0);
  738.             INI_WriteInt(File,"InSWAT", 0);
  739.             INI_WriteInt(File,"InSANG", 0);
  740.             INI_WriteInt(File,"InSAFMD", 0);
  741.             INI_Close(File);
  742.             pInfo[playerid][IP] = pIP;
  743.             ShowPlayerDialog(playerid, DIALOG_REG-SUCCESS, DIALOG_STYLE_MSGBOX, "Register - Success!", "{00FF00}Success!\nYou will now head to edit your character's details.", "Proceed", "");
  744.         }
  745.         else
  746.         {
  747.             Kick(playerid);
  748.         }
  749.     }
  750.  
  751.     if(dialogid == DIALOG_LOGIN)
  752.     {
  753.         if(response)
  754.         {
  755.             pInfo[playerid][IP] = pIP;
  756.             INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
  757.             GivePlayerMoney(playerid, pInfo[playerid][Money]);
  758.             SetPlayerScore(playerid, pInfo[playerid][Level]);
  759.             format(string, sizeof(string), "Welcome back, %s. Your Player ID is %d.", GetName(playerid), playerid);
  760.             SendClientMessage(playerid, COLOR_GREEN, string);
  761.             TogglePlayerSpectating(playerid, 0);
  762.             SetSpawnInfo(playerid, 0, 295, pInfo[playerid][XPos], pInfo[playerid][YPos], pInfo[playerid][ZPos], 269.15, 0, 0, 0, 0, 0, 0 );
  763.             SpawnPlayer(playerid);
  764.             SetPlayerInterior(playerid, 0);
  765.         }
  766.         else
  767.         {
  768.             Kick(playerid);
  769.         }
  770.     }
  771.  
  772.     if(dialogid == DIALOG_REG-SUCCESS)
  773.     {
  774.         ShowPlayerDialog(playerid, DIALOG_AGE, DIALOG_STYLE_INPUT, "Enter Age", "What is your age?", "Next", "");
  775.     }
  776.  
  777.     if(dialogid == DIALOG_AGE)
  778.     {
  779.         if(strlen(inputtext) == 2)
  780.         {
  781.             strcat(pInfo[playerid][Age], inputtext);
  782.             ShowPlayerDialog(playerid, DIALOG_GENDER, DIALOG_STYLE_LIST, "Select Gender", "Male\nFemale", "Next >>>", "Back <<<");
  783.         }
  784.         else
  785.         {
  786.             SendClientMessage(playerid, COLOR_RED, "ERROR: Age cannot be below 10 or above 99");
  787.             ShowPlayerDialog(playerid, DIALOG_AGE, DIALOG_STYLE_INPUT, "Enter Age", "What is your age?", "Next", "");
  788.         }
  789.     }
  790.  
  791.     if(dialogid == DIALOG_GENDER)
  792.     {
  793.         if(response)
  794.         {
  795.             switch(listitem)
  796.             {
  797.                 case 0:
  798.                 {
  799.                     strcat(pInfo[playerid][Gender], "Male");
  800.                     ShowPlayerDialog(playerid, DIALOG_ORGIN, DIALOG_STYLE_INPUT, "Enter Orgin", "Where did you come from, sir?", "Next >>>", "Back <<<");
  801.                 }
  802.                 case 1:
  803.                 {
  804.                     strcat(pInfo[playerid][Gender], "Female");
  805.                     ShowPlayerDialog(playerid, DIALOG_ORGIN, DIALOG_STYLE_INPUT, "Enter Orgin", "Where did you come from, mam?", "Next >>>", "Back <<<");
  806.                 }
  807.             }
  808.         }
  809.         else
  810.         {
  811.             //The player has pressed "Next >>>".
  812.             switch(listitem)
  813.             {
  814.                 case 0:
  815.                 {
  816.                     ShowPlayerDialog(playerid, DIALOG_AGE, DIALOG_STYLE_INPUT, "Enter Age", "What is your age?", "Next", "");
  817.                 }
  818.                 case 1:
  819.                 {
  820.                     ShowPlayerDialog(playerid, DIALOG_AGE, DIALOG_STYLE_INPUT, "Enter Age", "What is your age?", "Next", "");
  821.                 }
  822.             }
  823.         }
  824.     }
  825.  
  826.     if(dialogid == DIALOG_ORGIN)
  827.     {
  828.         if(response)
  829.         {
  830.             strcat(pInfo[playerid][Age], inputtext);
  831.             ShowPlayerDialog(playerid, DIALOG_ACCENT, DIALOG_STYLE_INPUT, "Enter Accent", "Lastly, what is your accent?", "Tutorial >>>", "Back <<<");
  832.         }
  833.         else
  834.         {
  835.             ShowPlayerDialog(playerid, DIALOG_GENDER, DIALOG_STYLE_LIST, "Select Gender", "Male\nFemale", "Next >>>", "Back <<<");
  836.         }
  837.     }
  838.  
  839.     if(dialogid == DIALOG_ACCENT)
  840.     {
  841.         if(response)
  842.         {
  843.             strcat(pInfo[playerid][Accent], inputtext);
  844.             SetPlayerCameraPos(playerid, 657.0831, 2353.6143, 85.1300);
  845.             SetPlayerCameraLookAt(playerid, 657.5923, 2352.7556, 84.9950);
  846.             TD_SendMessage(playerid, "Welcome to ~y~GameWarfare Roleplay~w~.~n~This roleplay server is set ~g~after~w~you fly~n~into ~y~Los Santos~w~~n~. When you roleplay, you try to act like you would in real life.~n~But that depends, on what type of person you are roleplaying.~n~A civillian would act ~y~normal~w~. Gang Members and people who ~n~break the law, well, break the law.", "~y~GameWarfare Roleplay", 12500, 0x000000AA, 20.0000, 110.000000, 130.000000);
  847.             SetTimerEx("Tut2", 12500, false, "i", playerid);
  848.         }
  849.         else
  850.         {
  851.             if(strcmp(inputtext, "Male", true))
  852.             {
  853.                 ShowPlayerDialog(playerid, DIALOG_ORGIN, DIALOG_STYLE_INPUT, "Enter Orgin", "Where did you come from, sir?", "Next >>>", "Back <<<");
  854.             }
  855.             else
  856.             {
  857.                 ShowPlayerDialog(playerid, DIALOG_ORGIN, DIALOG_STYLE_INPUT, "Enter Orgin", "Where did you come from, mam?", "Next >>>", "Back <<<");
  858.             }
  859.         }
  860.     }
  861.     return 1;
  862. }
  863.  
  864. public OnPlayerClickPlayer(playerid, clickedplayerid, source)
  865. {
  866.     return 1;
  867. }
  868.  
  869. forward RandomMsgs();
  870. public RandomMsgs()
  871. {
  872.     SendClientMessageToAll(0xF04008, RandomMessages[random(sizeof(RandomMessages))]);
  873. }
  874.  
  875.  
  876. stock strreplace(string[], find, replace)
  877. {
  878.     for(new i=0; string[i]; i++)
  879.     {
  880.         if(string[i] == find)
  881.         {
  882.             string[i] = replace;
  883.         }
  884.     }
  885. }
  886.  
  887. stock GetName(playerid)
  888. {
  889.     new
  890.         name[24];
  891.     GetPlayerName(playerid, name, sizeof(name));
  892.     strreplace(name, '_', ' ');
  893.     return name;
  894. }
  895.  
  896. stock ProxDetector(Float:radi, playerid, string[],color)
  897. {
  898.     new Float:x,Float:y,Float:z;
  899.     GetPlayerPos(playerid,x,y,z);
  900.     foreach(Player,i)
  901.     {
  902.         if(IsPlayerInRangeOfPoint(i,radi,x,y,z))
  903.         {
  904.             SendClientMessage(i,color,string);
  905.         }
  906.     }
  907. }
  908.  
  909. ///////////////////////////////////////////////////////////////////
  910. ///////////////////////////////////////////////////////////////////
  911. ///////////////////////////////////////////////////////////////////
  912. CMD:me(playerid, params[])
  913. {
  914.     new
  915.         string[128],
  916.         action[100];
  917.     if(sscanf(params, "s[100]", action))
  918.     {
  919.         SendClientMessage(playerid, COLOR_RED, "USAGE: /me [action]");
  920.         return 1;
  921.     }
  922.     else
  923.     {
  924.         format(string, sizeof(string), "* %s %s", GetName(playerid), action);
  925.         ProxDetector(30, playerid, string, COLOR_PURPLE);
  926.     }
  927.     return 1;
  928. }
  929.  
  930. CMD:shout(playerid, params[])
  931. {
  932.     new
  933.         string[128],
  934.         shout[100];
  935.     if(sscanf(params, "s[100]", shout))
  936.     {
  937.         SendClientMessage(playerid, COLOR_RED, "USAGE: /(s)hout [message]");
  938.         return 1;
  939.     }
  940.     else
  941.     {
  942.         format(string, sizeof(string), "%s shouts: %s!",GetName(playerid),shout);
  943.         ProxDetector(56.9, playerid, string, -1);
  944.     }
  945.     return 1;
  946. }
  947.  
  948. CMD:newbie(playerid, params[])
  949. {
  950.     new
  951.         string[128],
  952.         msg[125],
  953.         levelname[75],
  954.         level,
  955.         helper,
  956.         admin;
  957.  
  958.     level = pInfo[playerid][Level];
  959.     helper = pInfo[playerid][Helper];
  960.     admin = pInfo[playerid][Admin];
  961.  
  962.     if(level == 1) return levelname = "Newbie";
  963.     if(level > 1 && level < 5) return levelname = "Player";
  964.     if(level >= 5 && level < 10) return levelname = "Advanced Player";
  965.     if(level >= 10 && level < 19) return levelname = "Professional Player";
  966.     if(level >= 20) return levelname = "Expert Player";
  967.     if(helper == 1) return levelname = "Basic Helper";
  968.     if(helper == 2) return levelname = "Helper";
  969.     if(helper == 3) return levelname = "Advanced Helper";
  970.     if(helper == 4) return levelname = "Professional Helper";
  971.     if(helper == 5) return levelname = "Expert Helper";
  972.     if(helper >= 6) return levelname = "Head Helper";
  973.     if(admin == 1) return levelname = "Junior Admin";
  974.     if(admin == 2) return levelname = "General Admin";
  975.     if(admin == 3) return levelname = "Senior Admin";
  976.     if(admin == 4) return levelname = "Senior Admin";
  977.     if(admin == 5) return levelname = "Owner";
  978.     if(sscanf(params, "s[100]", msg))
  979.     {
  980.         SendClientMessage(playerid, COLOR_RED, "USAGE: /(n)ewbie [message]");
  981.         return 1;
  982.     }
  983.     else
  984.     {
  985.         format(string, sizeof(string), "%s %s: %s", levelname, GetName(playerid), msg);
  986.         SendClientMessageToAll(COLOR_LIGHTBLUE, string);
  987.     }
  988.     return 1;
  989. }
  990.  
  991. CMD:n(playerid, params[]) return cmd_newbie(playerid, params);
  992. CMD:s(playerid, params[]) return cmd_shout(playerid, params);
  993.  
  994. ////////////////////////////////////////////////
  995. /////// ADMIN COMMANDS ///////////
  996. ////////////////////////////////////////////////
  997.  
  998. CMD:makeadmin(playerid, params[])
  999. {
  1000.     new ID;
  1001.     new lvl;
  1002.     new string[128];
  1003.     new lvlname[50];
  1004.  
  1005.     if(lvl == 0) lvlname = "Not Admin";
  1006.     if(lvl == 1) lvlname = "Junior Administrator";
  1007.     if(lvl == 2) lvlname = "General Administrator";
  1008.     if(lvl == 3) lvlname = "Senior Administrator";
  1009.     if(lvl == 4) lvlname = "Executive Administrator";
  1010.     if(lvl == 5) lvlname = "Owner";
  1011.    
  1012.     print("First Print");
  1013.     if(sscanf(params, "ui", ID, lvl))
  1014.     {
  1015.         SendClientMessage(playerid, COLOR_RED, "USAGE: /makeadmin [PlayerID/Name] [Level]");
  1016.         return 1;
  1017.     }
  1018.     else
  1019.     {
  1020.         if(pInfo[playerid][Admin] == 5 || IsPlayerAdmin(playerid))
  1021.         {
  1022.             print("Made it to admin level check");
  1023.             if(IsPlayerConnected(ID))
  1024.             {
  1025.                 print("Made it to connected check");
  1026.                 if(lvl != pInfo[ID][Admin])
  1027.                 {
  1028.                     print("Made it to check if level does not equal level");
  1029.                     format(string, sizeof(string), "Promoted to~n~~w~Admin Level %d", lvl);
  1030.                     if(pInfo[ID][Admin] < lvl)
  1031.                     {
  1032.                         format(string, sizeof(string), "~g~Promoted to~n~~w~Admin Level %d", lvl);
  1033.                         GameTextForPlayer(playerid, string, 9000, 0);
  1034.                     }
  1035.  
  1036.                     if(pInfo[ID][Admin] > lvl)
  1037.                     {
  1038.                         format(string, sizeof(string), "~r~Demoted to~n~~w~Admin Level %d", lvl);
  1039.                         GameTextForPlayer(playerid, string, 9000, 0);
  1040.                     }
  1041.                     pInfo[ID][Admin] = lvl;
  1042.                     format(string, sizeof(string), "-| You have given %s(%d) admin level %d (%s) |-", GetName(ID), ID, lvl, lvlname);
  1043.                     SendClientMessage(playerid, COLOR_ADMIN, string);
  1044.                     format(string, sizeof(string), "-| Admin %s has given you admin level %d (%s) |-", GetName(playerid), lvl, lvlname);
  1045.                     SendClientMessage(ID, COLOR_ADMIN, string);
  1046.                 }
  1047.                 else
  1048.                 {
  1049.                     SendClientMessage(playerid, COLOR_RED, "ERROR: Player is already that level.");
  1050.                 }
  1051.             }
  1052.             else
  1053.             {
  1054.                 SendClientMessage(playerid, COLOR_RED, "ERROR: Player is not connected. Use /adminoffline to set an offline player's level.");
  1055.             }
  1056.         }
  1057.         else
  1058.         {
  1059.             SendClientMessage(playerid, COLOR_RED, "ERROR: You are not a high enough level to use this command.");
  1060.         }
  1061.     }
  1062.     return 1;
  1063. }
  1064.  
  1065. //////////////////////////////////////////
  1066. /////// HOUSE COMMANDS ///////////////
  1067. //////////////////////////////////////
  1068. CMD:createhouse(playerid, params[])
  1069. {
  1070.     new price;
  1071.     new HouseID = HouseCount;
  1072.     new Location[28];
  1073.     new string[128];
  1074.     new AddressID;
  1075.  
  1076.     if(sscanf(params, "i", price))
  1077.     {
  1078.         SendClientMessage(playerid, COLOR_RED, "USAGE: /createhouse [Price]");
  1079.         return 1;
  1080.     }
  1081.     else
  1082.     {
  1083.         if(pInfo[playerid][Admin] >= 4)
  1084.         {
  1085.             GetPlayer2DZone(playerid, Location, 28);
  1086.             new Float:x, Float:y, Float:z;
  1087.             GetPlayerPos(playerid, x, y, z);
  1088.             hInfo[HouseID][Owned] = false;
  1089.             format(hInfo[HouseID][HouseOwner], MAX_PLAYER_NAME, "None %d", HouseID);
  1090.             hInfo[HouseID][HouseX] = x;
  1091.             hInfo[HouseID][HouseY] = y;
  1092.             hInfo[HouseID][HouseZ] = z;
  1093.             hInfo[HouseID][Price] = price;
  1094.             hInfo[HouseID][Locked] = true;
  1095.             hInfo[HouseID][HousePickup] = true;
  1096.             zInfo[GetPlayer2DZoneID(playerid)][HousesInZone]++;
  1097.             AddressID = zInfo[GetPlayer2DZoneID(playerid)][HousesInZone];
  1098.             format(hInfo[HouseID][HouseAddress], 48, "%d %s", AddressID, Location);
  1099.             hInfo[HouseID][DoorPickup] = CreateDynamicPickup(1273, 1, x, y, z, 0);
  1100.             format(string, sizeof(string), "{00FF00}House for Sale\n{00FFFF}$%d\nAddress: %s", price, hInfo[HouseID][HouseAddress]);
  1101.             hInfo[HouseID][DoorTextID] = CreateDynamic3DTextLabel(string, 0x008080FF, x, y, z + 0.7, 50.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 1);
  1102.             Iter_Add(Houses, HouseID);
  1103.             format(string, sizeof(string), "-| House ID %d created! |-", HouseID);
  1104.             SendClientMessage(playerid, COLOR_GREEN, string);
  1105.             hInfo[HouseID][Buyable] = true;
  1106.             HouseFileCreate(HouseID);
  1107.             HouseCount++;
  1108.         }
  1109.         else
  1110.         {
  1111.             SendClientMessage(playerid, COLOR_RED, "ERROR: You are not a high enough level to use this command.");
  1112.         }
  1113.     }
  1114.     return 1;
  1115. }
  1116.  
  1117. CMD:delhouse(playerid, params[])
  1118. {
  1119.     new string[128];
  1120.     new HouseID;
  1121.  
  1122.     if(pInfo[playerid][Admin] >= 4)
  1123.     {
  1124.         foreach(new h : Houses)
  1125.         {
  1126.             if(IsValidDynamicPickup(hInfo[h][DoorPickup]))
  1127.             {
  1128.                 if(IsPlayerInRangeOfPoint(playerid, 2.5, hInfo[h][HouseX], hInfo[h][HouseY], hInfo[h][HouseZ]))
  1129.                 {
  1130.                     format(string, sizeof(string), "-| House ID %d deleted. |-", h);
  1131.                     SendClientMessage(playerid, COLOR_RED, string);
  1132.                     hInfo[h][Owned] = false;
  1133.                     format(hInfo[HouseID][HouseName], 128, "Deleted %d", HouseID);
  1134.                     DestroyDynamicPickup(hInfo[h][DoorPickup]);
  1135.                     DestroyDynamic3DTextLabel(hInfo[h][DoorTextID]);
  1136.                     hInfo[h][Buyable] = false;
  1137.                     hInfo[h][Locked] = false;
  1138.                     hInfo[h][HousePickup] = false;
  1139.                     Iter_Remove(Houses, h);
  1140.                     HouseFileRemove(h);
  1141.                     zInfo[GetPlayer2DZoneID(playerid)][HousesInZone]--;
  1142.                     return 1;
  1143.                 }
  1144.             }
  1145.         }
  1146.     }
  1147.     else
  1148.     {
  1149.         SendClientMessage(playerid, COLOR_RED, "ERROR: You are not a high enough level to use this command.");
  1150.     }
  1151.     return 1;
  1152. }
  1153.  
  1154. /*CMD:buyhouse(playerid, params[])
  1155. {
  1156.     #pragma unused params
  1157.     foreach(new h : Houses)
  1158.     {
  1159.         if(IsValidDynamicPickup(hInfo[h][DoorPickup]))
  1160.         {
  1161.             if(IsPlayerInRangeOfPoint(playerid, 2.5, hInfo[h][HouseX], hInfo[h][HouseY], hInfo[h][HouseZ]))
  1162.             {
  1163.                 if(GetPlayerMoney(playerid) >= hInfo[h][Price])
  1164.                 {
  1165.                     GivePlayerMoney(playerid, -hInfo[h][Price])
  1166.                     SendClientMessage(playerid, COLOR_GREEN, "-| You have successfully bought a house! |-");
  1167.     */
  1168. ///////////////////////////////////////////////////////
  1169. ///////////////////////////////////////////////////////
  1170. ///////////////////////////////////////////////////////
  1171. forward LoadUser_data(playerid,name[],value[]);
  1172. public LoadUser_data(playerid,name[],value[])
  1173. {
  1174.     INI_String("IP", pInfo[playerid][IP], 16);
  1175.     INI_Int("Banned", pInfo[playerid][Banned]);
  1176.     INI_Int("Password", pInfo[playerid][Password]);
  1177.     INI_Int("Money", pInfo[playerid][Money]);
  1178.     INI_Int("MoneyInBank", pInfo[playerid][MoneyInBank]);
  1179.     INI_Int("Level", pInfo[playerid][Level]);
  1180.     INI_Int("Points", pInfo[playerid][Points]);
  1181.     INI_Float("Health", pInfo[playerid][Health]);
  1182.     INI_Float("Armor", pInfo[playerid][Armor]);
  1183.     INI_Int("Kills", pInfo[playerid][Kills]);
  1184.     INI_Int("Deaths", pInfo[playerid][Deaths]);
  1185.     INI_Int("TimesArrested", pInfo[playerid][TimesArrested]);
  1186.     INI_Int("TimesFined", pInfo[playerid][TimesFined]);
  1187.     INI_Int("TimesWarned", pInfo[playerid][TimesWarned]);
  1188.     INI_Int("TimesKicked", pInfo[playerid][TimesKicked]);
  1189.     INI_Int("TimesJailed", pInfo[playerid][TimesJailed]);
  1190.     INI_Int("Skin", pInfo[playerid][Skin]);
  1191.     INI_Int("PhoneNumber", pInfo[playerid][PhoneNumber]);
  1192.     INI_Float("XPosition", pInfo[playerid][XPos]);
  1193.     INI_Float("YPosition", pInfo[playerid][YPos]);
  1194.     INI_Float("ZPosition", pInfo[playerid][ZPos]);
  1195.     INI_Int("CarsSold", pInfo[playerid][CarsSold]);
  1196.     INI_Int("MoneyEarnedFromSoldCars", pInfo[playerid][MoneyEarnedFromSoldCars]);
  1197.     INI_String("Slot1Car", pInfo[playerid][CarNameInSlot1], 100);
  1198.     INI_String("Slot2Car", pInfo[playerid][CarNameInSlot2], 100);
  1199.     INI_String("Slot3Car", pInfo[playerid][CarNameInSlot3], 100);
  1200.     INI_String("Slot4Car", pInfo[playerid][CarNameInSlot4], 100);
  1201.     INI_String("Slot5Car", pInfo[playerid][CarNameInSlot5], 100);
  1202.     INI_String("VIPSlot6Car", pInfo[playerid][CarNameInVIPSlot6], 100);
  1203.     INI_String("VIPSlot7Car", pInfo[playerid][CarNameInVIPSlot7], 100);
  1204.     INI_String("VIPSlot8Car", pInfo[playerid][CarNameInVIPSlot8], 100);
  1205.     INI_String("VIPSlot9Car", pInfo[playerid][CarNameInVIPSlot9], 100);
  1206.     INI_String("VIPSlot10Car", pInfo[playerid][CarNameInVIPSlot10], 100);
  1207.     INI_Int("HouseInSlot1", pInfo[playerid][HouseIDInSlot1]);
  1208.     INI_Int("HouseInSlot2", pInfo[playerid][HouseIDInSlot2]);
  1209.     INI_Int("HouseInSlot3", pInfo[playerid][HouseIDInSlot3]);
  1210.     INI_Int("HouseInVIPSlot4", pInfo[playerid][HouseIDInVIPSlot4]);
  1211.     INI_Int("HouseInVIPSlot5", pInfo[playerid][HouseIDInVIPSlot5]);
  1212.     INI_Int("BusinessInSlot1", pInfo[playerid][BusinessIDInSlot1]);
  1213.     INI_Int("BusinessInSlot2", pInfo[playerid][BusinessIDInSlot2]);
  1214.     INI_Int("BusinessInVIPSlot3", pInfo[playerid][BusinessIDInVIPSlot3]);
  1215.     INI_Int("BusinessInVIPSlot4", pInfo[playerid][BusinessIDInVIPSlot4]);
  1216.     INI_Int("BusinessInVIPSlot5", pInfo[playerid][BusinessIDInVIPSlot5]);
  1217.     INI_Int("VIP", pInfo[playerid][VIP]);
  1218.     INI_Int("Admin", pInfo[playerid][Admin]);
  1219.     INI_Int("Helper", pInfo[playerid][Helper]);
  1220.     INI_Int("InTaxiCompany", pInfo[playerid][InTaxiCompany]);
  1221.     INI_Int("InSANewsCompany", pInfo[playerid][InSANewsCompany]);
  1222.     INI_Int("Governor", pInfo[playerid][Governor]);
  1223.     INI_Int("InPolice", pInfo[playerid][InPolice]);
  1224.     INI_Int("InFBI", pInfo[playerid][InFBI]);
  1225.     INI_Int("InSWAT", pInfo[playerid][InSWAT]);
  1226.     INI_Int("InSANG", pInfo[playerid][InSANG]);
  1227.     INI_Int("InSAFMD", pInfo[playerid][InSAFMD]);
  1228.     INI_Float("Slot1CarXPos", pInfo[playerid][Slot1CarXPos]);
  1229.     INI_Float("Slot1CarYPos", pInfo[playerid][Slot1CarYPos]);
  1230.     INI_Float("Slot1CarZPos", pInfo[playerid][Slot1CarZPos]);
  1231.     INI_Float("Slot2CarXPos", pInfo[playerid][Slot2CarXPos]);
  1232.     INI_Float("Slot2CarYPos", pInfo[playerid][Slot2CarYPos]);
  1233.     INI_Float("Slot2CarZPos", pInfo[playerid][Slot2CarZPos]);
  1234.     INI_Float("Slot3CarXPos", pInfo[playerid][Slot3CarXPos]);
  1235.     INI_Float("Slot3CarYPos", pInfo[playerid][Slot3CarYPos]);
  1236.     INI_Float("Slot3CarZPos", pInfo[playerid][Slot3CarZPos]);
  1237.     INI_Float("Slot4CarXPos", pInfo[playerid][Slot4CarXPos]);
  1238.     INI_Float("Slot4CarYPos", pInfo[playerid][Slot4CarYPos]);
  1239.     INI_Float("Slot4CarZPos", pInfo[playerid][Slot4CarZPos]);
  1240.     INI_Float("Slot5CarXPos", pInfo[playerid][Slot5CarXPos]);
  1241.     INI_Float("Slot5CarYPos", pInfo[playerid][Slot5CarYPos]);
  1242.     INI_Float("Slot5CarZPos", pInfo[playerid][Slot5CarZPos]);
  1243.     INI_Float("Slot6CarXPos", pInfo[playerid][Slot6CarXPos]);
  1244.     INI_Float("Slot6CarYPos", pInfo[playerid][Slot6CarYPos]);
  1245.     INI_Float("Slot6CarZPos", pInfo[playerid][Slot6CarZPos]);
  1246.     INI_Float("Slot7CarXPos", pInfo[playerid][Slot7CarXPos]);
  1247.     INI_Float("Slot7CarYPos", pInfo[playerid][Slot7CarYPos]);
  1248.     INI_Float("Slot7CarZPos", pInfo[playerid][Slot7CarZPos]);
  1249.     INI_Float("Slot8CarXPos", pInfo[playerid][Slot8CarXPos]);
  1250.     INI_Float("Slot8CarYPos", pInfo[playerid][Slot8CarYPos]);
  1251.     INI_Float("Slot8CarZPos", pInfo[playerid][Slot8CarZPos]);
  1252.     INI_Float("Slot9CarXPos", pInfo[playerid][Slot9CarXPos]);
  1253.     INI_Float("Slot9CarYPos", pInfo[playerid][Slot9CarYPos]);
  1254.     INI_Float("Slot9CarZPos", pInfo[playerid][Slot9CarZPos]);
  1255.     INI_Float("Slot10CarXPos", pInfo[playerid][Slot10CarXPos]);
  1256.     INI_Float("Slot10CarYPos", pInfo[playerid][Slot10CarYPos]);
  1257.     INI_Float("Slot10CarZPos", pInfo[playerid][Slot10CarZPos]);
  1258.     return 1;
  1259. }
  1260.  
  1261. stock UserPath(playerid)
  1262. {
  1263.     new string[128],playername[MAX_PLAYER_NAME];
  1264.     GetPlayerName(playerid,playername,sizeof(playername));
  1265.     format(string,sizeof(string),PATH,playername);
  1266.     return string;
  1267. }
  1268.  
  1269. stock HousePath(HouseID)
  1270. {
  1271.     new string[128];
  1272.     format(string,sizeof(string),HPATH,HouseID);
  1273.     return string;
  1274. }
  1275.  
  1276. stock udb_hash(buf[]) {
  1277.     new length=strlen(buf);
  1278.     new s1 = 1;
  1279.     new s2 = 0;
  1280.     new n;
  1281.     for (n=0; n<length; n++)
  1282.     {
  1283.        s1 = (s1 + buf[n]) % 65521;
  1284.        s2 = (s2 + s1)     % 65521;
  1285.     }
  1286.     return (s2 << 16) + s1;
  1287. }
  1288.  
  1289.  
  1290. stock minrand(min, max) //By Alex "Y_Less" Cole
  1291. {
  1292.     return random(max - min) + min;
  1293. }
  1294.  
  1295. stock GivePlayerWarning(playerid, warnedid, reason[])
  1296. {
  1297.     foreach(new admins:
  1298.     new string[128];
  1299.     if(pInfo[warnedid][CurrentWarnings] == 0)
  1300.     {
  1301.         format(string, sizeof(string), "-| %s has been warned by an admin. | Reason: %s | Warning 1/3 |-", GetName(warnedid), reason);
  1302.         ProxDetector(25.0, warnedid, string, COLOR_ADMIN);
  1303.         pInfo[warnedid][CurrentWarnings] = 1;
  1304.     }
  1305.  
  1306.     if(pInfo[warnedid][CurrentWarnings] == 1)
  1307.     {
  1308.         format(string, sizeof(string), "-| %s has been warned by an admin. | Reason: %s | Warning 2/3 |-", GetName(warnedid), reason);
  1309.         ProxDetector(25.0, warnedid, string, COLOR_ADMIN);
  1310.         pInfo[warnedid][CurrentWarnings] = 2;
  1311.     }
  1312.  
  1313.     if(pInfo[warnedid][CurrentWarnings] == 2)
  1314.     {
  1315.         format(string, sizeof(string), "-| %s has been auto kicked. Too many warnings. | Reason: %s | Warning 3/3 |-", GetName(warnedid), reason);
  1316.         ProxDetector(25.0, warnedid, string, COLOR_ADMIN);
  1317.         pInfo[warnedid][CurrentWarnings] = 0;
  1318.         pInfo[warnedid][TimesKicked]++;
  1319.         Kick(warnedid);
  1320.     }
  1321.     return 1;
  1322. }
  1323.  
  1324. stock HouseFileCreate(HouseID)
  1325. {
  1326.     new INI:File = INI_Open(HousePath(HouseID));
  1327.     INI_WriteInt(File, "HouseID", HouseID);
  1328.     INI_WriteString(File, "HouseAddress", hInfo[HouseID][HouseAddress]);
  1329.     INI_WriteFloat(File,"XPosition", hInfo[HouseID][HouseX]);
  1330.     INI_WriteFloat(File,"YPosition", hInfo[HouseID][HouseY]);
  1331.     INI_WriteFloat(File,"ZPosition", hInfo[HouseID][HouseZ]);
  1332.     INI_WriteBool(File,"Owned", hInfo[HouseID][Owned]);
  1333.     INI_WriteInt(File,"Price", hInfo[HouseID][Price]);
  1334.     INI_WriteString(File,"HouseOwner", hInfo[HouseID][HouseOwner]);
  1335.     INI_WriteInt(File,"InteriorID", hInfo[HouseID][Interior]);
  1336.     INI_WriteFloat(File,"IntX", hInfo[HouseID][IntX]);
  1337.     INI_WriteFloat(File,"IntY", hInfo[HouseID][IntY]);
  1338.     INI_WriteFloat(File,"IntZ", hInfo[HouseID][IntZ]);
  1339.     INI_WriteBool(File,"Locked", hInfo[HouseID][Locked]);
  1340.     INI_WriteBool(File,"BuyPickup", hInfo[HouseID][HousePickup]);
  1341.     INI_WriteString(File,"DoorText", hInfo[HouseID][DoorText]);
  1342.     INI_WriteBool(File,"Buyable", hInfo[HouseID][Buyable]);
  1343.     INI_Close(File);
  1344.     return 1;
  1345. }
  1346.  
  1347. stock HouseFileRemove(HouseID)
  1348. {
  1349.     fremove(HousePath(HouseID));
  1350.     return 1;
  1351. }
  1352.  
  1353. ///////////////////////////////////////////////////////
  1354. ///////////////////////////////////////////////////////
  1355. ///////////////////////////////////////////////////////
  1356. ///////////////////////////////////////////////////////
  1357. public Tut2(playerid)
  1358. {
  1359.     SetPlayerCameraPos(playerid, 1385.0044, -1589.4882, 83.8622);
  1360.     SetPlayerCameraLookAt(playerid, 1385.9458, -1589.8208, 83.5972);
  1361.     TD_SendMessage(playerid, "If you break the law, the ~b~police~w~ will come after you.~n~If they get to you and cuff you, they will take you~n~to the ~y~police department~w~and question you. After that, they usually ~r~arrest~w~~n~you..~n~You can pay a ~y~bail~w~ to get out, or~n~serve the time. If you are caught ~r~fighting~w~ in jail, you will be~n~~b~tazed~w~ and given more time.", "Getting Arrested", 12500, 0x000000AA, 20.0000, 110.000000, 130.000000);
  1362.     SetTimerEx("Tut3", 14000, false, "i", playerid);
  1363.     return 1;
  1364. }
  1365.  
  1366. public Tut3(playerid)
  1367. {
  1368.     SetPlayerCameraPos(playerid, 1813.2134, -1827.4246, 30.1471);
  1369.     SetPlayerCameraLookAt(playerid, 1814.0741, -1827.9305, 29.5921);
  1370.     TD_SendMessage(playerid, "This is a ~y~24/7~w~. At 24/7s, you can buy and sell things. This is also ~n~where you can buy useful things such as ~r~medkits~w~,~y~repair kits~w~,~n~and ~b~locks~w~. Some 24/7s are also gas stations.", "24/7 Store", 12500, 0x000000AA, 20.0000, 110.000000, 130.000000);
  1371.     SetTimerEx("Tut4", 12500, false, "i", playerid);
  1372.     return 1;
  1373. }
  1374.  
  1375. public Tut4(playerid)
  1376. {
  1377.     SetPlayerCameraPos(playerid, -97.9495, 1996.9739, 97.2413);
  1378.     SetPlayerCameraLookAt(playerid, -96.9954, 1996.6803, 97.0662);
  1379.     TD_SendMessage(playerid, "~y~Fort Offutt~w~ is a restricted area. ~b~Anyone~w~ caught inside it~n~is entering a ~r~restricted~w~ area and will be~n~~y~questioned~w~ and ~r~arrested~w~.", "Fort Offutt", 12500, 0x000000AA, 20.0000, 110.000000, 130.000000);
  1380.     SetTimerEx("Tut5", 13500, false, "i", playerid);
  1381.     return 1;
  1382. }
  1383.  
  1384. public Tut5(playerid)
  1385. {
  1386.     SetPlayerCameraPos(playerid, 1620.6338, 1706.5488, 28.9259);
  1387.     SetPlayerCameraLookAt(playerid, 1621.4407, 1707.1355, 28.6609);
  1388.     TD_SendMessage(playerid, "You can buy ~y~clothes~w~ (toys) at clothes shops.~n~There are clothes shops located in ~g~every~w~city.~n~You can also change your ~y~skin~w~.", "Clothes Shops", 12500, 0x000000AA, 20.0000, 110.000000, 130.000000);
  1389.     SetTimerEx("Tut6", 12500, false, "i", playerid);
  1390.     return 1;
  1391. }
  1392.  
  1393. public Tut6(playerid)
  1394. {
  1395.     SetPlayerCameraPos(playerid, 1763.4729, 1538.3271, 55.9853);
  1396.     SetPlayerCameraLookAt(playerid, 1762.7649, 1537.6239, 55.6452);
  1397.     TD_SendMessage(playerid, "At airports, you can get rides to other airports.~n~A ~g~progress bar~w~ will show up indicating how close you are to the ~y~~n~destination. Each plane ticket costs a different amount of cash, depending on how far~n~your destination is. This can be used for ~g~easy~w~ travel.", "Airplane Rides", 12500, 0x000000AA, 20.0000, 110.000000, 130.000000);
  1398.     SetTimerEx("FinalTut", 12500, false, "i", playerid);
  1399.     return 1;
  1400. }
  1401.  
  1402. public FinalTut(playerid)
  1403. {
  1404.     SetPlayerCameraPos(playerid, -1784.7091, -355.8275, 210.3701);
  1405.     SetPlayerCameraLookAt(playerid, -1785.2263, -354.9741, 210.1050);
  1406.     TD_SendMessage(playerid, "You're ready to go into the world of ~y~GW-RP~w~! Get ~g~ready~w~!", "Ready to go!", 5001, 0x000000AA, 20.0000, 110.000000, 130.000000);
  1407.     SetTimerEx("Spawn", 5000, false, "i", playerid);
  1408. }
  1409.  
  1410. public Spawn(playerid)
  1411. {
  1412.     if(strcmp(pInfo[playerid][Gender], "Male", true))
  1413.     {
  1414.         TogglePlayerSpectating(playerid, 0);
  1415.         SetPlayerPos(playerid, -1424.6716, -288.3624, 14.1484);
  1416.         SetPlayerInterior(playerid, 0);
  1417.         SetCameraBehindPlayer(playerid);
  1418.         SetPlayerSkin(playerid, 295);
  1419.         pInfo[playerid][Level] = 1;
  1420.     }
  1421.     else if(strcmp(pInfo[playerid][Gender], "Female", true))
  1422.     {
  1423.         TogglePlayerSpectating(playerid, 0);
  1424.         SetPlayerPos(playerid, 1643.0640, -2332.2261, 13.5469);
  1425.         SetPlayerInterior(playerid, 0);
  1426.         SetCameraBehindPlayer(playerid);
  1427.         SetPlayerSkin(playerid, 93);
  1428.         pInfo[playerid][Level] = 1;
  1429.     }
  1430.     return 1;
  1431. }
Advertisement
Add Comment
Please, Sign In to add comment