legodude

legodude

Jul 12th, 2010
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 2.83 KB | None | 0 0
  1. #define FILTERSCRIPT
  2. #include <a_samp>
  3.  
  4. //defines
  5. #define MAX_SOLAR_CARS 100
  6. #define COLOR_SOLAR_MESSAGE 0xFEF280AA
  7. //edit below only if you know what you are doing
  8. //in CreateSolarVehicle the solarid must be unique!!! it must also be under MAX_SOLAR_CARS
  9. //max solar power is 1,000,000
  10. new SolarCar[MAX_SOLAR_CARS];
  11. new SolarCarEnergy[MAX_VEHICLES];
  12. new vehid;
  13. forward energyslorp(vehicleid);
  14. public OnFilterScriptInit()
  15. {
  16.     print("\n--------------------------------------");
  17.     print(" Blank Filterscript by your name here");
  18.     print("--------------------------------------\n");
  19.     return 1;
  20. }
  21.  
  22. public OnFilterScriptExit()
  23. {
  24.     return 1;
  25. }
  26.  
  27.  
  28. public OnVehicleSpawn(vehicleid)
  29. {
  30.     SetSolarCarPower(vehicleid,1000000);
  31.     return 1;
  32. }
  33.  
  34. public OnVehicleDeath(vehicleid, killerid)
  35. {
  36.     SetSolarCarPower(vehid,0);
  37.     return 1;
  38. }
  39.  
  40. public OnPlayerCommandText(playerid, cmdtext[])
  41. {
  42.     if (strcmp("/solarcar", cmdtext, true, 10) == 0)
  43.     {
  44.         new Float:x, Float:y, Float:z, Float:rot;
  45.         GetPlayerPos(playerid,x,y,z);
  46.         GetPlayerFacingAngle(playerid, rot);
  47.         new solarveh = CreateSolarVehicle(1,411, x, y, z, rot, 1, 0, 50);
  48.         PutPlayerInVehicle(playerid, solarveh, 0);
  49.         return 1;
  50.     }
  51.     if (strcmp("/energy", cmdtext, true, 10) == 0)
  52.     {
  53.         new string[64];
  54.         format(string,sizeof(string),"the energy of your car is: %i",GetSolarCarPower(vehid));
  55.         SendClientMessage(playerid,COLOR_SOLAR_MESSAGE,string);
  56.         return 1;
  57.     }
  58.     if (strcmp("/setenergy", cmdtext, true, 10) == 0)
  59.     {
  60.         SetSolarCarPower(vehid,1000000);
  61.         new string[64];
  62.         format(string,sizeof(string),"the energy of your car is: %i",GetSolarCarPower(vehid));
  63.         SendClientMessage(playerid,COLOR_SOLAR_MESSAGE,string);
  64.         return 1;
  65.     }
  66.     return 0;
  67. }
  68.  
  69. public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
  70. {
  71.     vehid = vehicleid;
  72.     return 1;
  73. }
  74.  
  75. public OnPlayerExitVehicle(playerid, vehicleid)
  76. {
  77.     return 1;
  78. }
  79.  
  80. public OnPlayerStateChange(playerid, newstate, oldstate)
  81. {
  82.     if(newstate==PLAYER_STATE_DRIVER)
  83.     {
  84.         if(IsSolarVehicle(vehid))
  85.         {
  86.             SendClientMessage(playerid, COLOR_SOLAR_MESSAGE, "You entered a solar vehicle, remind it needs the sun to drive!!");
  87.  
  88.         }
  89.     }
  90.     return 1;
  91. }
  92.  
  93. CreateSolarVehicle(solarid,vehiclemodel, Float:x, Float:y, Float:z, Float:rotation, color1, color2, respawn_delay)
  94. {
  95.     if(solarid>MAX_SOLAR_CARS)
  96.     {
  97.         return 0;
  98.     }
  99.     else
  100.     {
  101.         SolarCar[solarid]=CreateVehicle(vehiclemodel, x, y, z, rotation, color1, color2, respawn_delay);
  102.     }
  103.     return 1;
  104. }
  105. IsSolarVehicle(vehicleid)
  106. {
  107.     for(new s;s<=MAX_SOLAR_CARS;s++)
  108.     if(vehicleid==SolarCar[s])
  109.     {
  110.     return 1;
  111.     }
  112.     return 0;
  113. }
  114. SetSolarCarPower(vehicleid,power)
  115. {
  116.     if(IsSolarVehicle(vehicleid))
  117.     {
  118.     SolarCarEnergy[vehicleid] = power;
  119.     }
  120.     return 1;
  121. }
  122. GetSolarCarPower(vehicleid)
  123. {
  124.     if(IsSolarVehicle(vehicleid))
  125.     {
  126.     return SolarCarEnergy[vehicleid];
  127.     }
  128.     return 0;
  129. }
Add Comment
Please, Sign In to add comment