Guest User

Untitled

a guest
Aug 13th, 2016
187
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.96 KB | None | 0 0
  1. PLAYER STATE CHANGE:
  2.  
  3. new vehicle, string[128];
  4. vehicle = GetPlayerVehicleID(playerid);
  5.  
  6. if(oldstate == PLAYER_STATE_ONFOOT && newstate == PLAYER_STATE_DRIVER) // Player entered a vehicle as a driver
  7. {
  8. new engine, lights, alarm, doors, bonnet, boot, objective;
  9. GetVehicleParamsEx(vehicle, engine, lights, alarm, doors, bonnet, boot, objective);
  10. if(IsARentVehicle(vehicle)) // Faggio Rent Vehicles (San Fierro Airport)
  11. {
  12. if(VehicleRentID[playerid] > 0)
  13. {
  14. ErrorMessage(playerid, "You are already renting a vehicle.");
  15. RemovePlayerFromVehicle(playerid);
  16. return 1;
  17. }
  18. for(new i = 0; i < MAX_PLAYERS; i++)
  19. {
  20. if(VehicleRentID[i] == vehicle)
  21. {
  22. format(string, sizeof(string), "%s is currently renting this Faggio.", GetName(i));
  23. InformationMessage(playerid, string);
  24. IsEngineRunning(playerid); // Performs a check to determine whether engine is running, followed by a message sent to the player.
  25. break;
  26. }
  27. else
  28. {
  29. format(string, sizeof(string), ""WHITE"You can rent this Faggio for "GREEN"$%d"WHITE".\nWould you like to rent it?", RentalPrice);
  30. ShowPlayerDialog(playerid, RentalDialog, DIALOG_STYLE_MSGBOX, ""YELLOW"Barrona Rental", string, "Rent", "Exit");
  31. break;
  32. }
  33. }
  34. }
  35. }
  36.  
  37. DIALOG RESPONSE:
  38.  
  39. case RentalDialog:
  40. {
  41. if(!response)
  42. {
  43. RemovePlayerFromVehicle(playerid);
  44. }
  45. else
  46. {
  47. if(Player[playerid][Cash] < RentalPrice)
  48. {
  49. ErrorMessage(playerid, "You don't have enough cash to rent this vehicle.");
  50. RemovePlayerFromVehicle(playerid);
  51. }
  52. else
  53. {
  54. GiveCash(playerid, -RentalPrice);
  55. VehicleRentID[playerid] = vehicle;
  56. InformationMessage(playerid, "You are now renting this Faggio.");
  57. }
  58. }
  59. }
Advertisement
Add Comment
Please, Sign In to add comment