Advertisement
John_Blaze1971

PDS filterscript edited

Apr 4th, 2016
201
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.62 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. #include <zcmd>
  7. #include <sscanf2>
  8. #include <YSI\y_ini>
  9. new bool:IsInJob;
  10. new pickup_job;
  11. new farecount[MAX_PLAYERS];
  12. new FareCountTimer[MAX_PLAYERS];
  13. #define PATH "/Users/%s.ini"
  14. #if defined FILTERSCRIPT
  15.  
  16. public OnFilterScriptInit()
  17. {
  18. print("\n--------------------------------------");
  19. print(" Blank Filterscript by your name here");
  20. print("--------------------------------------\n");
  21. pickup_job = CreatePickup(1275,1,1753.4523,-1894.1350,13.5572,-1);
  22. return 1;
  23. }
  24.  
  25. public OnFilterScriptExit()
  26. {
  27. return 1;
  28. }
  29.  
  30. #else
  31.  
  32. main()
  33. {
  34. print("\n----------------------------------");
  35. print(" Blank Gamemode by your name here");
  36. print("----------------------------------\n");
  37. }
  38.  
  39. #endif
  40. enum pInfos
  41. {
  42. pJob,
  43. pIsPassenger,
  44. pMoney
  45. };
  46. new pInfo[MAX_PLAYERS][pInfos];
  47.  
  48. stock UserPath(playerid)
  49. {
  50. new string[128],playername[MAX_PLAYER_NAME];
  51. GetPlayerName(playerid,playername,sizeof(playername));
  52. format(string,sizeof(string),PATH,playername);
  53. return string;
  54. }
  55. public OnPlayerRequestClass(playerid, classid)
  56. {
  57. SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
  58. SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
  59. SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
  60. if(pInfo[playerid][pJob] == 1)
  61. {
  62. AddPlayerClass(0, 1753.4523,-1894.1350,13.5572,91.6063, 0, 0, 0, 0, 0, 0);
  63. }
  64. return 1;
  65. }
  66. forward LoadUser_data(playerid,name[],value[]);
  67. public LoadUser_data(playerid,name[],value[])
  68. {
  69. INI_Int("Job",pInfo[playerid][pJob]);
  70. INI_Int("money",pInfo[playerid][pMoney]);
  71. return 1;
  72. }
  73.  
  74. public OnPlayerConnect(playerid)
  75. {
  76. return 1;
  77. }
  78.  
  79. public OnPlayerDisconnect(playerid, reason)
  80. {
  81. if(pInfo[playerid][pJob] == 1)
  82. {
  83. new INI:File = INI_Open(UserPath(playerid));
  84. INI_SetTag(File,"data");
  85. INI_WriteInt(File,"Job",1);
  86. INI_WriteInt(File,"money",pInfo[playerid][pMoney]);
  87. INI_Close(File);
  88. new amount;
  89. amount = (farecount[playerid] * 10);
  90. GivePlayerMoney(playerid,amount);
  91. pInfo[playerid][pMoney] += amount;
  92. }
  93. if(pInfo[playerid][pIsPassenger] == 1)
  94. {
  95. new INI:File = INI_Open(UserPath(playerid));
  96. INI_SetTag(File,"data");
  97. INI_WriteInt(File,"FareAmount",0);
  98. INI_Close(File);
  99. new amount;
  100. amount = (farecount[playerid] * 10);
  101. GivePlayerMoney(playerid,-amount);
  102. pInfo[playerid][pMoney] -= amount;
  103. }
  104. return 1;
  105. }
  106.  
  107. public OnPlayerSpawn(playerid)
  108. {
  109. new money;
  110. money = pInfo[playerid][pMoney];
  111. GivePlayerMoney(playerid,money);
  112.  
  113. return 1;
  114. }
  115.  
  116. public OnPlayerDeath(playerid, killerid, reason)
  117. {
  118. return 1;
  119. }
  120.  
  121. public OnVehicleSpawn(vehicleid)
  122. {
  123. return 1;
  124. }
  125.  
  126. public OnVehicleDeath(vehicleid, killerid)
  127. {
  128. return 1;
  129. }
  130.  
  131. public OnPlayerText(playerid, text[])
  132. {
  133. return 1;
  134. }
  135.  
  136. CMD:startfare(playerid,params[])
  137. {
  138. new id;
  139. if(sscanf(params,"d",id)) return SendClientMessage(playerid,-1,"[ ! ] /startfare <id>");
  140. if(!IsPlayerConnected(id)) return SendClientMessage(playerid,-1,"[ ! ] Invalid ID!");
  141. if(pInfo[playerid][pJob] == 1)
  142. {
  143. if(GetPlayerVehicleSeat(id) == 0)
  144. {
  145. if(GetPlayerVehicleSeat(id) == 1 || GetPlayerVehicleSeat(id) == 2 || GetPlayerVehicleSeat(id) == 3 || GetPlayerVehicleSeat(id) == 4)
  146. {
  147. FareCountTimer[playerid] = SetTimer("FareCount",1000,true);
  148. pInfo[playerid][pIsPassenger] = 1;
  149. SendClientMessage(playerid,-1,"[ ! ] Fare started for the player.");
  150. farecount[id] = 0;
  151. farecount[playerid] = 0;
  152. }
  153. else SendClientMessage(playerid,-1,"[ ! ] Player must be on any seat of the car!");
  154. }
  155. else SendClientMessage(playerid,-1,"[ ! ] You must be on driving seat");
  156. }
  157. return 1;
  158. }
  159. forward FareCount(playerid);
  160. public FareCount(playerid)
  161. {
  162. farecount[playerid]++;
  163. }
  164. public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
  165. {
  166. if(pInfo[playerid][pJob] == 1)
  167. {
  168. SendClientMessage(playerid,-1,"[ ! ] Welcome to the vehicle");
  169. new INI:File = INI_Open(UserPath(playerid));
  170. INI_SetTag(File,"data");
  171. INI_WriteInt(File,"FareAmount",farecount[playerid]);
  172. INI_Close(File);
  173. }
  174. else
  175. {
  176. SendClientMessage(playerid,-1,"[ ! ] You may request for fare!");
  177. new INI:File = INI_Open(UserPath(playerid));
  178. INI_SetTag(File,"data");
  179. INI_WriteInt(File,"money",pInfo[playerid][pMoney]);
  180. INI_Close(File);
  181. }
  182. return 1;
  183. }
  184.  
  185. public OnPlayerExitVehicle(playerid, vehicleid)
  186. {
  187. if(farecount[playerid] > 0)
  188. {
  189. if(pInfo[playerid][pIsPassenger] == 1)
  190. {
  191. new amount;
  192. amount = (farecount[playerid] * 10);
  193. GivePlayerMoney(playerid,-amount);
  194. new str[128];
  195. farecount[playerid] = 0;
  196. KillTimer(FareCountTimer[playerid]);
  197. format(str,sizeof(str),"[ ! ] You lose %d as your fare money!",amount);
  198. SendClientMessage(playerid,-1,str);
  199. pInfo[playerid][pMoney] -= amount;
  200. }
  201. }
  202. if(farecount[playerid] > 0)
  203. {
  204. if(pInfo[playerid][pJob] == 1)
  205. {
  206. new amount;
  207. amount = (farecount[playerid] * 10);
  208. GivePlayerMoney(playerid,amount);
  209. farecount[playerid] = 0;
  210. new str[128];
  211. format(str,sizeof(str),"[ ! ] You earn %d as your fare money!",amount);
  212. SendClientMessage(playerid,-1,str);
  213. pInfo[playerid][pMoney] += amount;
  214. KillTimer(FareCountTimer[playerid]);
  215. }
  216. }
  217. return 1;
  218. }
  219.  
  220. public OnPlayerStateChange(playerid, newstate, oldstate)
  221. {
  222. return 1;
  223. }
  224.  
  225. public OnPlayerEnterCheckpoint(playerid)
  226. {
  227. return 1;
  228. }
  229.  
  230. public OnPlayerLeaveCheckpoint(playerid)
  231. {
  232. return 1;
  233. }
  234.  
  235. public OnPlayerEnterRaceCheckpoint(playerid)
  236. {
  237. return 1;
  238. }
  239.  
  240. public OnPlayerLeaveRaceCheckpoint(playerid)
  241. {
  242. return 1;
  243. }
  244.  
  245. public OnRconCommand(cmd[])
  246. {
  247. return 1;
  248. }
  249.  
  250. public OnPlayerRequestSpawn(playerid)
  251. {
  252. return 1;
  253. }
  254.  
  255. public OnObjectMoved(objectid)
  256. {
  257. return 1;
  258. }
  259.  
  260. public OnPlayerObjectMoved(playerid, objectid)
  261. {
  262. return 1;
  263. }
  264.  
  265. public OnPlayerPickUpPickup(playerid, pickupid)
  266. {
  267. if(pickupid == pickup_job)
  268. {
  269. if(IsInJob) return SendClientMessage(playerid,-1,"[ ! ] You are already a Public driver");
  270. if(GetPlayerMoney(playerid) >= 500)
  271. {
  272. pInfo[playerid][pJob] = 1;
  273. IsInJob = true;
  274. ForceClassSelection(playerid);
  275. TogglePlayerSpectating(playerid, true);
  276. TogglePlayerSpectating(playerid, false);
  277. new INI:File = INI_Open(UserPath(playerid));
  278. INI_SetTag(File,"data");
  279. INI_WriteInt(File,"Job",true);
  280. INI_WriteInt(File,"money",pInfo[playerid][pMoney]);
  281. INI_Close(File);
  282. }
  283. }
  284.  
  285. return 1;
  286. }
  287.  
  288. public OnVehicleMod(playerid, vehicleid, componentid)
  289. {
  290. return 1;
  291. }
  292.  
  293. public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
  294. {
  295. return 1;
  296. }
  297.  
  298. public OnVehicleRespray(playerid, vehicleid, color1, color2)
  299. {
  300. return 1;
  301. }
  302.  
  303. public OnPlayerSelectedMenuRow(playerid, row)
  304. {
  305. return 1;
  306. }
  307.  
  308. public OnPlayerExitedMenu(playerid)
  309. {
  310. return 1;
  311. }
  312.  
  313. public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
  314. {
  315. return 1;
  316. }
  317.  
  318. public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
  319. {
  320. return 1;
  321. }
  322.  
  323. public OnRconLoginAttempt(ip[], password[], success)
  324. {
  325. return 1;
  326. }
  327.  
  328. public OnPlayerUpdate(playerid)
  329. {
  330. return 1;
  331. }
  332.  
  333. public OnPlayerStreamIn(playerid, forplayerid)
  334. {
  335. return 1;
  336. }
  337.  
  338. public OnPlayerStreamOut(playerid, forplayerid)
  339. {
  340. return 1;
  341. }
  342.  
  343. public OnVehicleStreamIn(vehicleid, forplayerid)
  344. {
  345. return 1;
  346. }
  347.  
  348. public OnVehicleStreamOut(vehicleid, forplayerid)
  349. {
  350. return 1;
  351. }
  352.  
  353. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  354. {
  355. return 1;
  356. }
  357.  
  358. public OnPlayerClickPlayer(playerid, clickedplayerid, source)
  359. {
  360. return 1;
  361. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement