Advertisement
MAYP

Botak's Garage Sysem

Jan 15th, 2014
2,274
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 23.80 KB | None | 0 0
  1. // This is a comment
  2. // uncomment the line below if you want to write a filterscript
  3. //#define FILTERSCRIPT
  4.  
  5. #include <a_samp>
  6.  
  7. #define MAX_GARAGES 51 // Ignore 1
  8.  
  9. // Garages Settings
  10. enum garageInfo
  11. {
  12. gLevel,
  13. gPrice,
  14. gOwner[32],
  15. Float:gX,
  16. Float:gY,
  17. Float:gZ,
  18. gPickup,
  19. Text3D:gText
  20. }
  21. new GarageInfo[MAX_GARAGES][garageInfo];
  22.  
  23. stock LoadGarages()
  24. {
  25. new binfo[21][32];
  26. new string[256];
  27. new File:file = fopen("garages.cfg", io_read);
  28. if(file)
  29. {
  30. new idx = 1;
  31. while(idx < MAX_GARAGES)
  32. {
  33. fread(file, string);
  34. split(string, binfo, '|');
  35. format(GarageInfo[idx][gOwner], 32, "%s", binfo[3]);
  36. GarageInfo[idx][gX] = floatstr(binfo[4]);
  37. GarageInfo[idx][gY] = floatstr(binfo[5]);
  38. GarageInfo[idx][gZ] = floatstr(binfo[6]);
  39. if(GarageInfo[idx][gLevel])
  40. {
  41. GarageInfo[idx][gPickup] = CreateDynamicPickup(1277, 1, GarageInfo[idx][gX], GarageInfo[idx][gY], GarageInfo[idx][gZ], 0);
  42. if(!strcmp("The State", GarageInfo[idx][gOwner])) format(string, sizeof(string), ""COE"["CWE"%d, Garage (Lvl: %d)\n"COE"\n"COE"Owner"CWE" %s\n"CWE"$%d", idx, GarageInfo[idx][gLevel], GarageInfo[idx][gOwner], GarageInfo[idx][gPrice]);
  43. else format(string, sizeof(string), ""COE"["CWE"%d, Garage (Lvl: %d)"COE"]\n"COE"Owner"CWE" %s", idx, GarageInfo[idx][gLevel], GarageInfo[idx][gOwner]);
  44. GarageInfo[idx][gText] = CreateDynamic3DTextLabel(string, COLOR_WHITE, GarageInfo[idx][gX], GarageInfo[idx][gY], GarageInfo[idx][gZ]+0.3, 15);
  45.  
  46. }
  47. idx++;
  48. }
  49. }
  50. print("Garages loaded successfully.");
  51. return 1;
  52. }
  53.  
  54. stock SaveGarages()
  55. {
  56. new idx = 1, File:file;
  57. new string[256];
  58. while(idx < MAX_GARAGES)
  59. {
  60. format(string, sizeof(string), "%d|%d|%s|%f|%f|%f\r\n",
  61. GarageInfo[idx][gLevel],
  62. GarageInfo[idx][gPrice],
  63. GarageInfo[idx][gOwner],
  64. GarageInfo[idx][gX],
  65. GarageInfo[idx][gY],
  66. GarageInfo[idx][gZ]
  67. );
  68. if(idx == 1)
  69. {
  70. file = fopen("garages.cfg", io_write);
  71. }
  72. else
  73. {
  74. file = fopen("garages.cfg", io_append);
  75. }
  76. fwrite(file, string);
  77. fclose(file);
  78. idx++;
  79. }
  80. print("Garages saved successfully.");
  81. }
  82.  
  83. stock CheckFiles()
  84. {
  85. if(!dini_Exists("garages.cfg")) dini_Create("garages.cfg");
  86. return 1;
  87. }
  88.  
  89. #if defined FILTERSCRIPT
  90.  
  91. public OnFilterScriptInit()
  92. {
  93. SaveGarages();
  94.  
  95. print("\n-------------------------------------------------");
  96. print(" Botak's Garage System, Please Don't Remove Credits");
  97. print("-------------------------------------------------\n");
  98. return 1;
  99. }
  100.  
  101. public OnFilterScriptExit()
  102. {
  103. return 1;
  104. }
  105.  
  106. #else
  107.  
  108. main()
  109. {
  110. print("\n----------------------------------");
  111. print(" Botak's Garage System");
  112. print("----------------------------------\n");
  113. }
  114.  
  115. #endif
  116.  
  117.  
  118.  
  119. public OnPlayerRequestClass(playerid, classid)
  120. {
  121. SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
  122. SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
  123. SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
  124. return 1;
  125. }
  126.  
  127. public OnPlayerConnect(playerid)
  128. {
  129. return 1;
  130. }
  131.  
  132. public OnPlayerDisconnect(playerid, reason)
  133. {
  134. return 1;
  135. }
  136.  
  137. public OnPlayerSpawn(playerid)
  138. {
  139. return 1;
  140. }
  141.  
  142. public OnPlayerDeath(playerid, killerid, reason)
  143. {
  144. return 1;
  145. }
  146.  
  147. public OnVehicleSpawn(vehicleid)
  148. {
  149. return 1;
  150. }
  151.  
  152. public OnVehicleDeath(vehicleid, killerid)
  153. {
  154. return 1;
  155. }
  156.  
  157. public OnPlayerText(playerid, text[])
  158. {
  159. return 1;
  160. }
  161.  
  162.  
  163.  
  164. CMD:garageused(playerid, params[])
  165. {
  166. new string[128];
  167. if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
  168. if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You must login RCON.");
  169. // if(!aDuty[playerid]) return SendClientMessage(playerid, COLOR_GREY, "You are not on admin duty.");
  170. SendClientMessage(playerid, COLOR_ORANGE, "[Used Garages]:");
  171. for(new idx=1; idx<MAX_GARAGES; idx++)
  172. {
  173. if(GarageInfo[idx][gLevel])
  174. {
  175. format(string, sizeof(string), "ID: %d | Owner: %s | Price: %d", idx, GarageInfo[idx][gOwner], GarageInfo[idx][gPrice]);
  176. SendClientMessage(playerid, COLOR_ORANGE, string);
  177. }
  178. }
  179. return 1;
  180. }
  181.  
  182. CMD:buygarage(playerid, params[])
  183. {
  184. new string[128], done;
  185. if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
  186. if(PlayerInfo[playerid][pGarage]) return SendClientMessage(playerid, COLOR_GREY, "You already own a garage.");
  187. for(new idx=1; idx<MAX_GARAGES; idx++)
  188. {
  189. if(IsPlayerInRangeOfPoint(playerid, 3, GarageInfo[idx][gX], GarageInfo[idx][gY], GarageInfo[idx][gZ]))
  190. {
  191. if(!strcmp("The State", GarageInfo[idx][gOwner], false))
  192. {
  193. if(PlayerInfo[playerid][pMoney] < GarageInfo[idx][gPrice]) return SendClientMessage(playerid, COLOR_GREY, "You don't have enough money to buy this garage.");
  194. GiveZaiatMoney(playerid, -GarageInfo[idx][gPrice]);
  195. if(PlayerInfo[playerid][pGarage]) PlayerInfo[playerid][pGarage] = idx;
  196. else PlayerInfo[playerid][pGarage] = idx;
  197. format(GarageInfo[idx][gOwner], 32, "%s", RPNU(playerid));
  198. format(string, sizeof(string), ""COE"["CWE"%d, Garage (Lvl: %d)"COE"]\n"COE"Owner"CWE" %s", idx, GarageInfo[idx][gLevel], GarageInfo[idx][gOwner]);
  199. UpdateDynamic3DTextLabelText(GarageInfo[idx][gText], COLOR_WHITE, string);
  200. SendClientMessage(playerid, COLOR_GREEN, " You have successfully bought a garage.");
  201. format(string, sizeof(string), "%s has bought garage id %d.", RPN(playerid), idx);
  202. Log("logs/garage.log", string);
  203. idx = MAX_GARAGES;
  204. done = 1;
  205. }
  206. if(idx == MAX_GARAGES-1 && !done)
  207. {
  208. SendClientMessage(playerid, COLOR_GREY, "This garage is owned by someone else.");
  209. }
  210. }
  211. if(idx == MAX_GARAGES-1 && !done)
  212. {
  213. SendClientMessage(playerid, COLOR_GREY, "You are not near a buyable garage.");
  214. }
  215. }
  216. return 1;
  217. }
  218.  
  219. CMD:sellgaragetogov(playerid, params[])
  220. {
  221. new string[128], done;
  222. if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
  223. if(!PlayerInfo[playerid][pGarage] && !PlayerInfo[playerid][pVHouse]) return SendClientMessage(playerid, COLOR_GREY, "You don't own a house.");
  224. if(sscanf(params, "s[8]", params)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /sellgaragetogov confirm");
  225. if(!strcmp(params, "confirm", true))
  226. {
  227. new idx = PlayerInfo[playerid][pGarage];
  228. if(IsPlayerInRangeOfPoint(playerid, 2, GarageInfo[PlayerInfo[playerid][pGarage]][gX], GarageInfo[PlayerInfo[playerid][pGarage]][gY], GarageInfo[PlayerInfo[playerid][pGarage]][gZ]))
  229. {
  230. GiveZaiatMoney(playerid, (75*GarageInfo[PlayerInfo[playerid][pGarage]][gPrice])/100);
  231. format(GarageInfo[PlayerInfo[playerid][pGarage]][gOwner], 32, "The State");
  232. format(string, sizeof(string), "ID: %d\nHouse (Lvl: %d)\nOwner: %s\nStatus: For Sale\nPrice: $%d", idx, GarageInfo[idx][gLevel], GarageInfo[idx][gOwner], GarageInfo[idx][gPrice]);
  233. UpdateDynamic3DTextLabelText(GarageInfo[PlayerInfo[playerid][pGarage]][gText], COLOR_WHITE, string);
  234. PlayerInfo[playerid][pGarage] = 0;
  235. SendClientMessage(playerid, COLOR_GREEN, " You have successfully sold your house to The State. (75 percent of the original price was paid back)");
  236. format(string, sizeof(string), "%s has sold house id %d to the market.", RPN(playerid), idx);
  237. Log("logs/garage.log", string);
  238. done = 1;
  239. }
  240. if(!done)
  241. {
  242. idx = PlayerInfo[playerid][pVHouse];
  243. if(IsPlayerInRangeOfPoint(playerid, 3, GarageInfo[idx][gX], GarageInfo[idx][gY], GarageInfo[idx][gZ]))
  244. {
  245. GiveZaiatMoney(playerid, (75*GarageInfo[idx][gPrice])/100);
  246. format(GarageInfo[idx][gOwner], 32, "The State");
  247. format(string, sizeof(string), ""COE"["CWE"%d, Garage (Lvl: %d)"COE"]\n"COE"Owner"CWE" %s\nStatus: For Sale\n"CWE"$%d", idx, GarageInfo[idx][gLevel], GarageInfo[idx][gOwner], GarageInfo[idx][gPrice]);
  248. UpdateDynamic3DTextLabelText(GarageInfo[idx][gText], COLOR_WHITE, string);
  249. SendClientMessage(playerid, COLOR_GREEN, " You have successfully sold your garage to The State. (75 percent of the original price was paid back)");
  250. format(string, sizeof(string), "%s has sold garage id %d to the market.", RPN(playerid), idx);
  251. Log("logs/garage.log", string);
  252. done = 1;
  253. }
  254. }
  255. if(!done)
  256. {
  257. SendClientMessage(playerid, COLOR_GREY, "You are not near your garage.");
  258. return 1;
  259. }
  260. }
  261. return 1;
  262. }
  263.  
  264. CMD:gcreate(playerid, params[])
  265. {
  266. new string[128];
  267. if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
  268. if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You must login RCON.");
  269. // if(!aDuty[playerid]) return SendClientMessage(playerid, COLOR_GREY, "You are not on admin duty.");
  270. for(new idx=1; idx<MAX_GARAGES; idx++)
  271. {
  272. if(!GarageInfo[idx][gLevel])
  273. {
  274. // Getting Garage Setup
  275. new Float:X, Float:Y, Float:Z;
  276. GetPlayerPos(playerid, X, Y, Z);
  277. // Making Garage
  278. GarageInfo[idx][gLevel] = 1;
  279. GarageInfo[idx][gPrice] = 99999999;
  280. format(GarageInfo[idx][gOwner], 32, "The State");
  281. GarageInfo[idx][gX] = X;
  282. GarageInfo[idx][gY] = Y;
  283. GarageInfo[idx][gZ] = Z;
  284. GarageInfo[idx][gPickup] = CreateDynamicPickup(1277, 1, GarageInfo[idx][gX], GarageInfo[idx][gY], GarageInfo[idx][gZ], 0);
  285. format(string, sizeof(string), ""COE"["CWE"%d, Garage (Lvl: %d)"COE"]\n"COE"Owner"CWE" %s\nStatus: For Sale\n"CWE"$%d", idx, GarageInfo[idx][gLevel], GarageInfo[idx][gOwner], GarageInfo[idx][gPrice]);
  286. GarageInfo[idx][gText] = CreateDynamic3DTextLabel(string, COLOR_WHITE, GarageInfo[idx][gX], GarageInfo[idx][gY], GarageInfo[idx][gZ]+0.3, 15);
  287. format(string, sizeof(string), "{FF0000}[Admin Warn]{FF6347} %s has created garage ID %d.", RPN(playerid), idx);
  288. SendAdminMessage(COLOR_DARKRED, 1, string);
  289. Log("logs/garage.log", string);
  290. idx = MAX_GARAGES;
  291. }
  292. }
  293. return 1;
  294. }
  295.  
  296. CMD:deletegarage(playerid, params[])
  297. {
  298. new id, string[128];
  299. if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
  300. if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You must login RCON.");
  301. // if(!aDuty[playerid]) return SendClientMessage(playerid, COLOR_GREY, "You are not on admin duty.");
  302. if(sscanf(params, "i", id)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /deletegarage [garageid]");
  303. if(!GarageInfo[id][gLevel]) return SendClientMessage(playerid, COLOR_GREY, "Invalid garage id.");
  304. foreach(Player, i)
  305. {
  306. if(IsPlayerLoggedIn(i) && PlayerInfo[i][pGarage] == id)
  307. {
  308. PlayerInfo[i][pGarage] = 0;
  309. format(string, sizeof(string), " Administrator %s has deleted your garage.", RPN(playerid));
  310. SendClientMessage(i, COLOR_WHITE, string);
  311. }
  312. }
  313. if(!strcmp("The State", GarageInfo[id][gOwner]))
  314. {
  315. format(string, sizeof(string), "{FF0000}[Admin Warn]{FF6347} %s has deleted garage ID %d.", RPN(playerid), id);
  316. }
  317. else
  318. {
  319. format(string, sizeof(string), "{FF0000}[Admin Warn]{FF6347} %s has deleted %s's garage. (ID %d)", RPN(playerid), GarageInfo[id][gOwner], id);
  320. }
  321. SendAdminMessage(COLOR_DARKRED, 1, string);
  322. Log("logs/garage.log", string);
  323. GarageInfo[id][gLevel] = 0;
  324. GarageInfo[id][gPrice] = 0;
  325. format(GarageInfo[id][gOwner], 32, "");
  326. GarageInfo[id][gX] = 0;
  327. GarageInfo[id][gY] = 0;
  328. GarageInfo[id][gZ] = 0;
  329. DestroyDynamicPickup(GarageInfo[id][gPickup]);
  330. DestroyDynamic3DTextLabel(GarageInfo[id][gText]);
  331. return 1;
  332. }
  333.  
  334. CMD:enter(playerid, params[])
  335. {
  336. for(new idx=1; idx<MAX_GARAGES; idx++) // Dynamic Garages
  337. {
  338. if(IsPlayerInRangeOfPoint(playerid, 5, GarageInfo[idx][gX], GarageInfo[idx][gY], GarageInfo[idx][gZ])/* && GetPlayerState(playerid) == PLAYER_STATE_DRIVER*/)
  339. {
  340. format(string, sizeof(string), "* %s enters the garage.", RPN(playerid));
  341. if(PlayerInfo[playerid][pMaskOn] == 1)
  342. {
  343. format(string, sizeof(string), "* Stranger enters the garage.");
  344. }
  345. else
  346. {
  347. format(string, sizeof(string), "* %s enters the garage.", RPN(playerid));
  348. }
  349. SendNearbyMessage(playerid, 15, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
  350. SetPlayerVirtualWorld(playerid, idx+500);
  351. //SetVehicleVirtualWorld(GetPlayerVehicleID(playerid), idx+500);
  352. new vehicleid = GetPlayerVehicleID(playerid);
  353. if(GarageInfo[idx][gLevel] == 1)
  354. {
  355. if(IsPlayerInAnyVehicle(playerid))
  356. {
  357. SetVehiclePos(vehicleid, -2070.3000488281,-24,49.099998474121);
  358. SetCameraBehindPlayer(playerid);
  359. SetVehicleVirtualWorld(vehicleid, idx+500);
  360. }
  361. else
  362. {
  363. SetPlayerPos(playerid, -2070.3000488281,-24,49.099998474121);
  364. SetPlayerInterior(playerid, 0);
  365. SetCameraBehindPlayer(playerid);
  366. }
  367. }
  368. if(GarageInfo[idx][gLevel] == 2)
  369. {
  370. if(IsPlayerInAnyVehicle(playerid))
  371. {
  372. SetVehiclePos(vehicleid, -2070.3000488281,-24,49.099998474121);
  373. SetCameraBehindPlayer(playerid);
  374. SetVehicleVirtualWorld(vehicleid, idx+500);
  375. }
  376. else
  377. {
  378. SetPlayerPos(playerid, -2070.3000488281,-24,49.099998474121);
  379. SetPlayerInterior(playerid, 0);
  380. SetCameraBehindPlayer(playerid);
  381. }
  382. }
  383. if(GarageInfo[idx][gLevel] == 3)
  384. {
  385. if(IsPlayerInAnyVehicle(playerid))
  386. {
  387. SetVehiclePos(vehicleid, -2070.3000488281,-24,49.099998474121);
  388. SetCameraBehindPlayer(playerid);
  389. SetVehicleVirtualWorld(vehicleid, idx+500);
  390. }
  391. else
  392. {
  393. SetPlayerPos(playerid, -2070.3000488281,-24,49.099998474121);
  394. SetPlayerInterior(playerid, 0);
  395. SetCameraBehindPlayer(playerid);
  396. }
  397. }
  398. if(GarageInfo[idx][gLevel] == 4)
  399. {
  400. if(IsPlayerInAnyVehicle(playerid))
  401. {
  402. SetVehiclePos(vehicleid, -2070.3000488281,-24,49.099998474121);
  403. SetCameraBehindPlayer(playerid);
  404. SetVehicleVirtualWorld(vehicleid, idx+500);
  405. }
  406. else
  407. {
  408. SetPlayerPos(playerid, -2070.3000488281,-24,49.099998474121);
  409. SetPlayerInterior(playerid, 0);
  410. SetCameraBehindPlayer(playerid);
  411. }
  412. }
  413. if(GarageInfo[idx][gLevel] == 5)
  414. {
  415. if(IsPlayerInAnyVehicle(playerid))
  416. {
  417. SetVehiclePos(vehicleid, -2070.3000488281,-24,49.099998474121);
  418. SetCameraBehindPlayer(playerid);
  419. SetVehicleVirtualWorld(vehicleid, idx+500);
  420. }
  421. else
  422. {
  423. SetPlayerPos(playerid, -2070.3000488281,-24,49.099998474121);
  424. SetPlayerInterior(playerid, 0);
  425. SetCameraBehindPlayer(playerid);
  426. }
  427. }
  428. if(GarageInfo[idx][gLevel] == 6)
  429. {
  430. if(IsPlayerInAnyVehicle(playerid))
  431. {
  432. SetVehiclePos(vehicleid, -2070.3000488281,-24,49.099998474121);
  433. SetCameraBehindPlayer(playerid);
  434. SetVehicleVirtualWorld(vehicleid, idx+500);
  435. }
  436. else
  437. {
  438. SetPlayerPos(playerid, -2070.3000488281,-24,49.099998474121);
  439. SetPlayerInterior(playerid, 0);
  440. SetCameraBehindPlayer(playerid);
  441. }
  442. }
  443. if(GarageInfo[idx][gLevel] == 7)
  444. {
  445. if(IsPlayerInAnyVehicle(playerid))
  446. {
  447. SetVehiclePos(vehicleid, -2070.3000488281,-24,49.099998474121);
  448. SetCameraBehindPlayer(playerid);
  449. SetVehicleVirtualWorld(vehicleid, idx+500);
  450. }
  451. else
  452. {
  453. SetPlayerPos(playerid, -2070.3000488281,-24,49.099998474121);
  454. SetPlayerInterior(playerid, 0);
  455. SetCameraBehindPlayer(playerid);
  456. }
  457. }
  458. if(GarageInfo[idx][gLevel] == 8)
  459. {
  460. if(IsPlayerInAnyVehicle(playerid))
  461. {
  462. SetVehiclePos(vehicleid, -2070.3000488281,-24,49.099998474121);
  463. SetCameraBehindPlayer(playerid);
  464. SetVehicleVirtualWorld(vehicleid, idx+500);
  465. }
  466. else
  467. {
  468. SetPlayerPos(playerid, -2070.3000488281,-24,49.099998474121);
  469. SetPlayerInterior(playerid, 0);
  470. SetCameraBehindPlayer(playerid);
  471. }
  472. }
  473. if(GarageInfo[idx][gLevel] == 9)
  474. {
  475. if(IsPlayerInAnyVehicle(playerid))
  476. {
  477. SetVehiclePos(vehicleid, -2070.3000488281,-24,49.099998474121);
  478. SetCameraBehindPlayer(playerid);
  479. SetVehicleVirtualWorld(vehicleid, idx+500);
  480. }
  481. else
  482. {
  483. SetPlayerPos(playerid, -2070.3000488281,-24,49.099998474121);
  484. SetPlayerInterior(playerid, 0);
  485. SetCameraBehindPlayer(playerid);
  486. }
  487. }
  488. if(GarageInfo[idx][gLevel] == 10)
  489. {
  490. if(IsPlayerInAnyVehicle(playerid))
  491. {
  492. SetVehiclePos(vehicleid, -2070.3000488281,-24,49.099998474121);
  493. SetCameraBehindPlayer(playerid);
  494. SetVehicleVirtualWorld(vehicleid, idx+500);
  495. }
  496. else
  497. {
  498. SetPlayerPos(playerid, -2070.3000488281,-24,49.099998474121);
  499. SetPlayerInterior(playerid, 0);
  500. SetCameraBehindPlayer(playerid);
  501. }
  502. }
  503. return 1;
  504. }
  505. }
  506. return 1;
  507. }
  508.  
  509. CMD:saveproject(playerid, params[])
  510. {
  511. if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
  512. if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You must login RCON.");
  513. foreach(Player, i)
  514. SaveGarages();
  515. format(string, sizeof(string), "{FF0000}[Manual Save]{FF6347} Your Project has manualy saved!");
  516. SendClientMessageToAll(COLOR_LIGHTRED, string);
  517. return 1;
  518. }
  519.  
  520. CMD:gedit(playerid, params[])
  521. {
  522. new bizid, string[128], input;
  523. if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
  524. if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You must login RCON.");
  525. // if(!aDuty[playerid]) return SendClientMessage(playerid, COLOR_GREY, "You are not on admin duty.");
  526. if(sscanf(params, "s[32]", params))
  527. {
  528. SendClientMessage(playerid, COLOR_WHITE, "USAGE: /gedit [option] [garageid]");
  529. SendClientMessage(playerid, COLOR_GREY, "OPTIONS: location | price | level");
  530. return 1;
  531. }
  532. if(!strcmp(params, "location", true, 8))
  533. {
  534. if(sscanf(params, "s[32]i", params, bizid)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /ggedit location [house]");
  535. new idx = bizid;
  536. if(!GarageInfo[bizid][gLevel]) return SendClientMessage(playerid, COLOR_GREY, "Invalid garage id.");
  537. GetPlayerPos(playerid, GarageInfo[idx][gX], GarageInfo[idx][gY], GarageInfo[idx][gZ]);
  538. DestroyDynamicPickup(GarageInfo[idx][gPickup]);
  539. GarageInfo[idx][gPickup] = CreateDynamicPickup(1277, 1, GarageInfo[idx][gX], GarageInfo[idx][gY], GarageInfo[idx][gZ], 0);
  540. DestroyDynamic3DTextLabel(GarageInfo[idx][gText]);
  541. if(!strcmp("The State", GarageInfo[idx][gOwner])) format(string, sizeof(string), ""COE"["CWE"%d, Garage (Lvl: %d)"COE"]\n"COE"Owner"CWE" %s\nStatus: For Sale\n"CWE"$%d", idx, GarageInfo[idx][gLevel], GarageInfo[idx][gOwner], GarageInfo[idx][gPrice]);
  542. else format(string, sizeof(string), ""COE"["CWE"%d, Garage (Lvl: %d)"COE"]\n"COE"Owner"CWE" %s", idx, GarageInfo[idx][gLevel], GarageInfo[idx][gOwner]);
  543. GarageInfo[idx][gText] = CreateDynamic3DTextLabel(string, COLOR_WHITE, GarageInfo[idx][gX], GarageInfo[idx][gY], GarageInfo[idx][gZ]+0.3, 15);
  544. format(string, sizeof(string), "{FF0000}[Admin Warn]{FF6347} %s has changed garage ID %d's location.", RPN(playerid), bizid);
  545. SendAdminMessage(COLOR_DARKRED, 1, string);
  546. Log("logs/garage.log", string);
  547. }
  548. else if(!strcmp(params, "price", true, 5))
  549. {
  550. if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You must login RCON.");
  551. if(sscanf(params, "s[32]ii", params, bizid, input)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /ggedit price [garage] [price]");
  552. new idx = bizid;
  553. if(!GarageInfo[idx][gLevel]) return SendClientMessage(playerid, COLOR_GREY, "Invalid garage id.");
  554. if(strcmp("The State", GarageInfo[bizid][gOwner])) return SendClientMessage(playerid, COLOR_GREY, "You can't edit the price of owned garage.");
  555. GarageInfo[bizid][gPrice] = input;
  556. format(string, sizeof(string), ""COE"["CWE"%d, Garage (Lvl: %d)"COE"]\n"COE"Owner"CWE" %s\nStatus: For Sale\n"CWE"$%d", idx, GarageInfo[idx][gLevel], GarageInfo[idx][gOwner], GarageInfo[idx][gPrice]);
  557. UpdateDynamic3DTextLabelText(GarageInfo[bizid][gText], COLOR_WHITE, string);
  558. format(string, sizeof(string), "{FF0000}[Admin Warn]{FF6347} %s has set Garage ID %d's price to $%d.", RPN(playerid), bizid, input);
  559. SendAdminMessage(COLOR_DARKRED, 1, string);
  560. Log("logs/garage.log", string);
  561. }
  562. else if(!strcmp(params, "level", true, 5))
  563. {
  564. if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You must login RCON.");
  565. if(sscanf(params, "s[32]ii", params, bizid, input)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /ggedit level [garageid] [level]");
  566. new idx = bizid;
  567. //if(!GarageInfo[bizid][hLevel]) return SendClientMessage(playerid, COLOR_GREY, "Invalid garage id.");
  568. if(input < 1 || input > 10) return SendClientMessage(playerid, COLOR_GREY, "Levels are between 1 and 10.");
  569. GarageInfo[bizid][gLevel] = input;
  570. if(!strcmp("The State", GarageInfo[idx][gOwner])) format(string, sizeof(string), ""COE"["CWE"%d, Garage (Lvl: %d)"COE"]\n"COE"Owner"CWE" %s\nStatus: For Sale\n"CWE"$%d", idx, GarageInfo[idx][gLevel], GarageInfo[idx][gOwner], GarageInfo[idx][gPrice]);
  571. else format(string, sizeof(string), ""COE"["CWE"%d, Garage (Lvl: %d)\n"COE"\n"COE"Owner"CWE" %s", idx, GarageInfo[idx][gLevel], GarageInfo[idx][gOwner]);
  572. UpdateDynamic3DTextLabelText(GarageInfo[bizid][gText], COLOR_WHITE, string);
  573. format(string, sizeof(string), "{FF0000}[Admin Warn]{FF6347} %s has set garage ID %d's level to %d.", RPN(playerid), bizid, input);
  574. SendAdminMessage(COLOR_DARKRED, 1, string);
  575. Log("logs/garage.log", string);
  576. }
  577. return 1;
  578. }
  579. // End Garage CMDS
  580.  
  581.  
  582. public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
  583. {
  584. return 1;
  585. }
  586.  
  587. public OnPlayerExitVehicle(playerid, vehicleid)
  588. {
  589. return 1;
  590. }
  591.  
  592. public OnPlayerStateChange(playerid, newstate, oldstate)
  593. {
  594. return 1;
  595. }
  596.  
  597. public OnPlayerEnterCheckpoint(playerid)
  598. {
  599. return 1;
  600. }
  601.  
  602. public OnPlayerLeaveCheckpoint(playerid)
  603. {
  604. return 1;
  605. }
  606.  
  607. public OnPlayerEnterRaceCheckpoint(playerid)
  608. {
  609. return 1;
  610. }
  611.  
  612. public OnPlayerLeaveRaceCheckpoint(playerid)
  613. {
  614. return 1;
  615. }
  616.  
  617. public OnRconCommand(cmd[])
  618. {
  619. return 1;
  620. }
  621.  
  622. public OnPlayerRequestSpawn(playerid)
  623. {
  624. return 1;
  625. }
  626.  
  627. public OnObjectMoved(objectid)
  628. {
  629. return 1;
  630. }
  631.  
  632. public OnPlayerObjectMoved(playerid, objectid)
  633. {
  634. return 1;
  635. }
  636.  
  637. public OnPlayerPickUpPickup(playerid, pickupid)
  638. {
  639. return 1;
  640. }
  641.  
  642. public OnVehicleMod(playerid, vehicleid, componentid)
  643. {
  644. return 1;
  645. }
  646.  
  647. public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
  648. {
  649. return 1;
  650. }
  651.  
  652. public OnVehicleRespray(playerid, vehicleid, color1, color2)
  653. {
  654. return 1;
  655. }
  656.  
  657. public OnPlayerSelectedMenuRow(playerid, row)
  658. {
  659. return 1;
  660. }
  661.  
  662. public OnPlayerExitedMenu(playerid)
  663. {
  664. return 1;
  665. }
  666.  
  667. public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
  668. {
  669. return 1;
  670. }
  671.  
  672. public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
  673. {
  674. return 1;
  675. }
  676.  
  677. public OnRconLoginAttempt(ip[], password[], success)
  678. {
  679. return 1;
  680. }
  681.  
  682. public OnPlayerUpdate(playerid)
  683. {
  684. return 1;
  685. }
  686.  
  687. public OnPlayerStreamIn(playerid, forplayerid)
  688. {
  689. return 1;
  690. }
  691.  
  692. public OnPlayerStreamOut(playerid, forplayerid)
  693. {
  694. return 1;
  695. }
  696.  
  697. public OnVehicleStreamIn(vehicleid, forplayerid)
  698. {
  699. return 1;
  700. }
  701.  
  702. public OnVehicleStreamOut(vehicleid, forplayerid)
  703. {
  704. return 1;
  705. }
  706.  
  707. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  708. {
  709. return 1;
  710. }
  711.  
  712. public OnPlayerClickPlayer(playerid, clickedplayerid, source)
  713. {
  714. return 1;
  715. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement