Guest User

Untitled

a guest
Apr 21st, 2013
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.63 KB | None | 0 0
  1. enum pHaul
  2. {
  3. pCapasity,
  4. pLoad,
  5. };
  6.  
  7.  
  8. }
  9. else if(IsATruck(newcar))
  10. {
  11. if(PlayerInfo[playerid][pJob] == 16)
  12. {
  13. format(string, sizeof(string), "Products: %d/%d", PlayerHaul[newcar][pLoad],PlayerHaul[newcar][pCapasity]);
  14. SendClientMessage(playerid, TEAM_GROVE_COLOR, string);
  15. SendClientMessage(playerid, COLOR_WHITE, "INFO: You can deliver Products to Businesses.");
  16. SendClientMessage(playerid, COLOR_WHITE, "INFO: Commands are /load /buyprods /sellprods");
  17. }
  18.  
  19.  
  20. This is OnGameModeInit:
  21.  
  22. PlayerHaul[82][pCapasity] = 100;
  23. PlayerHaul[83][pCapasity] = 100;
  24. PlayerHaul[108][pCapasity] = 100;
  25. PlayerHaul[109][pCapasity] = 100;
  26. PlayerHaul[110][pCapasity] = 50;
  27. PlayerHaul[111][pCapasity] = 50;
  28.  
  29.  
  30. After Vehicles:
  31.  
  32. }
  33. for(new i = 0; i < MAX_VEHICLES; i ++)
  34. {
  35. if(IsATruck(i))
  36. {
  37. PlayerHaul[i][pCapasity] = 100;
  38. }
  39.  
  40.  
  41. }
  42.  
  43. if(strcmp(cmd, "/load", true) == 0)
  44. {
  45. if(IsPlayerConnected(playerid))
  46. {
  47. new tmpcar = GetPlayerVehicleID(playerid);
  48. if(!IsATruck(tmpcar))
  49. {
  50. GameTextForPlayer(playerid, "~r~You are not in a delivery truck", 5000, 1);
  51. return 1;
  52. }
  53. format(string, sizeof(string), "Products: %d/%d.", PlayerHaul[tmpcar][pLoad],PlayerHaul[tmpcar][pCapasity]);
  54. SendClientMessage(playerid, TEAM_GROVE_COLOR, string);
  55. }
  56. return 1;
  57. }
  58.  
  59. if(strcmp(cmd, "/buyprods", true) == 0)
  60. {
  61. if(IsPlayerConnected(playerid))
  62. {
  63. new tmpcar = GetPlayerVehicleID(playerid);
  64. new compcost = 20;
  65. if(IsPlayerInRangeOfPoint(playerid, 70, 2468.4919,-2092.9902,13.5469))
  66. {
  67. if(IsATruck(tmpcar))
  68. {
  69. if(PlayerHaul[tmpcar][pLoad] < PlayerHaul[tmpcar][pCapasity])
  70. {
  71. new amount;
  72. tmp = strtok(cmdtext, idx);
  73. if(!strlen(tmp))
  74. {
  75. SendClientMessage(playerid, COLOR_GRAD1, "Koristite: /buyprods [amount]");
  76. return 1;
  77. }
  78. amount = strval(tmp);
  79. if(amount < 1 || amount > 100) { SendClientMessage(playerid, COLOR_GREY, " Can't buy less then 1 Product or more then 100!"); return 1; }
  80. new check= PlayerHaul[tmpcar][pLoad] + amount;
  81. if(check > PlayerHaul[tmpcar][pCapasity])
  82. {
  83. format(string, sizeof(string), " You went over the Truck Products Carry Limit of %d, you currently carry %d.",PlayerHaul[tmpcar][pCapasity],PlayerHaul[tmpcar][pLoad]);
  84. SendClientMessage(playerid, COLOR_GREY, string);
  85. return 1;
  86. }
  87. new cost = amount*compcost;
  88. if(JBC_GetPlayerMoney(playerid) >= cost)
  89. {
  90. PlayerHaul[tmpcar][pLoad] += amount;
  91. format(string, sizeof(string), "Products: %d/%d.", PlayerHaul[tmpcar][pLoad],PlayerHaul[tmpcar][pCapasity]);
  92. SendClientMessage(playerid, TEAM_GROVE_COLOR, string);
  93. format(string, sizeof(string), "You bought %d Products for $%d.", amount,cost);
  94. SendClientMessage(playerid, TEAM_GROVE_COLOR, string);
  95. JBC_GivePlayerMoney(playerid,-cost);
  96. SBizzInfo[8][sbTill] += cost;
  97. PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
  98. return 1;
  99. }
  100. else
  101. {
  102. format(string, sizeof(string), "You cant afford %d Products at $%d!", amount,cost);
  103. SendClientMessage(playerid, TEAM_GROVE_COLOR, string);
  104. return 1;
  105. }
  106. }
  107. else
  108. {
  109. format(string, sizeof(string), "Products: %d/%d.", PlayerHaul[tmpcar][pLoad],PlayerHaul[tmpcar][pCapasity]);
  110. SendClientMessage(playerid, TEAM_GROVE_COLOR, string);
  111. return 1;
  112. }
  113. }
  114. else
  115. {
  116. SendClientMessage(playerid, TEAM_GROVE_COLOR, "This Vehicle does not deliver Products.");
  117. return 1;
  118. }
  119. }
  120. else
  121. {
  122. SendClientMessage(playerid, COLOR_GREY, "You are not in trucker place.");
  123. return 1;
  124. }
  125. }
  126. return 1;
  127. }
  128.  
  129. if(strcmp(cmd, "/sellprods", true) == 0)
  130. {
  131. new cashmade;
  132. new tmpcar;
  133. if(IsPlayerConnected(playerid))
  134. {
  135. tmpcar = GetPlayerVehicleID(playerid);
  136. if(!IsATruck(tmpcar))
  137. {
  138. GameTextForPlayer(playerid, "~r~You are not in a delivery truck", 5000, 1);
  139. return 1;
  140. }
  141. if(PlayerHaul[tmpcar][pLoad] == 0)
  142. {
  143. GameTextForPlayer(playerid, "~r~Truck is empty, return to the stock house", 5000, 1);
  144. format(string, sizeof(string), "Products: %d/%d.", PlayerHaul[tmpcar][pLoad],PlayerHaul[tmpcar][pCapasity]);
  145. SendClientMessage(playerid, TEAM_GROVE_COLOR, string);
  146. return 1;
  147. }
  148. for(new i = 0; i < sizeof(BizzInfo); i++)
  149. {
  150. if (IsPlayerInRangeOfPoint(playerid, 10,BizzInfo[i][bEntranceX], BizzInfo[i][bEntranceY], BizzInfo[i][bEntranceZ]))
  151. {
  152. //printf("Found House :%d",i);
  153. for(new l = PlayerHaul[tmpcar][pLoad]; l > 0; l--)
  154. {
  155. if(BizzInfo[i][bProducts] == BizzInfo[i][bMaxProducts])
  156. {
  157. GameTextForPlayer(playerid, "~r~Our stores are full", 5000, 1);
  158. format(string, sizeof(string), "Cash Earned $%d.", cashmade);
  159. SendClientMessage(playerid, TEAM_GROVE_COLOR, string);
  160. format(string, sizeof(string), "Products: %d/%d.", PlayerHaul[tmpcar][pLoad],PlayerHaul[tmpcar][pCapasity]);
  161. SendClientMessage(playerid, TEAM_GROVE_COLOR, string);
  162. PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
  163. return 1;
  164. }
  165. if(BizzInfo[i][bPriceProd] > BizzInfo[i][bTill])
  166. {
  167. GameTextForPlayer(playerid, "~r~We Cant Afford The Deal", 5000, 1);
  168. format(string, sizeof(string), "Cash Earned $%d.", cashmade);
  169. SendClientMessage(playerid, TEAM_GROVE_COLOR, string);
  170. format(string, sizeof(string), "Products: %d/%d.", PlayerHaul[tmpcar][pLoad],PlayerHaul[tmpcar][pCapasity]);
  171. SendClientMessage(playerid, TEAM_GROVE_COLOR, string);
  172. PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
  173. return 1;
  174. }
  175. PlayerHaul[tmpcar][pLoad]--;
  176. BizzInfo[i][bProducts]++;
  177. cashmade = cashmade+BizzInfo[i][bPriceProd];
  178. //ConsumingMoney[playerid] = 1;
  179. JBC_GivePlayerMoney(playerid,BizzInfo[i][bPriceProd]);
  180. BizzInfo[i][bTill] -= BizzInfo[i][bPriceProd];
  181. if(PlayerHaul[tmpcar][pLoad] == 0)
  182. {
  183. GameTextForPlayer(playerid, "~r~Truck is empty, return to the stock house", 5000, 1);
  184. format(string, sizeof(string), "Cash Earned $%d.", cashmade);
  185. SendClientMessage(playerid, TEAM_GROVE_COLOR, string);
  186. format(string, sizeof(string), "Products: %d/%d.", PlayerHaul[tmpcar][pLoad],PlayerHaul[tmpcar][pCapasity]);
  187. SendClientMessage(playerid, TEAM_GROVE_COLOR, string);
  188. PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
  189. return 1;
  190. }
  191. }
  192. OnPropUpdate(3);
  193. return 1;
  194. }
  195. }
  196. }
  197. for(new i = 0; i < sizeof(SBizzInfo); i++)
  198. {
  199. if (IsPlayerInRangeOfPoint(playerid, 10,SBizzInfo[i][sbEntranceX], SBizzInfo[i][sbEntranceY], SBizzInfo[i][sbEntranceZ]))
  200. {
  201. //printf("Found House :%d",i);
  202. for(new l = PlayerHaul[tmpcar][pLoad]; l > 0; l--)
  203. {
  204. if(SBizzInfo[i][sbProducts] == SBizzInfo[i][sbMaxProducts])
  205. {
  206. GameTextForPlayer(playerid, "~r~Our stores are full", 5000, 1);
  207. format(string, sizeof(string), "Cash Earned $%d.", cashmade);
  208. SendClientMessage(playerid, TEAM_GROVE_COLOR, string);
  209. format(string, sizeof(string), "Products: %d/%d.", PlayerHaul[tmpcar][pLoad],PlayerHaul[tmpcar][pCapasity]);
  210. SendClientMessage(playerid, TEAM_GROVE_COLOR, string);
  211. return 1;
  212. }
  213. if(SBizzInfo[i][sbPriceProd] > SBizzInfo[i][sbTill])
  214. {
  215. GameTextForPlayer(playerid, "~r~We Cant Afford The Deal", 5000, 1);
  216. format(string, sizeof(string), "Cash Earned $%d.", cashmade);
  217. SendClientMessage(playerid, TEAM_GROVE_COLOR, string);
  218. format(string, sizeof(string), "Products: %d/%d.", PlayerHaul[tmpcar][pLoad],PlayerHaul[tmpcar][pCapasity]);
  219. SendClientMessage(playerid, TEAM_GROVE_COLOR, string);
  220. return 1;
  221. }
  222. PlayerHaul[tmpcar][pLoad]--;
  223. SBizzInfo[i][sbProducts]++;
  224. cashmade = cashmade+SBizzInfo[i][sbPriceProd];
  225. //ConsumingMoney[playerid] = 1;
  226. JBC_GivePlayerMoney(playerid,SBizzInfo[i][sbPriceProd]);
  227. SBizzInfo[i][sbTill] -= SBizzInfo[i][sbPriceProd];
  228. if(PlayerHaul[tmpcar][pLoad] == 0)
  229. {
  230. GameTextForPlayer(playerid, "~r~Truck is empty, return to the stock house", 5000, 1);
  231. format(string, sizeof(string), "Cash Earned $%d.", cashmade);
  232. SendClientMessage(playerid, TEAM_GROVE_COLOR, string);
  233. format(string, sizeof(string), "Products: %d/%d.", PlayerHaul[tmpcar][pLoad],PlayerHaul[tmpcar][pCapasity]);
  234. SendClientMessage(playerid, TEAM_GROVE_COLOR, string);
  235. return 1;
  236. }
  237. }
  238. OnPropUpdate(3);
  239. return 1;
  240. }
  241. }
  242. GameTextForPlayer(playerid, "~r~To Far From A Business", 5000, 1);
  243. return 1;
Advertisement
Add Comment
Please, Sign In to add comment