Guest User

Untitled

a guest
Nov 15th, 2011
174
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 19.51 KB | None | 0 0
  1. /*
  2. Developer: Christian
  3. This script is created to teach users
  4. the programming language used in
  5. sa-mp, "pawn". This script can be
  6. copied, used, modified or whatever
  7. they want, i don't care. i only want
  8. you to leave the credits as they are.
  9. */
  10.  
  11. #include <a_samp>
  12. #include <dini>
  13. #include <zcmd>
  14. #include <sscanf2>
  15.  
  16. #define COLOR_GREY 0xAFAFAFAA
  17. #define COLOR_GREEN 0x33AA33AA
  18. #define COLOR_RED 0xAA3333AA
  19. #define COLOR_YELLOW 0xFFFF00AA
  20. #define COLOR_WHITE 0xFFFFFFAA
  21. #define COLOR_BLUE 0x0000BBAA
  22. #define COLOR_LIGHTBLUE 0x33CCFFAA
  23. #define COLOR_ORANGE 0xFF9900AA
  24. #define COLOR_RED 0xAA3333AA
  25. #define COLOR_LIME 0x10F441AA
  26. #define COLOR_MAGENTA 0xFF00FFFF
  27. #define COLOR_NAVY 0x000080AA
  28. #define COLOR_AQUA 0xF0F8FFAA
  29. #define COLOR_CRIMSON 0xDC143CAA
  30. #define COLOR_FLBLUE 0x6495EDAA
  31. #define COLOR_BISQUE 0xFFE4C4AA
  32. #define COLOR_BLACK 0x000000AA
  33. #define COLOR_CHARTREUSE 0x7FFF00AA
  34. #define COLOR_BROWN 0XA52A2AAA
  35. #define COLOR_CORAL 0xFF7F50AA
  36. #define COLOR_GOLD 0xB8860BAA
  37. #define COLOR_GREENYELLOW 0xADFF2FAA
  38. #define COLOR_INDIGO 0x4B00B0AA
  39. #define COLOR_IVORY 0xFFFF82AA
  40. #define COLOR_LAWNGREEN 0x7CFC00AA
  41. #define COLOR_LIMEGREEN 0x32CD32AA //<--- Dark lime
  42. #define COLOR_MIDNIGHTBLUE 0X191970AA
  43. #define COLOR_MAROON 0x800000AA
  44. #define COLOR_OLIVE 0x808000AA
  45. #define COLOR_ORANGERED 0xFF4500AA
  46. #define COLOR_PINK 0xFFC0CBAA // - Light light pink
  47. #define COLOR_SEAGREEN 0x2E8B57AA
  48. #define COLOR_SPRINGGREEN 0x00FF7FAA
  49. #define COLOR_TOMATO 0xFF6347AA // - Tomato >:/ sounds wrong lol... well... :P
  50. #define COLOR_YELLOWGREEN 0x9ACD32AA //- like military green
  51. #define COLOR_MEDIUMAQUA 0x83BFBFAA
  52. #define COLOR_MEDIUMMAGENTA 0x8B008BAA // dark magenta ^^
  53.  
  54. #define COLOR_GREY 0xAFAFAFAA
  55. #define COLOR_GREEN 0x33AA33AA
  56. #define COLOR_BRIGHTRED 0xFF0000AA
  57. #define COLOR_DARKRED 0xC60000FF
  58. #define COLOR_YELLOW 0xFFFF00AA
  59. #define COLOR_TAN 0xBDB76BAA
  60. #define COLOR_PURPLE 0x800080AA
  61. #define COLOR_WHITE 0xFFFFFFAA
  62. #define COLOR_LIGHTBLUE 0x33CCFFAA
  63. #define COLOR_ORANGE 0xFF9900AA
  64. #define COLOR_INDIGO 0x4B00B0AA
  65. #define COLOR_SYSTEM 0xa9c4e4
  66. #define COLOR_SANTORANGE 0xFF6C3BAA
  67. #define COLOR_INVIS 0xAFAFAF00
  68. #define COLOR_CRIMBLUE 0x3A47DEFF
  69. #define COLOR_WANTED 0xCC0066AA
  70. #define COLOR_GROVE 0x378729FF
  71. #define COLOR_BALLAS 0xA31D88FF
  72. #define COLOR_DARKGREY 0x696969FF
  73. #define COLOR_ERPSS 0x549852FF
  74. #define COLOR_L1A 0x50A2ABFF
  75. #define COLOR_FADE1 0xE6E6E6E6
  76. #define COLOR_FADE2 0xC8C8C8C8
  77. #define COLOR_FADE3 0xAAAAAAAA
  78. #define COLOR_FADE4 0x8C8C8C8C
  79. #define COLOR_FADE5 0x6E6E6E6E
  80. #define BLACK 0x000000FF
  81.  
  82. #define DEVELOPER "Max_Exodus"
  83. #define VERSION "GrRp v1.0b"
  84. #define MAX_HOUSES 100//Lets define that we can have the max limit of our houses to 100.
  85. enum HouseInfo
  86. {
  87. Owner[24],
  88. Owned,
  89. Float:XPros,
  90. Float:YPros,
  91. Float:ZPros,
  92. VirtualWorld,
  93. Text3D:HouseLabel,
  94. }
  95. new HInfo[MAX_HOUSES][HouseInfo];
  96. new HouseInformation[MAX_HOUSES][hinfo], houseid;
  97. new InHouse[MAX_PLAYERS], InHouseCP[MAX_PLAYERS];
  98. #undef MAX_PLAYERS
  99. #define MAX_PLAYERS 50
  100. new Score[MAX_PLAYERS];
  101. forward SetScore();
  102.  
  103. #if defined FILTERSCRIPT
  104.  
  105. public OnFilterScriptInit()
  106.  
  107. {
  108. database = db_open(databasename);
  109. db_query(database, "CREATE TABLE IF NOT EXISTS `HOUSEINFO` (housename varchar(51), houseowner varchar(25))");
  110. return 1;
  111. }
  112. {
  113. print("\n--------------------------------------");
  114. print(" GrRp v1.0b by Max_Exodus");
  115. print("--------------------------------------\n");
  116. return 1;
  117. }
  118. {
  119. database = db_open(databasename);
  120. db_query(database, "CREATE TABLE IF NOT EXISTS `HOUSEINFO` (housename varchar(51), houseowner varchar(25))");
  121. CreateHouse("TestHouse1", 1, 2317.130615, 692.398498, 11.460937, 266.857757, 305.001586, 999.148437, 2, 1);
  122. CreateHouse("TestHouse2", 1, 2346.872802, 692.999267, 11.460937, 266.857757, 305.001586, 999.148437, 2, 1);
  123. CreateHouse("TestHouse3", 1, 2396.482666, 691.487060, 11.453125, 2196.850341, -1204.343261, 1049.023437, 6, 1);
  124. CreateHouse("TestHouse4", 1, 2398.476074, 735.344665, 11.460937, 2196.850341, -1204.343261, 1049.023437, 6, 1);
  125. CreateHouse("TestHouse5", 1, 2368.863525, 733.627502, 11.460937, 2196.850341, -1204.343261, 1049.023437, 6, 1);
  126. CreateHouse("TestHouse6", 1, 2013.253906, 731.041870, 11.453125, 266.857757, 305.001586, 999.148437, 5, 1);
  127. CreateHouse("TestHouse7", 1, 2449.826660, 742.588806, 11.460937, 266.857757, 305.001586, 999.148437, 5, 1);
  128. CreateHouse("TestHouse8", 1, 2449.662353, 714.210693, 11.468292, 266.857757, 305.001586, 999.148437, 5, 1);
  129. return 1;
  130. }
  131.  
  132. public OnFilterScriptExit()
  133. {
  134. return 1;
  135. }
  136.  
  137. #else
  138.  
  139. main()
  140. {
  141. print("Global Roleplay");
  142. printf("Version: %s", VERSION);
  143. printf("Developer: %s", DEVELOPER);
  144. }
  145.  
  146. #endif
  147.  
  148. public SetScore()
  149. {
  150. for(new i=0;i<MAX_PLAYERS;i++)
  151. {
  152. Score[i]=GetPlayerMoney(i);
  153. SetPlayerScore(i, Score[i]);
  154. }
  155. return 1;
  156. }
  157.  
  158. public OnGameModeInit()
  159. {
  160. // Don't use these lines if it's a filterscript
  161. SetGameModeText("GrRp v1.0b");
  162. AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
  163. return 1;
  164. }
  165.  
  166. public OnGameModeExit()
  167. {
  168. return 1;
  169. }
  170.  
  171. public OnPlayerRequestClass(playerid, classid)
  172. {
  173. SetPlayerPos(playerid, 1764.6366,-1868.6194,29.5782); // Hidden Player
  174. SetPlayerCameraPos(playerid, 1715.7161,-1856.6466,22.9240); // Camera Pos
  175. SetPlayerCameraLookAt(playerid, 1720.8245,-1866.0764,13.5719); // Camera Look At
  176. return 1;
  177. }
  178.  
  179. forward OnPlayerRegister(playerid, step);
  180. public OnPlayerRegister(playerid, step)
  181. {
  182. if(step == 1)
  183. {
  184. SetPlayerPos(playerid, 1764.6366,-1868.6194,29.5782); // Hidden Player
  185. SetPlayerCameraPos(playerid, 1715.7161,-1856.6466,22.9240); // Camera Pos
  186. SetPlayerCameraLookAt(playerid, 1720.8245,-1866.0764,13.5719); // Camera Look At
  187. SendClientMessage(playerid, COLOR_WHITE, "==============================================================================");
  188. SendClientMessage(playerid, COLOR_WHITE, "Global Roleplay/Beta V 1.0.a");
  189. SendClientMessage(playerid, COLOR_GREY, "Welcome to Global Roleplay! We are proud to have you here.");
  190. SendClientMessage(playerid, COLOR_GREY, "This is the tutorial, in which you will create your account. Currently being addedin");
  191. SendClientMessage(playerid, COLOR_GREY, "Please wait while we load and save the required files.");
  192. SendClientMessage(playerid, COLOR_WHITE, "This Script Is Still Being Edited , Created By Max_Exodus.");
  193. SendClientMessage(playerid, COLOR_WHITE, "==============================================================================");
  194. }
  195. return 1;
  196. }
  197.  
  198. public OnPlayerConnect(playerid)
  199. {
  200. new pname[128];
  201. GetPlayerName(playerid, pname, sizeof(pname));
  202. new file[128];
  203. format(file, sizeof(file), "Users/%s.ini", pname);
  204. if(!dini_Exists(file))
  205. {
  206. dini_Create(file);
  207. OnPlayerRegister(playerid, 1);
  208. }
  209. if(dini_Int(file, "Registered") == 0)
  210. {
  211. OnPlayerRegister(playerid, 1);
  212. }
  213. return 1;
  214. }
  215. {
  216. InHouse[playerid] = -1;
  217. InHouseCP[playerid] = -1;
  218. return 1;
  219. }
  220.  
  221. public OnPlayerDisconnect(playerid, reason)
  222. {
  223. return 1;
  224. }
  225.  
  226. public OnPlayerSpawn(playerid)
  227. {
  228. return 1;
  229. }
  230. public OnPlayerDeath(playerid, killerid, reason)
  231. {
  232. return 1;
  233. }
  234.  
  235. public OnVehicleSpawn(vehicleid)
  236. {
  237. return 1;
  238. }
  239.  
  240. public OnVehicleDeath(vehicleid, killerid)
  241. {
  242. return 1;
  243. }
  244. public OnPlayerText(playerid, text[])
  245. {
  246. return 1;
  247. }
  248.  
  249. public OnPlayerCommandText(playerid, cmdtext[])
  250. {
  251. if (strcmp("/mycommand", cmdtext, true, 10) == 0)
  252. {
  253. // Do something here
  254. return 1;
  255. }
  256. return 0;
  257. }
  258.  
  259. public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
  260. {
  261. return 1;
  262. }
  263.  
  264. public OnPlayerExitVehicle(playerid, vehicleid)
  265. {
  266. return 1;
  267. }
  268.  
  269. public OnPlayerStateChange(playerid, newstate, oldstate)
  270. {
  271. return 1;
  272. }
  273.  
  274. public OnPlayerEnterCheckpoint(playerid)
  275. {
  276. return 1;
  277. }
  278.  
  279. public OnPlayerLeaveCheckpoint(playerid)
  280. {
  281. return 1;
  282. }
  283.  
  284. public OnPlayerEnterRaceCheckpoint(playerid)
  285. {
  286. return 1;
  287. }
  288.  
  289. public OnPlayerLeaveRaceCheckpoint(playerid)
  290. {
  291. return 1;
  292. }
  293.  
  294. public OnRconCommand(cmd[])
  295. {
  296. return 1;
  297. }
  298.  
  299. public OnPlayerRequestSpawn(playerid)
  300. {
  301. return 1;
  302. }
  303.  
  304. public OnObjectMoved(objectid)
  305. {
  306. return 1;
  307. }
  308.  
  309. public OnPlayerObjectMoved(playerid, objectid)
  310. {
  311. return 1;
  312. }
  313.  
  314. public OnPlayerPickUpPickup(playerid, pickupid)
  315. {
  316. return 1;
  317. }
  318.  
  319. public OnVehicleMod(playerid, vehicleid, componentid)
  320. {
  321. return 1;
  322. }
  323.  
  324. public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
  325. {
  326. return 1;
  327. }
  328.  
  329. public OnVehicleRespray(playerid, vehicleid, color1, color2)
  330. {
  331. return 1;
  332. }
  333.  
  334. public OnPlayerSelectedMenuRow(playerid, row)
  335. {
  336. return 1;
  337. }
  338.  
  339. public OnPlayerExitedMenu(playerid)
  340. {
  341. return 1;
  342. }
  343.  
  344. public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
  345. {
  346. return 1;
  347. }
  348.  
  349. public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
  350. {
  351. return 1;
  352. }
  353.  
  354. public OnRconLoginAttempt(ip[], password[], success)
  355. {
  356. return 1;
  357. }
  358.  
  359. public OnPlayerUpdate(playerid)
  360. {
  361. return 1;
  362. }
  363.  
  364. public OnPlayerStreamIn(playerid, forplayerid)
  365. {
  366. return 1;
  367. }
  368.  
  369. public OnPlayerStreamOut(playerid, forplayerid)
  370. {
  371. return 1;
  372. }
  373.  
  374. public OnVehicleStreamIn(vehicleid, forplayerid)
  375. {
  376. return 1;
  377. }
  378.  
  379. public OnVehicleStreamOut(vehicleid, forplayerid)
  380. {
  381. return 1;
  382. }
  383.  
  384. public OnPlayerEnterDynamicCP(playerid, checkpointid)
  385. {
  386. for(new x; x<houseid; x++) //Loops through all current house ids.
  387. {
  388. if(HouseInformation[x][checkpointidx][0; == checkpointid) //If the entry checkpoint is entry checkpoint.
  389. {
  390. if(InHouse[playerid] != -1)
  391. {
  392. InHouse[playerid] = -1; //Sets the player to outside the house.
  393. return 1;
  394. }
  395. InHouseCP[playerid] = x; //Sets the InHouseCP variable.
  396. new Pname[24]; //Pname variable.
  397. GetPlayerName(playerid, Pname, 24); //Gets the players name.
  398. if(HouseInformation[x][owner][0] != 0 && !strcmp(Pname, HouseInformation[x][owner][0]))
  399. //The line above checks that the owner string has something in it, then it
  400. //Will compare it to our current player.
  401. {
  402. SetPlayerPos(playerid, HouseInformation[x][TelePos][0], HouseInformation[x][TelePos][1], HouseInformation[x][TelePos][2]); //Sets players position where x = houseid.
  403. SetPlayerInterior(playerid, HouseInformation[x][interiors]); //Sets players interior
  404. SetPlayerVirtualWorld(playerid, 15500000 + x); //Sets the virtual world
  405. //This is used if you want multiple houses per interior.
  406. //Sets the inhouse variable to the house he's in.
  407. }
  408. if(!HouseInformation[x][owner][0]) SendClientMessage(playerid, -1, "This house is for sale /buy to buy it!");
  409. //If there is no owner, it will send a message telling the player to buy it :).
  410. return 1;
  411. //We do this so the loop doesn't continue after or it tries to go for more checkpoints
  412. //We could alternitivly use break;
  413. }
  414. if(HouseInformation[x][checkpointidx][1] == checkpointid) //If the player enters the house exit.
  415. {
  416. if(InHouse[playerid] == -1)
  417. {
  418. InHouse[playerid] = x;
  419. return 1;
  420. }
  421. SetPlayerPos(playerid, HouseInformation[x][EnterPos][0], HouseInformation[x][EnterPos][1], HouseInformation[x][EnterPos][2]);
  422. SetPlayerInterior(playerid, 0); //Sets the player back to interior 0 (Outside)
  423. SetPlayerVirtualWorld(playerid, 0); //Sets the players Virtual world to 0.
  424. return 1;
  425. //We do this so the loop doesn't continue after or it tries to go for more checkpoints
  426. //We could alternitivly use break;
  427. }
  428. }
  429. return 1;
  430. }
  431.  
  432. public OnPlayerLeaveDynamicCP(playerid, checkpointid)
  433. {
  434. if(InHouseCP[playerid] != - 1) InHouseCP[playerid] = -1; //Sets the players InHouseCP variable to 0.
  435. return 1;
  436. }
  437.  
  438. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  439. {
  440. return 1;
  441. }
  442.  
  443. public OnPlayerClickPlayer(playerid, clickedplayerid, source)
  444. {
  445. return 1;
  446. }
  447.  
  448. COMMAND:v(playerid, params[])
  449. {
  450. // my first command, i'm so horny!
  451. new vehicleid, color1, color2;
  452. if(!sscanf(params, "iii", vehicleid, color1, color2))
  453. {
  454. new vin;
  455. new Float:x, Float:y, Float:z;
  456. GetPlayerPos(playerid, x, y, z);
  457. vin=CreateVehicle(vehicleid, x, y, z, 0.0, color1, color2, -1);
  458. PutPlayerInVehicle(playerid, vin, 0);
  459. }else{
  460. SendClientMessage(playerid, COLOR_GREY, "ERROR: This command requires: /v [vehicleid][color1][color2]");
  461. }
  462. return 1;
  463. }
  464. stock CreateHouse(HouseName[], CostP, Float:EnterX, Float:EnterY, Float:EnterZ, Float:TeleX, Float:TeleY, Float:TeleZ, Interiorx, SellP)
  465. {
  466. format(HouseInformation[houseid][Hname], 100, "%s", HouseName);
  467. HouseInformation[houseid][costprice] = CostP;
  468. HouseInformation[houseid][EnterPos][0] = EnterX;
  469. HouseInformation[houseid][EnterPos][1] = EnterY;
  470. HouseInformation[houseid][EnterPos][2] = EnterZ;
  471. HouseInformation[houseid][TelePos][0] = TeleX;
  472. HouseInformation[houseid][TelePos][1] = TeleY;
  473. HouseInformation[houseid][TelePos][2] = TeleZ;
  474. HouseInformation[houseid][sellprice] = SellP;
  475. HouseInformation[houseid][interiors] = Interiorx;
  476. format(fquery, sizeof(fquery), "SELECT houseowner FROM HOUSEINFO WHERE housename = '%s'", HouseName); //Formats the SELECT query
  477. queryresult = db_query(database, fquery); //Query result variable has been used to query the string above.
  478. if(db_num_rows(queryresult) != 0) db_get_field_assoc(queryresult, "houseowner", HouseInformation[houseid][owner], 24); //Fetches the field information db_free_result(queryresult);
  479. HouseInformation[houseid][checkpointidx][0] = CreateDynamicCP(EnterX, EnterY, EnterZ, 1.0);
  480. //CreateDynamicCP(Float:x, Float:y, Float:z, Float:size);
  481. HouseInformation[houseid][checkpointidx][1] = CreateDynamicCP(TeleX, TeleY, TeleZ, 1.0, 15500000+houseid, Interiorx);
  482. //CreateDynamicCP(Float:x, Float:y, Float:z, Float:size, worldid, interiorid);
  483. if(!HouseInformation[houseid][owner][0]) format(fquery, sizeof(fquery), "House Name: %s \n House Price:$%d \n Sell Price: $%d", HouseName, CostP, SellP);
  484. //If there is nothing in the owners variable, we check if the first cell doesn't have a character.
  485. else if(HouseInformation[houseid][owner][0] != 0) format(fquery, sizeof(fquery), "House Name: %s \n Owner: %s", HouseName, HouseInformation[houseid][owner]);
  486. //If there is something in the owners variable we check if the first cell has a character.
  487. HouseInformation[houseid][textid] = CreateDynamic3DTextLabel(fquery, 0xFFFFFF, EnterX, EnterY, EnterZ + 0.5, 50.0);
  488. //CreateDynamic3DTextLabel(const text[], color, Float:x, Float:y, Float:z, Float:drawdistance, attachedplayer = INVALID_PLAYER_ID, attachedvehicle = INVALID_VEHICLE_ID, testlos = 0, worldid = -1, interiorid = -1, playerid = -1, Float:distance = 100.0);
  489. houseid ++; //We go to the next free slot in our variable.
  490. return 1;
  491. }
  492. stock SetOwner(HouseName[], ownername[], houseids)
  493. {
  494. format(fquery, sizeof(fquery), "INSERT INTO `HOUSEINFO` (`housename`, `houseowner`) VALUES('%s', '%s')", HouseName, ownername);
  495. db_query(database, fquery); //Queries the SQLite database.
  496. format(HouseInformation[houseids][owner], 24, "%s", ownername);
  497. format(fquery, sizeof(fquery), "House Name: %s \n Owner: %s", HouseName, HouseInformation[houseids][owner]);
  498. UpdateDynamic3DTextLabelText(HouseInformation[houseids][textid], 0xFFFFFF, fquery); //Updates the text label.
  499. return 1;
  500. }
  501.  
  502. stock DeleteOwner(HouseName[], houseids)
  503. {
  504. format(HouseInformation[houseids][owner], 24, "%s", "\0");
  505. format(fquery, sizeof(fquery), "DELETE FROM `HOUSEINFO` WHERE `housename` = '%s'", HouseName);
  506. db_query(database, fquery); //Queries the SQLite database.
  507. format(fquery, sizeof(fquery), "House Name: %s \n House Price:$%d \n Sell Price: $%d", HouseName, HouseInformation[houseids][costprice], HouseInformation[houseids][sellprice]);
  508. UpdateDynamic3DTextLabelText(HouseInformation[houseids][textid], 0xFFFFFF, fquery); //Updates the text label.
  509. return 1;
  510. }
  511. CMD:buy(playerid, params)
  512. {
  513. if(InHouseCP[playerid] == -1) return SendClientMessage(playerid, 0xFF0000, "You are not in any house checkpoints!");
  514. if(HouseInformation[InHouseCP[playerid]][owner][0] != 0) return SendClientMessage(playerid, 0xFF0000, "This house has a owner");
  515. if(GetPlayerMoney(playerid) < HouseInformation[InHouseCP[playerid]][costprice]) return SendClientMessage(playerid, 0xFF0000, "You don't have enough money!"); //Player has a lack of cash!
  516. new PlayerName[24];
  517. GetPlayerName(playerid, PlayerName, 24);
  518. format(fquery, sizeof(fquery), "SELECT `houseowner` FROM `HOUSEINFO` WHERE `houseowner` = '%s'", PlayerName); //Formats the SELECT query
  519. queryresult = db_query(database, fquery); //Query result variable has been used to query the string above.
  520. if(db_num_rows(queryresult) == MAX_HOUSES_PER_PLAYER) return SendClientMessage(playerid, 0xFF0000, "You already have the max amount of houses"); //If the player has the max houses
  521. db_free_result(queryresult);
  522. //This is the point where the player can buy the house
  523. SetOwner(HouseInformation[InHouseCP[playerid]][Hname], PlayerName, InHouseCP[playerid]);
  524. //SetOwner(HouseName[], ownername[], houseids)
  525. SetPlayerPos(playerid, HouseInformation[InHouseCP[playerid]][TelePos][0], HouseInformation[InHouseCP[playerid]][TelePos][1], HouseInformation[InHouseCP[playerid]][TelePos][2]); //Sets players position where InHouseCP[playerid] = houseid.
  526. SetPlayerInterior(playerid, HouseInformation[InHouseCP[playerid]][interiors]); //Sets players interior
  527. SetPlayerVirtualWorld(playerid, 15500000 + InHouseCP[playerid]); //Sets the virtual world
  528. GivePlayerMoney(playerid, - HouseInformation[InHouseCP[playerid]][costprice]);
  529. GameTextForPlayer(playerid, "House ~r~Purchased!", 3000, 3); //Tells them they have purchased a house
  530. return 1;
  531. }
  532.  
  533. CMD:sell(playerid, params)
  534. {
  535. if(InHouse[playerid] == -1) return SendClientMessage(playerid, 0xFF0000, "You have to be inside your house to sell it!");
  536. new Pname[24];
  537. GetPlayerName(playerid, Pname, 24);
  538. if(strcmp(HouseInformation[InHouse[playerid]][owner], Pname) != 0) return SendClientMessage(playerid, 0xFF0000, "This is not your house!");
  539. //This is the point where the player can sell the house
  540. DeleteOwner(HouseInformation[InHouse[playerid]][Hname], InHouse[playerid]);
  541. //DeleteOwner(HouseName[], houseids)
  542. GivePlayerMoney(playerid, HouseInformation[InHouse[playerid]][sellprice]);
  543. SetPlayerPos(playerid, HouseInformation[InHouse[playerid]][EnterPos][0], HouseInformation[InHouse[playerid]][EnterPos][1], HouseInformation[InHouse[playerid]][EnterPos][2]);
  544. SetPlayerInterior(playerid, 0); //Sets the player back to interior 0 (Outside)
  545. SetPlayerVirtualWorld(playerid, 0); //Sets the players Virtual world to 0.
  546. InHouseCP[playerid] = InHouse[playerid];
  547. GameTextForPlayer(playerid, "House ~g~sold!", 3000, 3); //Tells them they have sold a house
  548. return 1;
  549. }
  550.  
  551.  
Advertisement
Add Comment
Please, Sign In to add comment