Advertisement
Guest User

LumberJack Script

a guest
Oct 28th, 2012
6,853
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.68 KB | None | 0 0
  1. // LumberJack Job Made By Me.
  2. // I Hope You'll Leave Credits...
  3. // If Not Go Fuck You're Self...
  4. // This Is MySql =)
  5. // I Hope You'll Like It!
  6. #include <a_samp>
  7. #include <a_mysql>
  8. #define COLOR_ORANGE 0xFFA500FF
  9. #define COLOR_SYSTEM 0xFFFFFFFF
  10. #define COLOR_YELLOW3d 0xFFFF00FF
  11. forward TimeDrov(playerid);
  12. new Text3D:cutterd;
  13. new cutt;
  14. new bool:startjobd[MAX_PLAYERS];
  15. new bool:woodcutter[MAX_PLAYERS];
  16. new timecutt[MAX_PLAYERS];
  17. new Oldskin[MAX_PLAYERS];
  18. new kgcutt[MAX_PLAYERS];
  19. new cuttrands;
  20. new pickcutt;
  21. new randomcutt[][1] = {
  22. {25},{27},{29},{28},{33},{30},{35},{32},{37},{41},{36},
  23. {42},{47},{52},{39},{40},{53},{54},{43},{44},{45}
  24. };
  25.  
  26. public OnFilterScriptInit()
  27. {
  28. mysql_connect("localhost" , "root", "src", "123321");
  29. new texts[56];
  30. CreateObject(18259,-1897.80004883,-1971.00000000,86.59999847,0.00000000,0.00000000,0.00000000); //object(logcabinn01) (2)
  31. CreateObject(1463,-1892.90002441,-1984.69995117,85.50000000,0.00000000,0.00000000,0.00000000); //object(dyn_woodpile2) (1)
  32. CreateObject(1463,-1894.19995117,-1983.09997559,85.50000000,0.00000000,0.00000000,0.00000000); //object(dyn_woodpile2) (2)
  33. CreateObject(1463,-1892.40002441,-1981.00000000,85.50000000,0.00000000,0.00000000,0.00000000); //object(dyn_woodpile2) (3)
  34. CreateObject(1463,-1894.09997559,-1981.40002441,85.50000000,0.00000000,0.00000000,0.00000000); //object(dyn_woodpile2) (4)
  35. CreateObject(1463,-1892.30004883,-1982.40002441,85.50000000,0.00000000,0.00000000,0.00000000); //object(dyn_woodpile2) (5)
  36. CreateObject(1463,-1894.00000000,-1982.09997559,85.80000305,0.00000000,0.00000000,0.00000000); //object(dyn_woodpile2) (6)
  37. CreateObject(1463,-1892.40002441,-1981.59997559,85.80000305,0.00000000,0.00000000,0.00000000); //object(dyn_woodpile2) (7)
  38. CreateObject(1463,-1893.80004883,-1981.80004883,86.40000153,0.00000000,0.00000000,0.00000000); //object(dyn_woodpile2) (8)
  39. CreateObject(1463,-1894.19995117,-1982.69995117,86.09999847,0.00000000,0.00000000,0.00000000); //object(dyn_woodpile2) (9)
  40. CreateObject(1463,-1891.19995117,-1984.00000000,85.50000000,0.00000000,0.00000000,0.00000000); //object(dyn_woodpile2) (10)
  41. CreateObject(1463,-1894.90002441,-1984.90002441,85.50000000,0.00000000,0.00000000,0.00000000); //object(dyn_woodpile2) (11)
  42. CreateObject(14872,-1890.09997559,-1979.19995117,85.69999695,0.00000000,0.00000000,0.00000000); //object(kylie_logs) (1)
  43. CreateObject(14872,-1892.09997559,-2013.30004883,78.80000305,0.00000000,0.00000000,0.00000000); //object(kylie_logs) (2)
  44. CreateObject(14872,-1868.80004883,-2016.80004883,77.50000000,0.00000000,0.00000000,0.00000000); //object(kylie_logs) (3)
  45. CreateObject(848,-1872.30004883,-2005.09997559,82.40000153,0.00000000,0.00000000,0.00000000); //object(dead_tree_20) (1)
  46. CreateObject(684,-1888.40002441,-1973.19995117,85.69999695,3.00000000,0.00000000,0.00000000); //object(sm_fir_log02) (1)
  47. CreateObject(846,-1892.00000000,-2019.80004883,77.00000000,17.50000000,0.00000000,0.00000000); //object(dead_tree_18) (1)
  48. CreateObject(842,-1898.30004883,-1982.00000000,85.40000153,0.00000000,0.00000000,0.00000000); //object(dead_tree_14) (1)
  49. CreateObject(834,-1882.90002441,-2009.50000000,81.69999695,0.00000000,0.00000000,0.00000000); //object(dead_tree_7) (1)
  50. CreateObject(831,-1883.59997559,-1993.90002441,83.40000153,0.00000000,0.00000000,0.00000000); //object(dead_tree_5) (1)
  51. CreateObject(831,-1917.90002441,-1904.50000000,86.19999695,0.00000000,0.00000000,0.00000000); //object(dead_tree_5) (2)
  52. CreateObject(831,-1905.50000000,-1889.30004883,86.19999695,0.00000000,0.00000000,250.00000000); //object(dead_tree_5) (3)
  53. pickcutt = CreatePickup(1275,23,-1904.40002441,-1979.30004883,87.80000305);
  54. Create3DTextLabel("Inventory is empty", 0xFFA500FF, -1889.9906,-1976.1985,86.3198, 40.0, 0, 0);
  55. return 1;
  56. }
  57. public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
  58. {
  59. if(startjobd[playerid] == true)
  60. {
  61. if(newkeys == KEY_JUMP || newkeys == KEY_FIRE || KEY_CROUCH || KEY_SECONDARY_ATTACK)
  62. {
  63. DisablePlayerCheckpoint(playerid);
  64. RemovePlayerAttachedObject(playerid,1);
  65. ApplyAnimation(playerid,"PED","IDLE_tired",4.1,0,1,1,0,1);
  66. SendClientMessage(playerid,0xAFAFAFAA," you drop the timber");
  67. SetPlayerCheckpoint(playerid, -1898.4493,-2008.8124,80.6425,1.0);
  68. }
  69. }
  70. return 1;
  71. }
  72. public OnPlayerPickUpPickup(playerid, pickupid)
  73. {
  74. if(pickupid == pickcutt)
  75. {
  76. if(woodcutter[playerid] == true) ShowPlayerDialog(playerid,9999,DIALOG_STYLE_MSGBOX,"Operation Lumberjack","{EEADDF}>>{FFFFFF}You really want to finish the job?","Yes","No");
  77. else ShowPlayerDialog ( playerid, 999 , DIALOG_STYLE_MSGBOX, "Operation Lumberjack" , "{} >> EEADDF {FFFFFF} You want to start a woodcutter?" , "Yes" , "No" ) ;
  78. }
  79. return 1;
  80. }
  81. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  82. {
  83. new string[256];
  84. switch(dialogid)
  85. {
  86. case 999:
  87. {
  88. if(response)
  89. {
  90. if ( IsPlayerAttachedObjectSlotUsed ( playerid, 1 ) ) RemovePlayerAttachedObject ( playerid, 1 ) , // pick pickaxe
  91. woodcutter[playerid] = true;// work started
  92. Oldskin[playerid] = GetPlayerSkin(playerid);// grean triangle for the skin
  93. SetPlayerSkin(playerid, 133);//put the skin on hard workers
  94. SetPlayerCheckpoint(playerid,-1898.4493,-2008.8124,80.6425,1.0);// Put the checkpoint
  95. SendClientMessage(playerid, COLOR_SYSTEM, "{EEADDF}>>{FFFFFF}You Started WoodMan!");
  96. SendClientMessage(playerid, COLOR_SYSTEM, "{EEADDF}>>{FFFFFF}on your map marked checkpoint");
  97. SendClientMessage(playerid, COLOR_SYSTEM, "{EEADDF}>>{FFFFFF}Go to him to start logging");
  98. ApplyAnimation(playerid,"CHAINSAW","WEAPON_csaw",4.1,1,0,0,0,1);
  99. ClearAnimations(playerid);
  100. }
  101. }
  102. case 9999:
  103. {
  104. if(response)
  105. {
  106. woodcutter[playerid] = false;// player is not woodcutter
  107. SetPlayerSkin(playerid,Oldskin[playerid]);// Put the old skin
  108. DisablePlayerCheckpoint(playerid);// Harvesting emergency.
  109. GivePlayerMoney(playerid, kgcutt[playerid]/2);
  110. format(string, sizeof(string), "{EEADDF}>>{FFFFFF}You earned% d $% d for cutting hardwood",kgcutt[playerid]/2,kgcutt[playerid]);
  111. SendClientMessage(playerid, COLOR_SYSTEM, string);
  112. kgcutt[playerid] = 0;
  113. if(IsPlayerAttachedObjectSlotUsed(playerid,1)) RemovePlayerAttachedObject(playerid,1);
  114. if(IsPlayerAttachedObjectSlotUsed(playerid,2)) RemovePlayerAttachedObject(playerid,2);// took a wheelballer
  115. if(IsPlayerAttachedObjectSlotUsed(playerid,3)) RemovePlayerAttachedObject(playerid,3);// ^^
  116. }
  117. }
  118. }
  119. return 1;
  120. }
  121.  
  122. public OnPlayerEnterCheckpoint(playerid)
  123. {
  124. new string[128];
  125. ClearAnimations(playerid);
  126. ApplyAnimation(playerid,"CARRY","crry_prtial",4.0,1,0,0,1,1,1);
  127. if(IsPlayerInRangeOfPoint(playerid, 6.0, -1898.4493,-2008.8124,80.6425))
  128. {
  129. startjobd[playerid] = true;
  130. ApplyAnimation(playerid,"CHAINSAW","WEAPON_csaw",4.1,1,0,0,0,11000);
  131. GivePlayerWeapon(playerid, 9, 1);
  132. DisablePlayerCheckpoint(playerid);
  133. timecutt[playerid] = SetTimerEx("TimeDrov",9800,false,"i", playerid);
  134. return 1;
  135. }
  136. else if(IsPlayerInRangeOfPoint(playerid, 3.0, -1896.6873,-1984.3062,86.1669) && GetPlayerState(playerid) == PLAYER_STATE_ONFOOT)
  137. {
  138. startjobd[playerid] = false;
  139. cuttrands = random(sizeof(randomcutt));
  140. kgcutt[playerid] += randomcutt[cuttrands][0];
  141. if(IsPlayerAttachedObjectSlotUsed(playerid,1)) RemovePlayerAttachedObject(playerid,1);//
  142. if(IsPlayerAttachedObjectSlotUsed(playerid,3)) RemovePlayerAttachedObject(playerid,3);//
  143. format(string, sizeof(string), "The total number of hardwood %d",kgcutt[playerid]);
  144. SendClientMessage(playerid, -1, string);
  145. format(string, sizeof(string), "You cut down hardwood %d ",randomcutt[cuttrands][0]);
  146. SendClientMessage(playerid, -1, string);
  147. // cutter+=randomcutt[cuttrands][0];
  148. cutt+=randomcutt[cuttrands][0];
  149. cutt ++;
  150. ApplyAnimation(playerid,"PED","IDLE_tired",4.1,1,0,0,0,2500);
  151. SetPlayerCheckpoint(playerid, -1898.4493,-2008.8124,80.6425,1.0);
  152. UpdateMine();
  153. return 1;
  154. }
  155. return 1;
  156. }
  157. public TimeDrov(playerid)
  158. {
  159. if(startjobd[playerid] == true)
  160. {
  161. ResetPlayerWeapons(playerid);
  162. SetPlayerAttachedObject(playerid, 1, 1463, 1,0.20,0.36,0.0,0.0,90.0, 0.0, 0.4, 0.3, 0.6);
  163. ApplyAnimation(playerid,"CARRY","crry_prtial",4.0,1,0,0,1,1,1);
  164. SetPlayerCheckpoint(playerid,-1896.6873,-1984.3062,86.1669,1.0);
  165. }
  166. return 1;
  167. }
  168. public OnPlayerDisconnect(playerid)
  169. {
  170. woodcutter[playerid] = false;//
  171. return 1;
  172. }
  173. UpdateMine()
  174. {
  175. new string[56];
  176. format(string,sizeof(string),"In Stock:\n %d Wood",cutt);
  177. Update3DTextLabelText(cutterd, COLOR_YELLOW3d, string);
  178. SaveMine();
  179. return 1;
  180. }
  181. stock SaveMine()
  182. {
  183. new ok[200];
  184. format(ok,sizeof(ok),"INSERT INTO mine (cutt) VALUES (%d)", cutt);
  185. mysql_query(ok);
  186. return 1;
  187. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement