Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define FILTERSCRIPT
- #include <a_samp>
- //defines
- #define MAX_SOLAR_CARS 100
- #define COLOR_SOLAR_MESSAGE 0xFEF280AA
- //edit below only if you know what you are doing
- //in CreateSolarVehicle the solarid must be unique!!! it must also be under MAX_SOLAR_CARS
- //max solar power is 1,000,000
- new SolarCar[MAX_SOLAR_CARS];
- new SolarCarEnergy[MAX_VEHICLES];
- new vehid;
- forward energyslorp(vehicleid);
- public OnFilterScriptInit()
- {
- print("\n--------------------------------------");
- print(" Blank Filterscript by your name here");
- print("--------------------------------------\n");
- return 1;
- }
- public OnFilterScriptExit()
- {
- return 1;
- }
- public OnVehicleSpawn(vehicleid)
- {
- SetSolarCarPower(vehicleid,1000000);
- return 1;
- }
- public OnVehicleDeath(vehicleid, killerid)
- {
- SetSolarCarPower(vehid,0);
- return 1;
- }
- public OnPlayerCommandText(playerid, cmdtext[])
- {
- if (strcmp("/solarcar", cmdtext, true, 10) == 0)
- {
- new Float:x, Float:y, Float:z, Float:rot;
- GetPlayerPos(playerid,x,y,z);
- GetPlayerFacingAngle(playerid, rot);
- new solarveh = CreateSolarVehicle(1,411, x, y, z, rot, 1, 0, 50);
- PutPlayerInVehicle(playerid, solarveh, 0);
- return 1;
- }
- if (strcmp("/energy", cmdtext, true, 10) == 0)
- {
- new string[64];
- format(string,sizeof(string),"the energy of your car is: %i",GetSolarCarPower(vehid));
- SendClientMessage(playerid,COLOR_SOLAR_MESSAGE,string);
- return 1;
- }
- if (strcmp("/setenergy", cmdtext, true, 10) == 0)
- {
- SetSolarCarPower(vehid,1000000);
- new string[64];
- format(string,sizeof(string),"the energy of your car is: %i",GetSolarCarPower(vehid));
- SendClientMessage(playerid,COLOR_SOLAR_MESSAGE,string);
- return 1;
- }
- return 0;
- }
- public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
- {
- vehid = vehicleid;
- return 1;
- }
- public OnPlayerExitVehicle(playerid, vehicleid)
- {
- return 1;
- }
- public OnPlayerStateChange(playerid, newstate, oldstate)
- {
- if(newstate==PLAYER_STATE_DRIVER)
- {
- if(IsSolarVehicle(vehid))
- {
- SendClientMessage(playerid, COLOR_SOLAR_MESSAGE, "You entered a solar vehicle, remind it needs the sun to drive!!");
- }
- }
- return 1;
- }
- CreateSolarVehicle(solarid,vehiclemodel, Float:x, Float:y, Float:z, Float:rotation, color1, color2, respawn_delay)
- {
- if(solarid>MAX_SOLAR_CARS)
- {
- return 0;
- }
- else
- {
- SolarCar[solarid]=CreateVehicle(vehiclemodel, x, y, z, rotation, color1, color2, respawn_delay);
- }
- return 1;
- }
- IsSolarVehicle(vehicleid)
- {
- for(new s;s<=MAX_SOLAR_CARS;s++)
- if(vehicleid==SolarCar[s])
- {
- return 1;
- }
- return 0;
- }
- SetSolarCarPower(vehicleid,power)
- {
- if(IsSolarVehicle(vehicleid))
- {
- SolarCarEnergy[vehicleid] = power;
- }
- return 1;
- }
- GetSolarCarPower(vehicleid)
- {
- if(IsSolarVehicle(vehicleid))
- {
- return SolarCarEnergy[vehicleid];
- }
- return 0;
- }
Add Comment
Please, Sign In to add comment