Guest User

Untitled

a guest
Jul 23rd, 2014
250
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.11 KB | None | 0 0
  1. CMD:pvlock(playerid, params[])
  2. {
  3. new Float: x, Float: y, Float: z;
  4. if(PlayerInfo[playerid][pVehicleKeysFrom] != INVALID_PLAYER_ID)
  5. {
  6. new ownerid = PlayerInfo[playerid][pVehicleKeysFrom];
  7. if(IsPlayerConnected(ownerid))
  8. {
  9. new d = PlayerInfo[playerid][pVehicleKeys];
  10. if(PlayerVehicleInfo[ownerid][d][pvId] != INVALID_PLAYER_VEHICLE_ID) GetVehiclePos(PlayerVehicleInfo[ownerid][d][pvId], x, y, z);
  11. if(IsPlayerInRangeOfPoint(playerid, 3.0, x, y, z))
  12. {
  13. if(PlayerVehicleInfo[ownerid][d][pvLock] > 0)
  14. {
  15. if(PlayerVehicleInfo[ownerid][d][pvLocked] == 0)
  16. {
  17. GameTextForPlayer(playerid,"~r~Vehicle Locked!",5000,6);
  18. PlayerPlaySound(playerid, 1145, 0.0, 0.0, 0.0);
  19. PlayerVehicleInfo[ownerid][d][pvLocked] = 1;
  20. LockPlayerVehicle(ownerid, PlayerVehicleInfo[ownerid][d][pvId], PlayerVehicleInfo[ownerid][d][pvLock]);
  21. return 1;
  22. }
  23. else
  24. {
  25. GameTextForPlayer(playerid,"~g~Vehicle Unlocked!",5000,6);
  26. PlayerPlaySound(playerid, 1145, 0.0, 0.0, 0.0);
  27. PlayerVehicleInfo[ownerid][d][pvLocked] = 0;
  28. UnLockPlayerVehicle(ownerid, PlayerVehicleInfo[ownerid][d][pvId], PlayerVehicleInfo[ownerid][d][pvLock]);
  29. return 1;
  30. }
  31. }
  32. else
  33. {
  34. SendClientMessage(playerid, COLOR_GREY, " You don't have a lock system installed on this vehicle.");
  35. return 1;
  36. }
  37. }
  38. }
  39. }
  40. for(new d = 0 ; d < MAX_PLAYERVEHICLES; d++)
  41. {
  42. if(PlayerVehicleInfo[playerid][d][pvId] != INVALID_PLAYER_VEHICLE_ID) GetVehiclePos(PlayerVehicleInfo[playerid][d][pvId], x, y, z);
  43. if(IsPlayerInRangeOfPoint(playerid, 3.0, x, y, z))
  44. {
  45. if(PlayerVehicleInfo[playerid][d][pvLock] > 0 && PlayerVehicleInfo[playerid][d][pvLocked] == 0)
  46. {
  47. GameTextForPlayer(playerid,"~r~Vehicle Locked!",5000,6);
  48. PlayerPlaySound(playerid, 1145, 0.0, 0.0, 0.0);
  49. PlayerVehicleInfo[playerid][d][pvLocked] = 1;
  50. LockPlayerVehicle(playerid, PlayerVehicleInfo[playerid][d][pvId], PlayerVehicleInfo[playerid][d][pvLock]);
  51. return 1;
  52. }
  53. else if(PlayerVehicleInfo[playerid][d][pvLock] > 0 && PlayerVehicleInfo[playerid][d][pvLocked] == 1)
  54. {
  55. GameTextForPlayer(playerid,"~g~Vehicle Unlocked!",5000,6);
  56. PlayerPlaySound(playerid, 1145, 0.0, 0.0, 0.0);
  57. PlayerVehicleInfo[playerid][d][pvLocked] = 0;
  58. UnLockPlayerVehicle(playerid, PlayerVehicleInfo[playerid][d][pvId], PlayerVehicleInfo[playerid][d][pvLock]);
  59. return 1;
  60.  
  61. }
  62. SendClientMessage(playerid, COLOR_GREY, " You don't have a lock system installed on this vehicle.");
  63. return 1;
  64. }
  65. }
  66. SendClientMessage(playerid, COLOR_GREY, "You're not near any vehicle that you own.");
  67. return 1;
  68. }
  69.  
  70. //-------------------------------------------------------------------------------------------------//
  71. else if(dialogid == DIALOG_CDLOCKBUY)
  72. {
  73. if(response)
  74. {
  75. if(listitem == 0)
  76. {
  77. if(GetPlayerVehicleCount(playerid) != 0)
  78. {
  79. if(PlayerInfo[playerid][pCash] < BizInfo[PlayerInfo[playerid][InBusiness]][bProductsPrice11])
  80. {
  81. SendClientMessage(playerid, COLOR_GRAD2, " Not enough money!");
  82. return 1;
  83. }
  84. SetPVarInt(playerid, "lockmenu", 1);
  85. for(new i=0; i<MAX_PLAYERVEHICLES; i++)
  86. {
  87. if(PlayerVehicleInfo[playerid][i][pvId] != INVALID_PLAYER_VEHICLE_ID)
  88. {
  89. format(string, sizeof(string), "Vehicle %d| Name: %s.",i+1,GetVehicleName(PlayerVehicleInfo[playerid][i][pvId]));
  90. SendClientMessage(playerid, COLOR_WHITE, string);
  91. }
  92. }
  93. ShowPlayerDialogEx(playerid, DIALOG_CDLOCKMENU, DIALOG_STYLE_INPUT, "24-7;"," Select a vehicle you wish to install this on:", "Select", "Cancel");
  94.  
  95. }
  96. else
  97. {
  98. SendClientMessage(playerid, COLOR_WHITE, "You don't have any cars - where we can install this item?");
  99. return 1;
  100. }
  101. }
  102. if(listitem == 1)
  103. {
  104. if(GetPlayerVehicleCount(playerid) != 0)
  105. {
  106. if(PlayerInfo[playerid][pCash] < BizInfo[PlayerInfo[playerid][InBusiness]][bProductsPrice12])
  107. {
  108. SendClientMessage(playerid, COLOR_GRAD2, " Not enough money!");
  109. return 1;
  110. }
  111. SetPVarInt(playerid, "lockmenu", 2);
  112. for(new i=0; i<MAX_PLAYERVEHICLES; i++)
  113. {
  114. if(PlayerVehicleInfo[playerid][i][pvId] != INVALID_PLAYER_VEHICLE_ID)
  115. {
  116. format(string, sizeof(string), "Vehicle %d | Name: %s.",i+1,GetVehicleName(PlayerVehicleInfo[playerid][i][pvId]));
  117. SendClientMessage(playerid, COLOR_WHITE, string);
  118. }
  119. }
  120. ShowPlayerDialogEx(playerid, DIALOG_CDLOCKMENU, DIALOG_STYLE_INPUT, "24-7;"," Select a vehicle you wish to install this on:", "Select", "Cancel");
  121. }
  122. else
  123. {
  124. SendClientMessage(playerid, COLOR_WHITE, "You don't have any cars - where we can install this item?");
  125. return 1;
  126. }
  127. }
  128. }
  129. }
  130. if(dialogid == DIALOG_CDLOCKMENU)
  131. {
  132. new idx = PlayerInfo[playerid][InBusiness];
  133. if(response) {
  134. if(GetPVarInt(playerid, "lockmenu") == 1) {
  135. new pvid;
  136. if(IsNumeric(inputtext)) {
  137. pvid = strval(inputtext)-1;
  138. if(PlayerVehicleInfo[playerid][pvid][pvId] == INVALID_PLAYER_VEHICLE_ID)
  139. {
  140. SendClientMessage(playerid, COLOR_GRAD4, "ERROR: You don't have a vehicle in this slot.");
  141. SetPVarInt(playerid, "lockmenu", 0);
  142. return 1;
  143. }
  144. if(PlayerVehicleInfo[playerid][pvid][pvLock] == 1)
  145. {
  146. SendClientMessage(playerid, COLOR_GRAD4, "ERROR: You already have this item installed on this vehicle.");
  147. SetPVarInt(playerid, "lockmenu", 0);
  148. return 1;
  149. }
  150. format(string, sizeof(string), " You have purchased an alarm lock!");
  151. SendClientMessage(playerid, COLOR_GRAD4, string);
  152. SendClientMessage(playerid, COLOR_YELLOW, "HINT: You can now use /pvlock to lock your car.");
  153. PlayerInfo[playerid][pCash] -= BizInfo[PlayerInfo[playerid][InBusiness]][bProductsPrice11];
  154. BizInfo[idx][bMoney] += BizInfo[PlayerInfo[playerid][InBusiness]][bProductsPrice11];
  155. BizInfo[idx][bSupplies] --;
  156. PlayerVehicleInfo[playerid][pvid][pvLock] = 1;
  157. SetPVarInt(playerid, "lockmenu", 0);
  158. }
  159. }
  160. else if(GetPVarInt(playerid, "lockmenu") == 2)
  161. {
  162. new pvid;
  163. if(IsNumeric(inputtext))
  164. {
  165. pvid = strval(inputtext)-1;
  166. if(PlayerVehicleInfo[playerid][pvid][pvId] == INVALID_PLAYER_VEHICLE_ID)
  167. {
  168. SendClientMessage(playerid, COLOR_GRAD4, "ERROR: You don't have a vehicle in this slot.");
  169. SetPVarInt(playerid, "lockmenu", 0);
  170. return 1;
  171. }
  172. if(PlayerVehicleInfo[playerid][pvid][pvLock] == 2)
  173. {
  174. SendClientMessage(playerid, COLOR_GRAD4, "ERROR: You already have this item installed on this vehicle.");
  175. SetPVarInt(playerid, "lockmenu", 0);
  176. return 1;
  177. }
  178. format(string, sizeof(string), " You have Purchased an industrial lock!");
  179. SendClientMessage(playerid, COLOR_GRAD4, string);
  180. SendClientMessage(playerid, COLOR_YELLOW, "HINT: You can now use /pvlock to lock your car.");
  181. PlayerInfo[playerid][pCash] -= BizInfo[PlayerInfo[playerid][InBusiness]][bProductsPrice12];
  182. BizInfo[idx][bMoney] += BizInfo[PlayerInfo[playerid][InBusiness]][bProductsPrice12];
  183. BizInfo[idx][bSupplies] --;
  184. PlayerVehicleInfo[playerid][pvid][pvLock] = 2;
  185. SetPVarInt(playerid, "lockmenu", 0);
  186. }
  187. }
  188. }
  189. }
  190. //----------------------------------------------------------------------//
  191. LockPlayerVehicle(ownerid, carid, type)
  192. {
  193. new v = GetPlayerVehicle(ownerid, carid);
  194. if(PlayerVehicleInfo[ownerid][v][pvId] == carid && type == 2)
  195. {
  196. LockStatus[carid] = 1;
  197. vehicle_lock_doors(carid);
  198. }
  199. }
  200.  
  201. UnLockPlayerVehicle(ownerid, carid, type)
  202. {
  203. new v = GetPlayerVehicle(ownerid, carid);
  204. if(PlayerVehicleInfo[ownerid][v][pvId] == carid && type == 2)
  205. {
  206. LockStatus[carid] = 0;
  207. vehicle_unlock_doors(carid);
  208. }
  209. }
  210.  
  211. forward DisableVehicleAlarm(vehicleid);
  212. public DisableVehicleAlarm(vehicleid)
  213. {
  214. GetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,bonnet,boot,objective);
  215. SetVehicleParamsEx(vehicleid,engine,lights,VEHICLE_PARAMS_OFF,doors,bonnet,boot,objective);
  216. return 1;
  217. }
  218.  
  219. forward ReleasePlayer(playerid);
  220. public ReleasePlayer(playerid)
  221. {
  222. SetPVarInt(playerid, "IsFrozen", 0);
  223. TogglePlayerControllable(playerid,1);
  224. }
Advertisement
Add Comment
Please, Sign In to add comment