Advertisement
Guest User

Krsh

a guest
Jan 3rd, 2009
459
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 34.88 KB | None | 0 0
  1. #include <a_samp>
  2. #include <dudb>
  3.  
  4. // VitualWorld bug fixed by Krish
  5.  
  6. #define dcmd(%1,%2,%3) if ((strcmp((%3)[1], #%1, true, (%2)) == 0) && ((((%3)[(%2) + 1] == 0) && (dcmd_%1(playerid, "")))||(((%3)[(%2) + 1] == 32) && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1
  7. //script by Leopard, original created by Antironix
  8. #define MAX_HOUSES 51
  9. #define MAX_RENTCOST 1000
  10.  
  11. #define MIN_RENTCOST 500
  12.  
  13. #define MAX_BUY_CARS 8
  14. #define CAR_DELIVER_TIME 1
  15. new HOUSE_STATS = 0; //0=stats on pickup, reverse if 1.
  16.  
  17. enum CarInfo {CarModel,CarName[24],CarCost};
  18. new Buyable_Cars[MAX_BUY_CARS][CarInfo] =
  19. { //Modelid, Buy Name, Price
  20. {411,"Infernus",0},
  21. {522,"NRG-500",50000},
  22. {451,"Turismo",50000},
  23. {541,"Bullet",50000},
  24. {415,"Cheetah",50000},
  25. {429,"Banshee",50000},
  26. {494,"Hotring",50000},
  27. {556,"Monster",50000}
  28. };
  29. #define Cost_Admiral 50000
  30. //----------------------------
  31. #define c_y 0xFFFF00AA
  32. #define c_r 0xAA3333AA
  33. new HousePickup[MAX_HOUSES];
  34. new playerinterior[MAX_PLAYERS]=-1;
  35. new inhousepickup[MAX_PLAYERS];
  36. new playericonhouse[MAX_PLAYERS];
  37. new Float:housex, Float:housey, Float:housez;
  38. new housemapicon[MAX_PLAYERS];
  39. new playerworld[MAX_PLAYERS];
  40. new bool:KillVeh[MAX_VEHICLES] = false;
  41. forward rentfee();
  42. forward newcar();
  43. forward KillVehicle(carid);
  44. enum HouseInfo {Name[24],Renter[24],Rentable,Rentcost,Cost,Sell,Interior,Virtualworld,Locked,Float:InteriorX,Float:InteriorY,Float:InteriorZ,Float:iconx,Float:icony,Float:iconz,Rentfee}
  45. new hInfo[MAX_HOUSES][HouseInfo];
  46. enum HouseCarInfo {HouseCar,GotCar,Houseid,CarModel,Float:CarX,Float:CarY,Float:CarZ,CarColor1,CarColor2,Respawn_Delay,NewCar}
  47. new cInfo[MAX_HOUSES][HouseCarInfo];
  48. public OnFilterScriptInit()
  49. {
  50. print("--------------------------------------");
  51. print(" Simple House System by Antironix");
  52. print("--------------------------------------");
  53. AddHouse(0, 2524.708007, -1658.585571, 15.824020, 2251.85, -1138.16, 1050.63, 50000, 49000, 9, 96); //Small house
  54.  
  55. AddHouse(1, 2523.258544, -1679.322387, 15.496999, 2496.65, -1696.55, 1014.74, 10000, 90000, 3, 200);//Medium House
  56.  
  57. AddHouse(2, 2514.306396, -1691.628173, 14.046038, 2251.85, -1138.16, 1050.63, 50000, 49000, 9, 147); //Small house
  58.  
  59. AddHouse(3, 2486.474121, -1644.539794, 14.077178, 2496.65, -1696.55, 1014.74, 10000, 90000, 3, 254);//Medium House
  60.  
  61. AddHouse(4, 2469.367675, -1646.346313, 13.780097, 2251.85, -1138.16, 1050.63, 50000, 49000, 9, 31); //Small house
  62.  
  63. AddHouse(5, 2452.079833, -1641.410888, 14.066207, 2496.65, -1696.55, 1014.74, 10000, 90000, 3, 42);//Medium House
  64.  
  65. AddHouse(6, 2459.347412, -1691.663696, 13.547404, 2496.65, -1696.55, 1014.74, 10000, 90000, 3, 165);//Medium House
  66.  
  67. AddHouse(7, 2409.027343, -1674.929199, 14.375000, 2251.85, -1138.16, 1050.63, 50000, 49000, 9, 60); //Small house
  68.  
  69. AddHouse(8, 2413.904785, -1646.787353, 14.011916, 2251.85, -1138.16, 1050.63, 50000, 49000, 9, 28); //Small house
  70.  
  71. AddHouse(9, 2393.170898, -1646.039550, 13.905097, 2251.85, -1138.16, 1050.63, 50000, 49000, 9, 208); //Small house
  72.  
  73. AddHouse(10, 2384.562500, -1675.832397, 15.245691, 2496.65, -1696.55, 1014.74, 10000, 90000, 3, 62);//Medium House
  74.  
  75. AddHouse(11, 2362.864990, -1643.193481, 14.351562, 2496.65, -1696.55, 1014.74, 10000, 90000, 3, 165);//Medium House
  76.  
  77. AddHouse(12, 2368.354248, -1675.343750, 14.168166, 2496.65, -1696.55, 1014.74, 10000, 90000, 3, 64);//Medium House
  78.  
  79. AddHouse(13, 2326.885253, -1681.938720, 14.929687, 2251.85, -1138.16, 1050.63, 50000, 49000, 9, 238); //Small house
  80.  
  81. AddHouse(14, 2326.760986, -1716.704223, 14.237878, 2496.65, -1696.55, 1014.74, 10000, 90000, 3, 123);//Medium House
  82.  
  83. AddHouse(15, 2308.929443, -1714.336669, 14.980066, 2496.65, -1696.55, 1014.74, 10000, 90000, 3, 116);//Medium House
  84.  
  85. AddHouse(16, 2022.940307, -1120.264282, 26.421045, 2496.65, -1696.55, 1014.74, 10000, 90000, 3, 126);//Medium House
  86.  
  87. AddHouse(17, 2000.065063, -1114.055419, 27.125000, 2496.65, -1696.55, 1014.74, 10000, 90000, 3, 209);//Medium House
  88.  
  89. AddHouse(18, 1955.515747, -1115.504272, 27.830497, 2496.65, -1696.55, 1014.74, 10000, 90000, 3, 216);//Medium House
  90.  
  91. AddHouse(19, 1939.205078, -1114.483276, 27.452295, 2251.85, -1138.16, 1050.63, 50000, 49000, 9, 40); //Small house
  92.  
  93. AddHouse(20, 1921.306396, -1115.236816, 27.088310, 2251.85, -1138.16, 1050.63, 50000, 49000, 9, 78); //Small house
  94.  
  95. AddHouse(21, 1906.116821, -1112.945556, 26.664062, 2251.85, -1138.16, 1050.63, 50000, 49000, 9, 157); //Small house
  96.  
  97. AddHouse(22, 1885.888427, -1113.511718, 26.275810, 2251.85, -1138.16, 1050.63, 50000, 49000, 9, 145); //Small house
  98.  
  99. AddHouse(23, 1895.496215, -2068.915771, 15.668893, 2251.85, -1138.16, 1050.63, 50000, 49000, 9, 213); //Small house
  100.  
  101. AddHouse(24, 1873.601196, -2070.754150, 15.497086, 2251.85, -1138.16, 1050.63, 50000, 49000, 9, 156); //Small house
  102.  
  103. AddHouse(25, 1851.932250, -2070.454101, 15.481237, 2251.85, -1138.16, 1050.63, 50000, 49000, 9, 26); //Small house
  104.  
  105. AddHouse(26, 1804.197631, -2124.903564, 13.942373, 2496.65, -1696.55, 1014.74, 10000, 90000, 3, 156);//Medium House
  106.  
  107. AddHouse(27, 1802.037963, -2098.944580, 14.021014, 2496.65, -1696.55, 1014.74, 10000, 90000, 3, 31);//Medium House
  108.  
  109. AddHouse(28, 1782.298828, -2126.508789, 14.067889, 2496.65, -1696.55, 1014.74, 10000, 90000, 3, 136);//Medium House
  110.  
  111. AddHouse(29, 1781.393920, -2101.266845, 14.056648, 2496.65, -1696.55, 1014.74, 10000, 90000, 3, 45);//Medium House
  112.  
  113. AddHouse(30, 1762.353027, -2101.997314, 13.856951, 2251.85, -1138.16, 1050.63, 50000, 49000, 9, 55); //Small house
  114.  
  115. AddHouse(31, 1761.206420, -2125.445556, 14.056648, 2251.85, -1138.16, 1050.63, 50000, 49000, 9, 237); //Small house
  116.  
  117. AddHouse(32, 1734.612426, -2130.351074, 14.021014, 2251.85, -1138.16, 1050.63, 50000, 49000, 9, 177); //Small house
  118.  
  119. AddHouse(33, 1734.157470, -2097.987792, 14.036639, 2251.85, -1138.16, 1050.63, 50000, 49000, 9, 12); //Small house
  120.  
  121. AddHouse(34, 1711.653686, -2101.233154, 14.021014, 2251.85, -1138.16, 1050.63, 50000, 49000, 9, 168); //Small house
  122.  
  123. AddHouse(35, 1715.158447, -2125.452392, 14.056648, 2496.65, -1696.55, 1014.74, 10000, 90000, 3, 170);//Medium House
  124.  
  125. AddHouse(36, 1695.315063, -2125.835449, 13.810076, 2496.65, -1696.55, 1014.74, 10000, 90000, 3, 3);//Medium House
  126.  
  127. AddHouse(37, 1895.532104, -2019.673095, 13.546875, 1299.14, -794.77, 1084.00, 30000, 31090, 5, 239); //Mansion
  128.  
  129. AddHouse(38, 1377.808959, -1753.181030, 14.140625, 2496.65, -1696.55, 1014.74, 10000, 90000, 3, 26);//Medium House
  130.  
  131. AddHouse(39, 769.225158, -1746.006835, 13.077295, 2251.85, -1138.16, 1050.63, 50000, 49000, 9, 208); //Small house
  132.  
  133. AddHouse(40, 769.216430, -1696.486206, 5.155420, 2251.85, -1138.16, 1050.63, 50000, 49000, 9, 185); //Small house
  134.  
  135. AddHouse(41, 2148.937255, -1484.769409, 26.624198, 2324.33, -1144.79, 1050.71, 150000, 140000, 12, 93);//Big house
  136.  
  137. AddHouse(42, 2146.797363, -1470.428222, 26.042566, 2496.65, -1696.55, 1014.74, 10000, 90000, 3, 28);//Medium House
  138.  
  139. AddHouse(43, 2152.212890, -1446.412719, 26.105066, 2496.65, -1696.55, 1014.74, 10000, 90000, 3, 99);//Medium House
  140.  
  141. AddHouse(44, 2149.851562, -1433.655517, 26.070312, 2496.65, -1696.55, 1014.74, 10000, 90000, 3, 26);//Medium House
  142.  
  143. AddHouse(45, 2150.923095, -1419.064575, 25.921875, 2496.65, -1696.55, 1014.74, 10000, 90000, 3, 96);//Medium House
  144.  
  145. AddHouse(46, 2151.178710, -1400.568969, 26.128503, 2496.65, -1696.55, 1014.74, 10000, 90000, 3, 108);//Medium House
  146.  
  147. AddHouse(47, 2244.466308, -1637.620849, 16.237878, 2251.85, -1138.16, 1050.63, 50000, 49000, 9, 251); //Small house
  148.  
  149. AddHouse(48, 2257.065917, -1643.933837, 15.808191, 2251.85, -1138.16, 1050.63, 50000, 49000, 9, 97); //Small house
  150.  
  151. AddHouse(49, 2282.194091, -1641.226684, 15.889788, 2251.85, -1138.16, 1050.63, 50000, 49000, 9, 8); //Small house
  152.  
  153. AddHouse(50, 2306.942626, -1679.198242, 14.331628, 2251.85, -1138.16, 1050.63, 50000, 49000, 9, 76); //Small house
  154.  
  155. SetTimer("rentfee", 1*60*60*1000, 1);//1 hour
  156. SetTimer("newcar", CAR_DELIVER_TIME*60*10*1000,1);//1 hour
  157. return 0;
  158. }
  159. public OnFilterScriptExit()
  160. {
  161. for(new i=0;i<MAX_HOUSES;i++)
  162. {
  163. DestroyPickup(HousePickup[i]);
  164. DestroyVehicle(cInfo[i][HouseCar]);
  165. }
  166. }
  167. public OnPlayerCommandText(playerid,cmdtext[])
  168. {
  169. dcmd(buy,3,cmdtext);
  170. dcmd(sell,4,cmdtext);
  171. dcmd(enter,5,cmdtext);
  172. dcmd(exit,4,cmdtext);
  173. dcmd(lock,4,cmdtext);
  174. dcmd(unlock,6,cmdtext);
  175. dcmd(home,4,cmdtext);
  176. dcmd(setrent,7,cmdtext);
  177. dcmd(rent,4,cmdtext);
  178. dcmd(unrent,6,cmdtext);
  179. dcmd(house,5,cmdtext);
  180. dcmd(housestats,10,cmdtext);
  181. dcmd(getrent,7,cmdtext);
  182. dcmd(payrent,7,cmdtext);
  183. dcmd(ordercar,8,cmdtext);
  184. return 0;
  185. }
  186. AddHouse(houseid, Float:iconX, Float:iconY, Float:iconZ, Float:interiorX, Float:interiorY, Float:interiorZ, Costa, Sella, Interiora, virtualworld)
  187. {
  188. new house[256];
  189. format(house, sizeof(house), "Houses/houseid%d",houseid);
  190. if(!dini_Exists(house))
  191. {
  192. dini_Create(house);
  193. format(hInfo[houseid][Name], 24, "ForSale");
  194. dini_Set(house, "Name", "ForSale");
  195. format(hInfo[houseid][Renter], 24, "ForRent");
  196. dini_Set(house, "Renter", "ForRent");
  197. hInfo[houseid][Rentable] = 0;
  198. dini_IntSet(house, "Rentable", 0);
  199. hInfo[houseid][Rentcost] = 0;
  200. dini_IntSet(house, "Rentcost", 0);
  201. hInfo[houseid][Cost] = Costa;
  202. dini_IntSet(house, "Cost", Costa);
  203. hInfo[houseid][Sell] = Sella;
  204. dini_IntSet(house, "Sell", Sella);
  205. hInfo[houseid][Interior] = Interiora;
  206. dini_IntSet(house, "Interior", Interiora);
  207. dini_IntSet(house, "Virtualworld", virtualworld);
  208. hInfo[houseid][Virtualworld] = virtualworld;
  209. hInfo[houseid][Locked] = 1;
  210. dini_IntSet(house, "Locked", 1);
  211. hInfo[houseid][InteriorX] = interiorX;
  212. hInfo[houseid][InteriorY] = interiorY;
  213. hInfo[houseid][InteriorZ] = interiorZ;
  214. dini_FloatSet(house, "X", interiorX);
  215. dini_FloatSet(house, "Y", interiorY);
  216. dini_FloatSet(house, "Z", interiorZ);
  217. dini_IntSet(house, "RentPay", 0);
  218. dini_IntSet(house, "RentGet", 0);
  219. cInfo[houseid][HouseCar] = 429;
  220. dini_IntSet(house, "HouseCar", 0);
  221. cInfo[houseid][CarModel] = 429;
  222. dini_IntSet(house, "CarModel", 0);
  223. cInfo[houseid][CarX] = 0;
  224. cInfo[houseid][CarY] = 0;
  225. cInfo[houseid][CarZ] = 0;
  226. dini_FloatSet(house, "CarX", 0);
  227. dini_FloatSet(house, "CarY", 0);
  228. dini_FloatSet(house, "CarZ", 0);
  229. cInfo[houseid][CarColor1] = 0;
  230. cInfo[houseid][CarColor2] = 0;
  231. dini_IntSet(house, "CarColor1", 0);
  232. dini_IntSet(house, "CarColor2", 0);
  233. cInfo[houseid][GotCar] = 0;
  234. print("-");
  235. print("--------------House Created--------------");
  236. printf("- Houseid: %d", houseid);
  237. printf("- Buy Cost: %d", Costa);
  238. printf("- Sell Cost: %d", Sella);
  239. printf("- Interior: %d", Interiora);
  240. printf("- VirtualWorld: %d", virtualworld);
  241. print("-----------------------------------------");
  242. print("-");
  243. }
  244. else
  245. {
  246. format(hInfo[houseid][Name], 24, dini_Get(house, "Name"));
  247. format(hInfo[houseid][Renter], 24, dini_Get(house, "Renter"));
  248. hInfo[houseid][Rentable] = dini_Int(house, "Rentable");
  249. hInfo[houseid][Rentcost] = dini_Int(house, "Rentcost");
  250. hInfo[houseid][Cost] = dini_Int(house, "Cost");
  251. hInfo[houseid][Sell] = dini_Int(house, "Sell");
  252. hInfo[houseid][Interior] = dini_Int(house, "Interior");
  253. hInfo[houseid][Locked] = dini_Int(house, "Locked");
  254. hInfo[houseid][InteriorX] = dini_Float(house, "X");
  255. hInfo[houseid][InteriorY] = dini_Float(house, "Y");
  256. hInfo[houseid][InteriorZ] = dini_Float(house, "Z");
  257. hInfo[houseid][Virtualworld] = dini_Int(house, "Virtualworld");
  258. }
  259. hInfo[houseid][iconx]=iconX;
  260. hInfo[houseid][icony]=iconY;
  261. hInfo[houseid][iconz]=iconZ;
  262. format(house, sizeof(house), "Houses/houseid%d",houseid);
  263. if(strcmp(hInfo[playericonhouse[houseid]][Name],"ForSale",true)==0)
  264. {
  265. HousePickup[houseid] = CreatePickup(1273, 23, iconX, iconY, iconZ);//not bought
  266. }
  267. else
  268. {
  269. HousePickup[houseid] = CreatePickup(1272,23, iconX, iconY, iconZ);//bought
  270. }
  271. }
  272. AddHouseCar(houseid, modelid, Float:Carx, Float:Cary, Float:Carz, color1, color2, respawn_delay)
  273. {
  274. new house[256];
  275. format(house, sizeof(house), "Houses/houseid%d",houseid);
  276. if(dini_Exists(house))
  277. {
  278. cInfo[houseid][GotCar] = 1;
  279. if(dini_Int(house, "CarModel")==0)
  280. {
  281. dini_IntSet(house, "CarModel", modelid);
  282. cInfo[houseid][CarModel] = modelid;
  283. cInfo[houseid][CarX] = Carx;
  284. cInfo[houseid][CarY] = Cary;
  285. cInfo[houseid][CarZ] = Carz;
  286. dini_FloatSet(house, "CarX", Carx);
  287. dini_FloatSet(house, "CarY", Cary);
  288. dini_FloatSet(house, "CarZ", Carz);
  289. cInfo[houseid][CarColor1] = color1;
  290. cInfo[houseid][CarColor2] = color2;
  291. dini_IntSet(house, "CarColor1", color1);
  292. dini_IntSet(house, "CarColor2", color2);
  293. dini_IntSet(house, "Respawn_Delay", respawn_delay);
  294. cInfo[houseid][Respawn_Delay] = respawn_delay;
  295. cInfo[houseid][HouseCar] = CreateVehicle(cInfo[houseid][CarModel], Carx, Cary, Carz, 0.0, color1, color2, respawn_delay);
  296. print("-");
  297. print("--------------Car Created--------------");
  298. printf("- Car Houseid: %d", houseid);
  299. printf("- Modelid: %d", modelid);
  300. printf("- Color 1: %d", color1);
  301. printf("- Color 2: %d", color2);
  302. printf("- Respawn Delay: %d", respawn_delay);
  303. print("---------------------------------------");
  304. print("-");
  305. }
  306. else
  307. {
  308. cInfo[houseid][CarModel] = dini_Int(house, "CarModel");
  309. }
  310. cInfo[houseid][CarX] = dini_Int(house, "CarX");
  311. cInfo[houseid][CarY] = dini_Int(house, "CarY");
  312. cInfo[houseid][CarZ] = dini_Int(house, "CarZ");
  313. cInfo[houseid][CarColor1] = dini_Int(house, "CarColor1");
  314. cInfo[houseid][CarColor2] = dini_Int(house, "CarColor2");
  315. cInfo[houseid][Respawn_Delay] = dini_Int(house, "Respawn_Delay");
  316. cInfo[houseid][HouseCar] = CreateVehicle(cInfo[houseid][CarModel], Carx, Cary, Carz, 0.0, color1, color2, respawn_delay);
  317. }
  318. }
  319. stock SpawnPlayerAtHouse(playerid)
  320. {
  321. new str1[256],pname[24],str[256];
  322. GetPlayerName(playerid, pname, sizeof(pname));
  323. format(str1, sizeof(str1), "Houses/Users/%s", udb_encode(pname));
  324. if (dini_Exists(str1))
  325. {
  326. if(dini_Int(str1,"Houseid")!=-255)
  327. {
  328. new Float:x,Float:y,Float:z;
  329. str = dini_Get(str1,"SpawnInt");
  330. SetPlayerInterior(playerid, strval(str));
  331. playerinterior[playerid] = strval(str);
  332. x = dini_Float(str1,"SpawnX");
  333. y = dini_Float(str1,"SpawnY");
  334. z = dini_Float(str1,"SpawnZ");
  335. SetPlayerPos(playerid, x, y, z);
  336. }
  337. }
  338. return 1;
  339. }
  340. public OnPlayerSpawn(playerid) { SpawnPlayerAtHouse(playerid); }GetHouseStats(playerid, pickupid)
  341. {
  342. for(new i=0;i<MAX_HOUSES;i++)
  343. {
  344. if(pickupid==HousePickup[i])
  345. {
  346. if(HOUSE_STATS==0)
  347. {
  348. new str3[256];
  349. format(str3, sizeof(str3), "Owned by: %s", hInfo[i][Name]);
  350. SendClientMessage(playerid, c_y, str3);
  351. if(strcmp(hInfo[i][Renter],"ForRent",true))
  352. {
  353. format(str3, sizeof(str3), "Rented by: %s", hInfo[i][Renter]);
  354. SendClientMessage(playerid, c_y, str3);
  355. }
  356. format(str3,sizeof(str3),"Cost: %d",hInfo[i][Cost]);
  357. SendClientMessage(playerid, c_y, str3);
  358. }
  359. inhousepickup[playerid] = GetTickCount();
  360. playericonhouse[playerid] = i;
  361. }
  362. }
  363. }
  364. dcmd_sell(playerid,params[])
  365. {
  366. #pragma unused params
  367. new timestamp = GetTickCount();
  368. if(timestamp - inhousepickup[playerid] > 5000)
  369. {
  370. SendClientMessage(playerid, c_r, "You are not in a house icon!");
  371. return 1;
  372. }
  373. new str[255],str1[256],pname[24];
  374. GetPlayerName(playerid, pname, 24);
  375. format(str1, sizeof(str1), "Houses/houseid%d", playericonhouse[playerid]);
  376. if (strcmp(hInfo[playericonhouse[playerid]][Name],pname,false)) return SendClientMessage(playerid, c_r, "This house isn't yours!");
  377. SendClientMessage(playerid, c_y, "You have sold your house!");
  378. format(str, sizeof(str), "%s has sold houseid 0",pname);
  379. print(str);
  380. GivePlayerMoney(playerid, hInfo[playericonhouse[playerid]][Sell]);
  381. dini_Set(str1, "Name", "ForSale");
  382. hInfo[playericonhouse[playerid]][Locked] = dini_IntSet(str1,"Locked",1);
  383. format(hInfo[playericonhouse[playerid]][Name],255,"ForSale");
  384. format(str1, sizeof(str1), "Houses/Users/%s", udb_encode(pname));
  385. if (!dini_Exists(str1)) dini_Create(str1);
  386. dini_IntSet(str1, "Houseid", -255);
  387. DestroyPickup(HousePickup[playericonhouse[playerid]]);
  388. HousePickup[playericonhouse[playerid]] = CreatePickup(1273, 23, hInfo[playericonhouse[playerid]][iconx], hInfo[playericonhouse[playerid]][icony], hInfo[playericonhouse[playerid]][iconz]);
  389. RemovePlayerMapIcon(playerid, housemapicon[playerid]);
  390. return 1;
  391. }
  392. dcmd_buy(playerid,params[])
  393. {
  394. #pragma unused params
  395. new timestamp = GetTickCount();
  396. if(timestamp - inhousepickup[playerid] > 5000)
  397. {
  398. SendClientMessage(playerid, c_r, "You are not in a house icon!");
  399. return 1;
  400. }
  401. new str[255],str1[255],pname[24];
  402. GetPlayerName(playerid, pname, 24);
  403. format(str1, sizeof(str1), "Houses/Users/%s", udb_encode(pname));
  404. if(dini_Exists(str1))
  405. {
  406. if (dini_Int(str1, "Houseid")!=-255) return SendClientMessage(playerid, c_r, "You can only buy one house!");
  407. }
  408. format(str1, sizeof(str1), "Houses/houseid%d", playericonhouse[playerid]);
  409. if (strcmp(hInfo[playericonhouse[playerid]][Name],"ForSale",true)) return SendClientMessage(playerid, c_r, "This house isn't for sale!");
  410. if(GetPlayerMoney(playerid)<hInfo[playericonhouse[playerid]][Cost]) return SendClientMessage(playerid, c_r, "Not enough money!");
  411. SendClientMessage(playerid, c_y, "You have bought the house!");
  412. format(str, sizeof(str), "%s has bought houseid 0",pname);
  413. print(str);
  414. GivePlayerMoney(playerid, -hInfo[playericonhouse[playerid]][Cost]);
  415. dini_Set(str1, "Name", pname);
  416. hInfo[playericonhouse[playerid]][Name]=pname;
  417. hInfo[playericonhouse[playerid]][Locked] = dini_IntSet(str1,"Locked",0);
  418. format(str1, sizeof(str1), "Houses/Users/%s", udb_encode(pname));
  419. if (!dini_Exists(str1)) dini_Create(str1);
  420. new Float:sy, Float:sx, Float:sz;
  421. dini_IntSet(str1, "Houseid", playericonhouse[playerid]);
  422. if(!dini_Isset(str1,"Rentid"))
  423. {
  424. dini_IntSet(str1, "Rentid", -255);
  425. }
  426. GetPlayerPos(playerid, sx,sy,sz);
  427. dini_FloatSet(str1, "SpawnX", sx);
  428. dini_FloatSet(str1, "SpawnY", sy);
  429. dini_FloatSet(str1, "SpawnZ", sz);
  430. dini_IntSet(str1, "SpawnInt", GetPlayerInterior(playerid));
  431. DestroyPickup(HousePickup[playericonhouse[playerid]]);
  432. HousePickup[playericonhouse[playerid]] = CreatePickup(1272, 23, hInfo[playericonhouse[playerid]][iconx], hInfo[playericonhouse[playerid]][icony], hInfo[playericonhouse[playerid]][iconz]);
  433. return 1;
  434. }
  435. dcmd_lock(playerid,params[])
  436. {
  437. #pragma unused params
  438. new timestamp = GetTickCount();
  439. if(timestamp - inhousepickup[playerid] > 5000)
  440. {
  441. SendClientMessage(playerid, c_r, "You are not in a house icon!");
  442. return 1;
  443. }
  444. new str1[256],pname[24];
  445. GetPlayerName(playerid, pname, 24);
  446. format(str1, sizeof(str1), "Houses/houseid%d", playericonhouse[playerid]);
  447. if(strcmp(hInfo[playericonhouse[playerid]][Name],pname,true)==0)
  448. {
  449. SendClientMessage(playerid, c_y, "You have locked your house!");
  450. dini_IntSet(str1,"Locked",1);
  451. hInfo[playericonhouse[playerid]][Locked] = 1;
  452. }
  453. else if(strcmp(hInfo[playericonhouse[playerid]][Renter],pname,true)==0)
  454. {
  455. SendClientMessage(playerid, c_y, "You have locked your house!");
  456. dini_IntSet(str1,"Locked",1);
  457. hInfo[playericonhouse[playerid]][Locked] = 1;
  458. }
  459. else
  460. {
  461. SendClientMessage(playerid, c_r, "This house isn't yours!");
  462. }
  463. return 1;
  464. }
  465. dcmd_unlock(playerid,params[])
  466. {
  467. #pragma unused params
  468. new timestamp = GetTickCount();
  469. if(timestamp - inhousepickup[playerid] > 5000) { SendClientMessage(playerid, c_r, "You are not in a house icon!");return 1;}
  470. new str1[256],pname[24];
  471. GetPlayerName(playerid, pname, 24);
  472. format(str1, sizeof(str1), "Houses/houseid%d", playericonhouse[playerid]);
  473. if(strcmp(hInfo[playericonhouse[playerid]][Name],pname,true)==0){SendClientMessage(playerid, c_y, "You have unlocked your house!");dini_IntSet(str1,"Locked",0);hInfo[playericonhouse[playerid]][Locked] = 0;}
  474. else if(strcmp(hInfo[playericonhouse[playerid]][Renter],pname,true)==0){SendClientMessage(playerid, c_y, "You have unlocked your house!");dini_IntSet(str1,"Locked",0);hInfo[playericonhouse[playerid]][Locked] = 0;}
  475. else{SendClientMessage(playerid, c_r, "This house isn't yours!");}
  476. return 1;
  477. }
  478. dcmd_enter(playerid,params[])
  479. {
  480. #pragma unused params
  481. new timestamp = GetTickCount();
  482. if(timestamp - inhousepickup[playerid] > 5000) {SendClientMessage(playerid, c_r, "You are not in a house icon!");return 1;}
  483. new str1[255],pname[24];
  484. GetPlayerPos(playerid, housex, housey, housez);
  485. format(str1, sizeof(str1), "Houses/houseid%d", playericonhouse[playerid]);
  486. GetPlayerName(playerid, pname, 24);
  487. if(hInfo[playericonhouse[playerid]][Locked]==1) return SendClientMessage(playerid, c_r, "This house is locked!");
  488. playerworld[playerid] = GetPlayerVirtualWorld(playerid);
  489. SendClientMessage(playerid, c_y, "You entered the house!");
  490. SetPlayerVirtualWorld(playerid, hInfo[playericonhouse[playerid]][Virtualworld]);
  491. SetPlayerInterior(playerid, hInfo[playericonhouse[playerid]][Interior]);
  492. SetPlayerPos(playerid, hInfo[playericonhouse[playerid]][InteriorX], hInfo[playericonhouse[playerid]][InteriorY], hInfo[playericonhouse[playerid]][InteriorZ]);
  493. playerinterior[playerid] = hInfo[playericonhouse[playerid]][Interior];
  494. return 1;
  495. }
  496. dcmd_exit(playerid,params[])
  497. {
  498. #pragma unused params
  499. if(GetPlayerInterior(playerid)==playerinterior[playerid]){SetPlayerPos(playerid, housex, housey, housez);SetPlayerVirtualWorld(playerid, 0);SetPlayerInterior(playerid, playerworld[playerid]);SetPlayerVirtualWorld(playerid, 0);}
  500. else{SendClientMessage(playerid, c_r, "You have not entered a house!");}
  501. return 1;
  502. }
  503. dcmd_home(playerid,params[])
  504. {
  505. #pragma unused params
  506. new str1[256],pname[24];
  507. GetPlayerName(playerid, pname, 24);
  508. format(str1, sizeof(str1), "Houses/Users/%s", udb_encode(pname));
  509. if(!dini_Exists(str1)) return SendClientMessage(playerid, c_r, "You don't own a house!");
  510. if(dini_Int(str1, "Houseid")!=-255)
  511. {
  512. housemapicon[playerid] = SetPlayerMapIcon(playerid,31,hInfo[dini_Int(str1, "Houseid")][iconx], hInfo[dini_Int(str1, "Houseid")][icony], hInfo[dini_Int(str1, "Houseid")][iconz],31,c_y);
  513. }
  514. else if (dini_Int(str1, "Rentid")!=-255)
  515. {
  516. housemapicon[playerid] = SetPlayerMapIcon(playerid,31,hInfo[dini_Int(str1, "Rentid")][iconx], hInfo[dini_Int(str1, "Rentid")][icony], hInfo[dini_Int(str1, "Rentid")][iconz],31,c_y);
  517. }
  518. else
  519. {
  520. SendClientMessage(playerid, c_r, "You don't own a house!");
  521. }
  522. return 1;
  523. }
  524. dcmd_setrent(playerid,params[])
  525. {
  526. new timestamp = GetTickCount();
  527. if(timestamp - inhousepickup[playerid] > 5000){SendClientMessage(playerid, c_r, "You are not in a house icon!");return 1;}
  528. new str[256],str1[256],pname[24];
  529. GetPlayerName(playerid, pname, 24);
  530. format(str1, sizeof(str1), "Houses/houseid%d", playericonhouse[playerid]);
  531. str = dini_Get(str1,"Name");
  532. if (strcmp(str,pname,true)) return SendClientMessage(playerid, c_r, "This house isn't yours!");
  533. new rentcost, rentable;
  534. if (sscanf(params, "dd", rentable, rentcost)) return SendClientMessage(playerid, c_r, "USAGE: /setrent [0/1] [Rentcost]");
  535. else if (rentcost<MIN_RENTCOST){format(str, sizeof(str), "The minimum rentcost is $%d.", MIN_RENTCOST);SendClientMessage(playerid, c_r, str);return 1;}
  536. else if (rentcost>MAX_RENTCOST){format(str, sizeof(str), "The maximum rentcost is $%d.", MAX_RENTCOST);SendClientMessage(playerid, c_r, str);return 1;}
  537. else if(rentable==1){SendClientMessage(playerid, c_y, "Your house is now rentable!");hInfo[playericonhouse[playerid]][Rentable] = 1;dini_IntSet(str1, "Rentable", 1);hInfo[playericonhouse[playerid]][Rentcost] = rentcost;dini_IntSet(str1, "Rentcost", rentcost);return 1;}
  538. else if(rentable==0){SendClientMessage(playerid, c_y, "Your house is now not rentable!");hInfo[playericonhouse[playerid]][Rentable] = 0;dini_IntSet(str1, "Rentable", 0);hInfo[playericonhouse[playerid]][Rentcost] = rentcost;dini_IntSet(str1, "Rentcost", rentcost);return 1;}
  539. return 1;
  540. }
  541. dcmd_rent(playerid,params[])
  542. {
  543. #pragma unused params
  544. new timestamp = GetTickCount();
  545. if(timestamp - inhousepickup[playerid] > 5000){SendClientMessage(playerid, c_r, "You are not in a house icon!");return 1;}
  546. new str[255],str1[256],str5[255],pname[24];
  547. GetPlayerName(playerid, pname, 24);
  548. format(str1, sizeof(str1), "Houses/houseid%d", playericonhouse[playerid]);
  549. format(str5, sizeof(str5), "Houses/Users/%s", udb_encode(pname));
  550. if(dini_Isset(str5, "Rentid")){if (dini_Int(str5, "Rentid")!=-255) return SendClientMessage(playerid, c_r, "You can only rent one house at a time!");}
  551. format(str, sizeof(str), dini_Get(str1,"Name"));
  552. if (strcmp(str,"ForSale",true)==0) return SendClientMessage(playerid, c_r, "This house has no owner!");
  553. if(hInfo[playericonhouse[playerid]][Rentable]==0 || strcmp(hInfo[playericonhouse[playerid]][Renter], "ForRent", true)==0) return SendClientMessage(playerid, c_r, "This house is not rentable!");
  554. if(GetPlayerMoney(playerid)<hInfo[playericonhouse[playerid]][Rentcost]) return SendClientMessage(playerid, c_r, "Not enough money!");
  555. dini_Set(str1, "Renter", udb_encode(pname));
  556. format(hInfo[playericonhouse[playerid]][Renter], 24, udb_encode(pname));
  557. dini_IntSet(str5, "Rentid", playericonhouse[playerid]);
  558. format(str1, sizeof(str1), "You have rented this house, it will cost you $%d an hour!", hInfo[playericonhouse[playerid]][Rentcost]);
  559. SendClientMessage(playerid, c_y, str1);
  560. return 1;
  561. }
  562. dcmd_unrent(playerid,params[])
  563. {
  564. #pragma unused params
  565. new timestamp = GetTickCount();
  566. if(timestamp - inhousepickup[playerid] > 5000){SendClientMessage(playerid, c_r, "You are not in a house icon!");return 1;}
  567. new str1[256],pname[24];
  568. GetPlayerName(playerid, pname, 24);
  569. format(str1, sizeof(str1), "Houses/houseid%d", playericonhouse[playerid]);
  570. if(strcmp(hInfo[playericonhouse[playerid]][Renter], pname, true)) return SendClientMessage(playerid, c_r, "You aren't renting this house!");
  571. dini_Set(str1, "Renter", "ForRent");
  572. format(hInfo[playericonhouse[playerid]][Renter], 24, "ForRent");
  573. format(str1, sizeof(str1), "Houses/Users/%s", udb_encode(pname));
  574. dini_IntSet(str1, "Rentid", -255);
  575. SendClientMessage(playerid, c_y, "You have unrented this house!");
  576. return 1;
  577. }
  578. dcmd_house(playerid,params[])
  579. {
  580. #pragma unused params
  581. SendClientMessage(playerid, c_y, "-------------");
  582. SendClientMessage(playerid, c_y, "House options");
  583. SendClientMessage(playerid, c_y, "-------------");
  584. SendClientMessage(playerid, c_y, "/setrent [0/1] [Cost] - House owner");
  585. SendClientMessage(playerid, c_y, "/ordercar [CarName] - House owner");
  586. SendClientMessage(playerid, c_y, "/getrent - House owner");
  587. SendClientMessage(playerid, c_y, "/lock - Renter/Owner");
  588. SendClientMessage(playerid, c_y, "/unlock - Renter/Owner");
  589. SendClientMessage(playerid, c_y, "/payrent - Renter");
  590. SendClientMessage(playerid, c_y, "/unrent - Renter");
  591. SendClientMessage(playerid, c_y, "/rent - Guest");
  592. SendClientMessage(playerid, c_y, "-------------");
  593. return 1;
  594. }
  595. dcmd_housestats(playerid,params[])
  596. {
  597. #pragma unused params
  598. new timestamp = GetTickCount();
  599. if(timestamp - inhousepickup[playerid] > 5000){SendClientMessage(playerid, c_r, "You are not in a house icon!");return 1;}
  600. new str[256];
  601. format(str, sizeof(str), "Owner: %s", hInfo[playericonhouse[playerid]][Name]);
  602. SendClientMessage(playerid, c_y, str);
  603. format(str, sizeof(str), "Cost: $%d", hInfo[playericonhouse[playerid]][Cost]);
  604. SendClientMessage(playerid, c_y, str);
  605. format(str, sizeof(str), "Renter: %s", hInfo[playericonhouse[playerid]][Renter]);
  606. SendClientMessage(playerid, c_y, str);
  607. format(str, sizeof(str), "Rentcost: $%d / hour", hInfo[playericonhouse[playerid]][Rentcost]);
  608. SendClientMessage(playerid, c_y, str);
  609. return 1;
  610. }
  611. dcmd_getrent(playerid,params[])
  612. {
  613. #pragma unused params
  614. new timestamp = GetTickCount();
  615. if(timestamp - inhousepickup[playerid] > 5000){SendClientMessage(playerid, c_r, "You are not in a house icon!");return 1;}
  616. new pname[24];
  617. GetPlayerName(playerid, pname, 24);
  618. if(strcmp(hInfo[playericonhouse[playerid]][Name],pname,true)==0){new str[255];SendClientMessage(playerid, c_y, "You collected the money of the renter!");format(str, sizeof(str), "Houses/houseid%d", playericonhouse[playerid]);GivePlayerMoney(playerid, dini_Int(str, "RentGet"));dini_IntSet(str, "RentGet", 0);}
  619. else{SendClientMessage(playerid, c_r, "This house isn't yours!");}
  620. return 1;
  621. }
  622. dcmd_payrent(playerid,params[])
  623. {
  624. #pragma unused params
  625. new timestamp = GetTickCount();
  626. if(timestamp - inhousepickup[playerid] > 5000){SendClientMessage(playerid, c_r, "You are not in a house icon!");return 1;}
  627. new pname[24];
  628. GetPlayerName(playerid, pname, 24);
  629. if(strcmp(hInfo[playericonhouse[playerid]][Renter],pname,true)==0)
  630. {
  631. new str[255];
  632. format(str, sizeof(str), "Houses/houseid%d", playericonhouse[playerid]);
  633. if(GetPlayerMoney(playerid)<dini_Int(str, "RentPay")) return SendClientMessage(playerid, c_r, "You don't have enough money to pay the house owner!");
  634. SendClientMessage(playerid, c_y, "You have payed the money to the owner!");
  635. GivePlayerMoney(playerid, -dini_Int(str, "RentPay"));
  636. dini_IntSet(str, "RentPay", 0);
  637. }
  638. else{SendClientMessage(playerid, c_r, "You aren't renting this house!");}
  639. return 1;
  640. }
  641. dcmd_ordercar(playerid,params[])
  642. {
  643. #pragma unused params
  644. new timestamp = GetTickCount();
  645. if(timestamp - inhousepickup[playerid] > 5000)
  646. {
  647. SendClientMessage(playerid, c_r, "You are not in a house icon!");
  648. return 1;
  649. }
  650. new pname[24];
  651. GetPlayerName(playerid, pname, 24);
  652. if(cInfo[playericonhouse[playerid]][GotCar]==0) return SendClientMessage(playerid, c_r, "This house can't order a car!");
  653. if(strcmp(hInfo[playericonhouse[playerid]][Name],pname,true)==0)
  654. {
  655. new carname[40];
  656. if (sscanf(params, "s", carname))
  657. {
  658. SendClientMessage(playerid, c_r, "USAGE: /ordercar [CarName]");
  659. }
  660. else
  661. {
  662. new str[256], abc;
  663. for(new i=0;i<MAX_BUY_CARS;i++)
  664. {
  665. if(strcmp(carname,Buyable_Cars[i][CarName],true)==0)
  666. {
  667. if(GetPlayerMoney(playerid)<Buyable_Cars[i][CarCost]) return SendClientMessage(playerid, c_r, "Not enough money!");
  668. GivePlayerMoney(playerid, -Buyable_Cars[i][CarCost]);
  669. cInfo[playericonhouse[playerid]][CarModel] = Buyable_Cars[i][CarModel];
  670. format(str, sizeof(str), "Houses/houseid%d", playericonhouse[playerid]);
  671. dini_IntSet(str, "CarModel", Buyable_Cars[i][CarModel]);
  672. format(str, sizeof(str), "You have ordered the %s for $%d!", carname, Buyable_Cars[i][CarCost]);
  673. SendClientMessage(playerid, c_y, str);
  674. SendClientMessage(playerid, c_y, "It will take some time when your car will be delivered.");
  675. cInfo[playericonhouse[playerid]][NewCar] = 1;
  676. abc = 1;
  677. }
  678. }
  679. if(abc==0)
  680. {
  681. SendClientMessage(playerid, c_r, "Wrong vehicle name!");
  682. abc=0;
  683. }
  684. }
  685. }
  686. else
  687. {
  688. SendClientMessage(playerid, c_r, "This house isn't yours!");
  689. }
  690. return 1;
  691. }
  692. public newcar()
  693. {
  694. for(new carid=0;carid<MAX_HOUSES;carid++)
  695. {
  696. if(cInfo[carid][NewCar]==1)
  697. {
  698. cInfo[carid][NewCar]=0;
  699. KillVehicle(cInfo[carid][HouseCar]);
  700. cInfo[carid][HouseCar] = CreateVehicle(cInfo[carid][CarModel], cInfo[carid][CarX], cInfo[carid][CarY], cInfo[carid][CarZ], 0.0, cInfo[carid][CarColor1], cInfo[carid][CarColor2], cInfo[carid][Respawn_Delay]);
  701. }
  702. }
  703. }
  704. public KillVehicle(carid)
  705. {
  706. for (new i=0;i<MAX_PLAYERS;i++)
  707. {
  708. if(IsPlayerInVehicle(i, carid))
  709. {
  710. RemovePlayerFromVehicle(i);
  711. KillVeh[carid] = true;
  712. SetVehicleToRespawn(carid);
  713. SendClientMessage(i, c_r, "System: Your car has been destroyed.");
  714. SendClientMessage(i, c_r, "Reason: House system.");
  715. }
  716. else
  717. {
  718. KillVeh[carid] = true;
  719. SetVehicleToRespawn(carid);
  720. }
  721. }
  722. }
  723. public OnVehicleSpawn(vehicleid)
  724. {
  725. for(new i=0;i<MAX_HOUSES;i++)
  726. {
  727. if(KillVeh[cInfo[i][HouseCar]]==true)
  728. {
  729. KillVeh[cInfo[i][HouseCar]] = false;
  730. DestroyVehicle(cInfo[i][HouseCar]);
  731. }
  732. }
  733. }
  734. public rentfee()
  735. {
  736. new str[255],str2[255],pname[24];
  737. for(new houseid=0;houseid<MAX_HOUSES;houseid++)
  738. {
  739. print("f");
  740. format(str, sizeof(str), "Houses/houseid%d", houseid);
  741. if(strcmp(hInfo[houseid][Renter], "ForRent", true))
  742. {
  743. for(new ii=0;ii<MAX_PLAYERS;ii++)
  744. {
  745. if(IsPlayerConnected(ii))
  746. {
  747. GetPlayerName(ii, pname, 24);
  748. if(strcmp(hInfo[houseid][Renter], pname, true)==0)
  749. {
  750. format(str2, sizeof(str2), "You have to pay $%d for the hour you have rented the hous!", hInfo[houseid][Rentcost]);
  751. SendClientMessage(ii, c_y, str2);
  752. dini_IntSet(str, "RentGet", dini_Int(str, "RentGet")+hInfo[houseid][Rentcost]);
  753. dini_IntSet(str, "RentPay", dini_Int(str, "RentPay")+hInfo[houseid][Rentcost]);
  754. hInfo[houseid][Rentfee]=1;
  755. }
  756. }
  757. }
  758. if(hInfo[houseid][Rentfee]==0)
  759. {
  760. if(strcmp(hInfo[houseid][Renter],"ForRent"))
  761. {
  762. dini_IntSet(str, "RentGet", dini_Int(str, "RentGet")+hInfo[houseid][Rentcost]);
  763. dini_IntSet(str, "RentPay", dini_Int(str, "RentPay")+hInfo[houseid][Rentcost]);
  764. }
  765. }
  766. hInfo[houseid][Rentfee]=0;
  767. }
  768. }
  769. }
  770. public OnPlayerPickUpPickup(playerid, pickupid)
  771. {
  772. GetHouseStats(playerid, pickupid);
  773. return 0;
  774. }
  775. stock sscanf(string[], format[], {Float,_}:...)
  776. {
  777. new
  778. formatPos = 0,
  779. stringPos = 0,
  780. paramPos = 2,
  781. paramCount = numargs();
  782. while (paramPos < paramCount && string[stringPos])
  783. {
  784. switch (format[formatPos++])
  785. {
  786. case '\0':
  787. {
  788. return 0;
  789. }
  790. case 'i', 'd':
  791. {
  792. new
  793. neg = 1,
  794. num = 0,
  795. ch = string[stringPos];
  796. if (ch == '-')
  797. {
  798. neg = -1;
  799. ch = string[++stringPos];
  800. }
  801. do
  802. {
  803. stringPos++;
  804. if (ch >= '0' && ch <= '9')
  805. {
  806. num = (num * 10) + (ch - '0');
  807. }
  808. else
  809. {
  810. return 1;
  811. }
  812. }
  813. while ((ch = string[stringPos]) && ch != ' ');
  814. setarg(paramPos, 0, num * neg);
  815. }
  816. case 'h', 'x':
  817. {
  818. new
  819. ch,
  820. num = 0;
  821. while ((ch = string[stringPos++]))
  822. {
  823. switch (ch)
  824. {
  825. case 'x', 'X':
  826. {
  827. num = 0;
  828. continue;
  829. }
  830. case '0' .. '9':
  831. {
  832. num = (num << 4) | (ch - '0');
  833. }
  834. case 'a' .. 'f':
  835. {
  836. num = (num << 4) | (ch - ('a' - 10));
  837. }
  838. case 'A' .. 'F':
  839. {
  840. num = (num << 4) | (ch - ('A' - 10));
  841. }
  842. case ' ':
  843. {
  844. break;
  845. }
  846. default:
  847. {
  848. return 1;
  849. }
  850. }
  851. }
  852. setarg(paramPos, 0, num);
  853. }
  854. case 'c':
  855. {
  856. setarg(paramPos, 0, string[stringPos++]);
  857. }
  858. case 'f':
  859. {
  860. new tmp[25];
  861. strmid(tmp, string, stringPos, stringPos+sizeof(tmp)-2);
  862. setarg(paramPos, 0, _:floatstr(tmp));
  863. }
  864. case 's', 'z':
  865. {
  866. new
  867. i = 0,
  868. ch;
  869. if (format[formatPos])
  870. {
  871. while ((ch = string[stringPos++]) && ch != ' ')
  872. {
  873. setarg(paramPos, i++, ch);
  874. }
  875. if (!i) return 1;
  876. }
  877. else
  878. {
  879. while ((ch = string[stringPos++]))
  880. {
  881. setarg(paramPos, i++, ch);
  882. }
  883. }
  884. stringPos--;
  885. setarg(paramPos, i, '\0');
  886. }
  887. default:
  888. {
  889. continue;
  890. }
  891. }
  892. while (string[stringPos] && string[stringPos] != ' ')
  893. {
  894. stringPos++;
  895. }
  896. while (string[stringPos] == ' ')
  897. {
  898. stringPos++;
  899. }
  900. paramPos++;
  901. }
  902. while (format[formatPos] == 'z') formatPos++;
  903. return format[formatPos];
  904. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement