Need Help for finished script
#1

I have fuel system script, like this :

PHP Code:
//------------------------------
// OH BABY, OH BABY. SAY MY NAME> SAY MY NAME. *CLUCK*- bi- lay . RUSSEL peters!
#define FILTERSCRIPT
#include <a_samp>
#include <zcmd>
#include <streamer>
#include <sscanf2>
#include    <evf>
#include    <evi>
#define SCM SendClientMessage
#define COLOR_GREY 0xAFAFAFAA
#define COLOR_GREEN 0x33AA33AA
#define COLOR_RED 0xAA3333AA
#define COLOR_YELLOW 0xFFFF00AA
#define COLOR_WHITE 0xFFFFFFAA
#define COLOR_BLUE 0x0000BBAA
#define COLOR_LIGHTBLUE 0x33CCFFAA
#define COLOR_ORANGE 0xFF9900AA
#define COLOR_RED 0xAA3333AA
#define COLOR_LIME 0x10F441AA
#define COLOR_MAGENTA 0xFF00FFFF
#define COLOR_NAVY 0x000080AA
#define COLOR_AQUA 0xF0F8FFAA
#define COLOR_CRIMSON 0xDC143CAA
#define COLOR_FLBLUE 0x6495EDAA
#define COLOR_BISQUE 0xFFE4C4AA
#define COLOR_BLACK 0x000000AA
#define COLOR_CHARTREUSE 0x7FFF00AA
#define COLOR_BROWN 0XA52A2AAA
#define COLOR_CORAL 0xFF7F50AA
#define COLOR_GOLD 0xB8860BAA
#define COLOR_GREENYELLOW 0xADFF2FAA
#define COLOR_INDIGO 0x4B00B0AA
#define COLOR_IVORY 0xFFFF82AA
#define COLOR_LAWNGREEN 0x7CFC00AA
#define COLOR_SEAGREEN 0x20B2AAAA
#define COLOR_LIMEGREEN 0x32CD32AA //<--- Dark lime
#define COLOR_MIDNIGHTBLUE 0X191970AA
#define COLOR_MAROON 0x800000AA
#define COLOR_OLIVE 0x808000AA
#define COLOR_ORANGERED 0xFF4500AA
#define COLOR_PINK 0xFFC0CBAA // - Light light pink
#define COLOR_SPRINGGREEN 0x00FF7FAA
#define COLOR_TOMATO 0xFF6347AA // - Tomato >:/ sounds wrong lol... well... :P
#define COLOR_YELLOWGREEN 0x9ACD32AA //- like military green
#define COLOR_MEDIUMAQUA 0x83BFBFAA
#define COLOR_MEDIUMMAGENTA 0x8B008BAA // dark magenta ^^
new Text:Date;
forward settime(playerid);
new 
Text:td_fuel[MAX_PLAYERS];
forward timer_update();
forward timer_refuel(playerid);
new 
isrefuelling[MAX_PLAYERS] = 0;
new 
fuel[MAX_VEHICLES];
new 
Float:max_vhealth[MAX_VEHICLES];
new 
Engine[MAX_PLAYERS];
new 
VehicleNames[][] =
{
    
"Landstalker""Bravura""Buffalo""Linerunner""Perrenial""Sentinel",
    
"Dumper""Firetruck""Trashmaster""Stretch""Manana""Infernus",
    
"Voodoo""Pony""Mule""Cheetah""Ambulance""Leviathan""Moonbeam",
    
"Esperanto""Taxi""Washington""Bobcat""Whoopee""BF Injection",
    
"Hunter""Premier""Enforcer""Securicar""Banshee""Predator""Bus",
    
"Rhino""Barracks""Hotknife""Trailer""Previon""Coach""Cabbie",
    
"Stallion""Rumpo""RC Bandit""Romero""Packer""Monster""Admiral",
    
"Squalo""Seasparrow""Pizzaboy""Tram""Trailer""Turismo""Speeder",
    
"Reefer""Tropic""Flatbed""Yankee""Caddy""Solair""Berkley's RC Van",
    
"Skimmer""PCJ-600""Faggio""Freeway""RC Baron""RC Raider""Glendale",
    
"Oceanic","Sanchez""Sparrow""Patriot""Quad""Coastguard""Dinghy",
    
"Hermes""Sabre""Rustler""ZR-350""Walton""Regina""Comet""BMX",
    
"Burrito""Camper""Marquis""Baggage""Dozer""Maverick""News Chopper",
    
"Rancher""FBI Rancher""Virgo""Greenwood""Jetmax""Hotring""Sandking",
    
"Blista Compact""Police Maverick""Boxville""Benson""Mesa""RC Goblin",
    
"Hotring Racer A""Hotring Racer B""Bloodring Banger""Rancher""Super GT",
    
"Elegant""Journey""Bike""Mountain Bike""Beagle""Cropduster""Stunt",
    
"Tanker""Roadtrain""Nebula""Majestic""Buccaneer""Shamal""Hydra",
    
"FCR-900""NRG-500""HPV1000""Cement Truck""Tow Truck""Fortune",
    
"Cadrona""FBI Truck""Willard""Forklift""Tractor""Combine""Feltzer",
    
"Remington""Slamvan""Blade""Freight""Streak""Vortex""Vincent",
    
"Bullet""Clover""Sadler""Firetruck""Hustler""Intruder""Primo",
    
"Cargobob""Tampa""Sunrise""Merit""Utility""Nevada""Yosemite",
    
"Windsor""Monster""Monster""Uranus""Jester""Sultan""Stratium",
    
"Elegy""Raindance""RC Tiger""Flash""Tahoma""Savanna""Bandito",
    
"Freight Flat""Streak Carriage""Kart""Mower""Dune""Sweeper",
    
"Broadway""Tornado""AT-400""DFT-30""Huntley""Stafford""BF-400",
    
"News Van""Tug""Trailer""Emperor""Wayfarer""Euros""Hotdog""Club",
    
"Freight Box""Trailer""Andromada""Dodo""RC Cam""Launch""Police Car",
    
"Police Car""Police Car""Police Ranger""Picador""S.W.A.T""Alpha",
    
"Phoenix""Glendale""Sadler""Luggage""Luggage""Stairs""Boxville",
    
"Tiller""Utility Trailer"
};
new 
vstring[128];
new 
fstring[128];
stock GetVehicleName(vehicleid)
{
    
format(vstring,sizeof(vstring),"%s",VehicleNames[GetVehicleModel(vehicleid) - 400]);
    return 
vstring;
}
//-------------------------------------------------------
new Text:dua;
new 
Text:tiga;
new 
Text:empat;
new 
Text:lima;
new 
Text:enam;
new 
Text:tujuh;
new 
Text:Textdraw2[MAX_PLAYERS];
new 
Text:Textdraw1[MAX_PLAYERS];
new 
Text:HEALTH[MAX_PLAYERS];
//-------------------------------------------------------
forward Speedometer(playerid);
//-------------------------------------------------------
public OnFilterScriptInit()
{
    
    
Date TextDrawCreate(547.000000,11.000000,"--");
    
TextDrawFont(Date,3);
     
TextDrawLetterSize(Date,0.399999,1.600000);
    
TextDrawColor(Date,0xffffffff);
     
SetTimer("Speedometer"100true);
     for(new 
i=0;i<MAX_VEHICLES;i++)
     {
        
GetVehicleHealth(i,max_vhealth[i]); //getting max health
        
fuel[i] = 250 random(150);  //setting fuel for vehicles
    
}
    for(new 
i=0;i<MAX_PLAYERS;i++) { //setting up all textdraws
    
td_fuel[i] = TextDrawCreate(566.427551289.750030" ");
    
TextDrawLetterSize(td_fuel[i], 0.4000001.600000);
    
TextDrawAlignment(td_fuel[i], 1);
    
TextDrawColor(td_fuel[i], 65535);
    
TextDrawSetShadow(td_fuel[i], 0);
    
TextDrawSetOutline(td_fuel[i], 1);
    
TextDrawBackgroundColor(td_fuel[i], 255);
    
TextDrawFont(td_fuel[i], 1);
    
TextDrawSetProportional(td_fuel[i], 1);
    
TextDrawSetShadow(td_fuel[i], 0);
    }
    
SetTimer("timer_update",1000,true);
    return 
1;
}
public 
OnFilterScriptExit()
{
    for(new 
i=0;i<MAX_PLAYERS;i++) {
        
TextDrawDestroy(td_fuel[i]);
    }
    return 
1;
}
stock IsPlayerAtRefuelStation(playerid)
{
    if (
IsPlayerInRangeOfPoint(playerid,10,655.5993,-564.9833,16.3359)) return 1//Dilimore
    
if (IsPlayerInRangeOfPoint(playerid,10,4,5,6)) return 1//random
    
return 0;
}
public 
Speedometer(playerid)
{
    new 
vehicleid,Float:speed_x,Float:speed_y,Float:speed_z,Float:final_speed,speed_string[256],final_speed_int;
    
vehicleid GetPlayerVehicleID(playerid);
    new 
Float:vehicle_health,final_vehicle_health,health_string[256];
    if(
vehicleid != 0)
    {
        
GetVehicleVelocity(vehicleid,speed_x,speed_y,speed_z);
        
final_speed floatsqroot(((speed_x*speed_x)+(speed_y*speed_y))+(speed_z*speed_z))*180.666667;
        
final_speed_int floatround(final_speed,floatround_round);
        
format(speed_string,256,"%i mph",final_speed_int);
        
TextDrawSetString(Textdraw1[playerid], speed_string);
        
GetVehicleHealth(vehicleid,vehicle_health);
        
final_vehicle_health floatround(floatround(vehicle_health 250)/ 7.5);
        while(
final_vehicle_health<0)
        {
            
final_vehicle_health=0;
        }
        
format(health_string,256,"%i pcnt"final_vehicle_health);
        
TextDrawSetString(HEALTH[playerid], health_string);
        
format(vstring,sizeof(vstring),"%s",GetVehicleName(vehicleid));
        
TextDrawSetString(Textdraw2[playerid],vstring);
           }
    else
    {
        
TextDrawSetString(Textdraw1[playerid], " ");
        
TextDrawSetString(HEALTH[playerid], " ");
    }
    return 
1;
}
#pragma unused fstring
public OnPlayerEnterVehicle(playeridvehicleidispassenger)
{
Textdraw1[playerid]= TextDrawCreate563.147888259.416687," ");
TextDrawLetterSize(Textdraw1[playerid], 0.4000001.600000);
TextDrawAlignmentTextdraw1[playerid], 1);
TextDrawColorTextdraw1[playerid], 65535);
TextDrawSetShadowTextdraw1[playerid], 0);
TextDrawSetOutlineTextdraw1[playerid], 1);
TextDrawBackgroundColorTextdraw1[playerid], 255);
TextDrawFontTextdraw1[playerid], 1);
TextDrawSetProportionalTextdraw1[playerid], 1);
Textdraw2[playerid]= TextDrawCreate474.129455230.249755" ");
TextDrawLetterSize(Textdraw2[playerid], 0.6999992.000000);
TextDrawAlignmentTextdraw2[playerid], 1);
TextDrawColorTextdraw2[playerid], -16776961);
TextDrawSetShadowTextdraw2[playerid], 0);
TextDrawSetOutlineTextdraw2[playerid], 0);
TextDrawBackgroundColorTextdraw2[playerid], 255);
TextDrawFontTextdraw2[playerid], 3);
TextDrawSetProportionalTextdraw2[playerid], 1);
HEALTH[playerid]= TextDrawCreate565.958984274.583282" pcnt");
TextDrawLetterSize(HEALTH[playerid], 0.4000001.600000);
TextDrawAlignmentHEALTH[playerid], 1);
TextDrawColorHEALTH[playerid], 65535);
TextDrawSetShadow(HEALTH[playerid], 0);
TextDrawSetOutline(HEALTH[playerid], 1);
TextDrawBackgroundColor(HEALTH[playerid], 255);
TextDrawFont(HEALTH[playerid], 1);
TextDrawSetProportional(HEALTH[playerid], 1);
dua TextDrawCreate(471.786346243.083312"============================");
TextDrawLetterSize(dua0.4000001.600000);
TextDrawAlignment(dua1);
TextDrawColor(dua65535);
TextDrawSetShadow(dua0);
TextDrawSetOutline(dua0);
TextDrawBackgroundColor(dua255);
TextDrawFont(dua1);
TextDrawSetProportional(dua1);
TextDrawSetShadow(dua0);
tiga TextDrawCreate(480.219268229.666580"~n~~n~Speed__~n~Health~n~Fuel");
TextDrawLetterSize(tiga0.4000001.600000);
TextDrawAlignment(tiga1);
TextDrawColor(tiga, -16776961);
TextDrawSetShadow(tiga0);
TextDrawSetOutline(tiga0);
TextDrawBackgroundColor(tiga255);
TextDrawFont(tiga1);
TextDrawSetProportional(tiga1);
TextDrawSetShadow(tiga0);
empat TextDrawCreate(473.660491303.750396"============================");
TextDrawLetterSize(empat0.4000001.600000);
TextDrawAlignment(empat1);
TextDrawColor(empat65535);
TextDrawSetShadow(empat0);
TextDrawSetOutline(empat0);
TextDrawBackgroundColor(empat255);
TextDrawFont(empat1);
TextDrawSetProportional(empat1);
TextDrawSetShadow(empat0);
lima TextDrawCreate(542.064636260.000061"=");
TextDrawLetterSize(lima0.4000001.600000);
TextDrawAlignment(lima1);
TextDrawColor(lima, -16776961);
TextDrawSetShadow(lima0);
TextDrawSetOutline(lima0);
TextDrawBackgroundColor(lima255);
TextDrawFont(lima1);
TextDrawSetProportional(lima1);
TextDrawSetShadow(lima0);
enam TextDrawCreate(542.064636274.000213"=");
TextDrawLetterSize(enam0.4000001.600000);
TextDrawAlignment(enam1);
TextDrawColor(enam, -16776961);
TextDrawSetShadow(enam0);
TextDrawSetOutline(enam0);
TextDrawBackgroundColor(enam255);
TextDrawFont(enam1);
TextDrawSetProportional(enam1);
TextDrawSetShadow(enam0);
tujuh TextDrawCreate(542.533142289.167083"=");
TextDrawLetterSize(tujuh0.4000001.600000);
TextDrawAlignment(tujuh1);
TextDrawColor(tujuh, -16776961);
TextDrawSetShadow(tujuh0);
TextDrawSetOutline(tujuh0);
TextDrawBackgroundColor(tujuh255);
TextDrawFont(tujuh1);
TextDrawSetProportional(tujuh1);
TextDrawSetShadow(tujuh0);
return 
1;
}
public 
OnPlayerExitVehicle(playeridvehicleid)
{
    
    
TextDrawHideForPlayer(playerid,HEALTH[playerid]);
    
TextDrawHideForPlayer(playerid,Textdraw1[playerid]);
    
TextDrawHideForPlayer(playerid,Textdraw2[playerid]);
    
TextDrawHideForPlayer(playeriddua);
    
TextDrawHideForPlayer(playeridtiga);
    
TextDrawHideForPlayer(playeridempat);
    
TextDrawHideForPlayer(playeridlima);
    
TextDrawHideForPlayer(playeridenam);
    
TextDrawHideForPlayer(playeridtujuh);
    
TextDrawHideForPlayer(playerid,td_fuel[playerid]);
    
    return 
1;
}
public 
OnPlayerStateChange(playeridnewstateoldstate)
{
    if (
newstate == PLAYER_STATE_DRIVER || newstate == PLAYER_STATE_PASSENGER)
    {
        
TextDrawShowForPlayer(playerid,Textdraw2[playerid]);
        
TextDrawShowForPlayer(playerid,Textdraw1[playerid]);
        
TextDrawShowForPlayer(playerid,HEALTH[playerid]);
        
TextDrawShowForPlayer(playeriddua);
        
TextDrawShowForPlayer(playeridtiga);
        
TextDrawShowForPlayer(playeridempat);
        
TextDrawShowForPlayer(playeridlima);
        
TextDrawShowForPlayer(playeridenam);
        
TextDrawShowForPlayer(playeridtujuh);
        
TextDrawSetString(td_fuel[playerid]," ");
        
TextDrawShowForPlayer(playerid,td_fuel[playerid]);//showing if an player is a driver or passenger of the ar
    
}     else {
        
TextDrawHideForPlayer(playerid,Textdraw2[playerid]);
        
TextDrawHideForPlayer(playerid,Textdraw1[playerid]);
        
TextDrawHideForPlayer(playerid,HEALTH[playerid]);
        
TextDrawHideForPlayer(playeriddua);
        
TextDrawHideForPlayer(playeridtiga);
        
TextDrawHideForPlayer(playeridempat);
        
TextDrawHideForPlayer(playeridlima);
        
TextDrawHideForPlayer(playeridenam);
        
TextDrawHideForPlayer(playeridtujuh);
        
TextDrawHideForPlayer(playerid,td_fuel[playerid]);
        }
    return 
1;
}
public 
OnPlayerDisconnect(playeridreason)
{
    
TextDrawHideForPlayer(playeridDate);
    return 
true;
}
public 
OnPlayerSpawn(playerid)
{
TextDrawShowForPlayer(playeridDate);
return 
1;
}
public 
settime(playerid)
{
        new 
string[256],year,month,day;
        
getdate(yearmonthday);
        
format(stringsizeof string"%d/%s%d/%s%d"day, ((month 10) ? ("0") : ("")), month, (year 10) ? ("0") : (""), year);
        
TextDrawSetString(Datestring);
}
CMD:refill(playeridparams[])
{
        new 
id GetPlayerVehicleID(playerid);
        if (!
IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid,-1,"{FF0000}[Vehicle]{FFFFFF} Kamu Tidak Di Dalam Sebuah Kendaraan"); //if a player isnt in a vehicle, it stops here
        
if (!IsPlayerAtRefuelStation(playerid)) return SendClientMessage(playerid,-1,"{FF0000}[Vehicle]{FFFFFF} Kamu Harus Berada di Gas Station Untuk Mengisi Bahan Bakar");
        if (
isrefuelling[playerid]) return SendClientMessage(playerid,-1,"{FF0000}[Vehicle]{FFFFFF} Kamu Sedang Melakukan Pengisian Bahan Bakar"); //if a player is already refuelling, it stops here
        
if (GetPlayerMoney(playerid) - 10 <0) return SendClientMessage(playerid,-1,"{FF0000}[Vehicle]{FFFFFF} Kamu Tidak Memiliki Uang Sebesar {32CD32}$10 "); //if a player doesnt have $80 anymore, it stops here
        
if(GetVehicleParams(idVEHICLE_TYPE_ENGINE))
        {
        
SendClientMessage(playerid,-1,"{FF0000}[Vehicle]{FFFFFF} Anda Harus Mematikan Mesih Terlebih Dahulu Sebelum Mengisi Bahan Bakar");
        }
        else
        {
        
GivePlayerMoney(playerid, -10); //Sets the player's cash -$80
        
SetCameraBehindPlayer(playerid); //Sets the camera behind the player (looks better because the player will be frozen for a few secs)
        
isrefuelling[playerid] = 1//setting isrefuelling to 1 so the player cant spam /refuel
        
TextDrawSetString(td_fuel[playerid],"Refuelling..."); //changing textdraw to /refuel
        
SetTimerEx("timer_refuel",4500,false,"i",playerid); //setting refueltimer
        
        
}
        return 
1;
        }
public 
timer_update()
{
    for(new 
i=0;i<MAX_PLAYERS;i++)
    {
        if (
isrefuelling[i]) return 0;
        new 
vid GetPlayerVehicleID(i);
        if (
GetPlayerVehicleSeat(i) == 0)
        {
            
fuel[vid] = fuel[vid] - 1;
            if (
fuel[vid]<1)
            {
                
fuel[vid] = 0;
                new 
veh GetPlayerVehicleID(i);
                new 
engine,lights,alarm,doors,bonnet,boot,objective;
                
GetVehicleParamsEx(veh,engine,lights,alarm,doors,bonnet,boot,objective);
                
SetVehicleParamsEx(veh,VEHICLE_PARAMS_OFF,lights,alarm,doors,bonnet,boot,objective);
                
Engine[i]=0;
                
GameTextForPlayer(i,"~r~You are out of ~w~fuel~r~!",5000,4);
            }
        }
        new 
string[128];format(string,sizeof string,"%i",fuel[vid] /40);
        
TextDrawSetString(td_fuel[i],string);
        new 
Float:speed_x,Float:speed_y,Float:speed_z,Float:temp_speed,final_speed,Float:health;
        
GetVehicleVelocity(vid,speed_x,speed_y,speed_z);
        
temp_speed floatsqroot(((speed_x*speed_x)+(speed_y*speed_y))+(speed_z*speed_z))*136.666667;
        
final_speed floatround(temp_speed,floatround_round);
        
format(string,sizeof string,"Speed:  %i",final_speed);
        
GetVehicleHealth(vid,health);
        if (
max_vhealth[vid] == 0)//if its an random spawned vehicle
        
{
            
fuel[vid] = 4000;
            
GetVehicleHealth(vid,max_vhealth[vid]);
        }
        
health = (((health max_vhealth[vid]) /max_vhealth[vid]) *100)+ 100;
        
format(string,sizeof string,"Health: %i",floatround(health,floatround_round));
    }
    return 
1;
}
public 
timer_refuel(playerid)
{
    new 
vid GetPlayerVehicleID(playerid);
    if(
Engine[playerid]==0)
    {
        new 
veh GetPlayerVehicleID(playerid);
        new 
engine,lights,alarm,doors,bonnet,boot,objective;
        
GetVehicleParamsEx(veh,engine,lights,alarm,doors,bonnet,boot,objective);
        
SetVehicleParamsEx(veh,VEHICLE_PARAMS_ON,lights,alarm,doors,bonnet,boot,objective);
        
Engine[playerid]=1;
    }
    
fuel[vid] = fuel[vid] = 4000;
    
isrefuelling[playerid] = 0;
    
TextDrawSetString(td_fuel[playerid],"100");


I want the fuel system is running when the engine of life is, if the dead engine fuel system is not running. how to make the engine system like this? :
PHP Code:
public OnPlayerKeyStateChange(playeridnewkeysoldkeys)
{
    if(
GetPlayerState(playerid) == PLAYER_STATE_DRIVER && (newkeys KEY_NO))
    {
        new 
id GetPlayerVehicleID(playerid);
        new 
string[200];
        if(
GetVehicleParams(idVEHICLE_TYPE_ENGINE))
        {
        
SetVehicleParams(idVEHICLE_TYPE_ENGINE0);
        
SendClientMessage(playerid, -1"{FF0000}[Vehicle] {FFFFFF}Mesin Kendaraan Berhasil Anda Matikan.");
        
format(stringsizeof(string), "* %s stoped engine"GetPlayerNameEx(playerid));
        
ProxDetector(30.0playeridstringCOLOR_PURPLE);
        }
        else
        {
            
Vehicle_StartEngine(id);
            
SendClientMessage(playerid, -1"{FF0000}[Vehicle] {FFFFFF}Mesin Kendaraan Berhasil Anda Hidupkan.");
            
format(stringsizeof(string), "* %s started engine"GetPlayerNameEx(playerid));
            
ProxDetector(30.0playeridstringCOLOR_PURPLE);
        }
    }
    return 
1;

Reply
#2

That is not what this section is for...
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)