[HELP] npc problem
#1

Hi, i have fuel system( its not mine. its made by FeaR), but it has some mistake . Npc get removed from the car then they run out of fuel.. I tried to fix it but still nothing.. Maybe some can get help me.
pawn Код:
#include <a_samp>
#include <core>
#include <cpstreamer>
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
#define ZALIA           0x008000FF
#define RAUDONA         0xFF0000FF
#define BALTA           0xFFFFFFAA
#define SVIESIAI_MELYNA 0x33CCFFAA
#define GELTONA         0xFFFF00FF
#define ORANDZINE       0xFF9933AA
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
// Greitu komandu eilute (veikia greiciau nei paprastai).
#define dcmd(%1,%2,%3)          if (!strcmp((%3)[1], #%1, true, (%2)) && ((((%3)[(%2) + 1] == '\0') && (dcmd_%1(playerid, ""))) || (((%3)[(%2) + 1] == ' ') && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1
#define dcmd(%1,%2,%3) if (!strcmp((%3)[1], #%1, true, (%2)) && ((((%3)[(%2) + 1] == '\0') && (dcmd_%1(playerid, ""))) || (((%3)[(%2) + 1] == ' ') && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
#define KRITIMAS                                 1.400 // Benzino Rodikliu Kritimas.

//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
new RodymoDezute[MAX_PLAYERS];

// ***[Globalus Kintamieji]***
new
    Benzinas[MAX_VEHICLES],
    bool:DegaluKanistras[MAX_PLAYERS],
    DegaluTaimeris;

new
    Text: Degalai[MAX_PLAYERS],
    Text: JuodojiDeze,
    Text: Judejimas[MAX_PLAYERS];
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
// Taimeriu neina paleisti ju neforwardinus, taigi:
forward PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z);
forward VariklioTaimeris();
forward IstrintiInformacija();
forward SiurbDegalus();
forward Vaizdas();
forward Atstatymas();
forward EkranaAtstatyti();
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
public OnFilterScriptInit()
{

    print("=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=");
    print("|   L1 Masinu Sistemos Scriptas   |");
    print("|           Atidarytas            |");
    print("|     Koduote pagal: FeaR'a       |");
    print("=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=");

   
    DOCP_OnGameModeInit();
    SetTimer("ParduotuvesPickup", 1000, 1);
    DegaluTaimeris = SetTimer("SiurbDegalus", 12000, true);

    //            ***[ Degalu TextDraw'as ]***
    JuodojiDeze = TextDrawCreate(354.000000, 422.000000, "_");
    TextDrawBackgroundColor(JuodojiDeze, 255);
    TextDrawFont(JuodojiDeze, 1);
    TextDrawLetterSize(JuodojiDeze, 0.509999, 1.000000);
    TextDrawColor(JuodojiDeze, -1);
    TextDrawSetOutline(JuodojiDeze, 0);
    TextDrawSetProportional(JuodojiDeze, 1);
    TextDrawSetShadow(JuodojiDeze, 1);
    TextDrawUseBox(JuodojiDeze, 1);
    TextDrawBoxColor(JuodojiDeze, 0xFF80001A);
    TextDrawTextSize(JuodojiDeze, 277.000000, 51.000000);
    // Degalu Lentele
    new
       i;

    while (i != GetMaxPlayers())
    {
        Degalai[i] = TextDrawCreate(258.000000, 421.000000, " ");
        TextDrawBackgroundColor(Degalai[i], 255);
        TextDrawFont(Degalai[i], 1);
        TextDrawLetterSize(Degalai[i], 0.250000, 1.100000);
        TextDrawColor(Degalai[i], -1);
        TextDrawSetOutline(Degalai[i], 0);
        TextDrawSetProportional(Degalai[i], 1);
        TextDrawSetShadow(Degalai[i], 1);

        Judejimas[i] = TextDrawCreate(354.000000, 422.000000, "_");
        TextDrawBackgroundColor(Judejimas[i], 255);
        TextDrawFont(Judejimas[i], 1);
        TextDrawLetterSize(Judejimas[i], 0.509999, 1.000000);
        TextDrawColor(Judejimas[i], -1);
        TextDrawSetOutline(Judejimas[i], 0);
        TextDrawSetProportional(Judejimas[i], 1);
        TextDrawSetShadow(Judejimas[i], 1);
        TextDrawUseBox(Judejimas[i], 1);
        TextDrawBoxColor(Judejimas[i], 0xFF8000C1);
        TextDrawTextSize(Judejimas[i], 277.000000, 51.000000);
        ++i;
    }

    new
        m;

    while (m != MAX_VEHICLES)
    {
        Benzinas[m] = random(100);
        ++m;
    }
return 1;
}
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
public OnFilterScriptExit()
{
    print("=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=");
    print("|  L1 Masinu Sistemos Scriptas    |");
    print("|          Uzdarytas              |");
    print("|     Koduote pagal: FeaR'a       |");
    print("=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=");
    new
        i,
        m;

    while (i != GetMaxPlayers())
    {
        TextDrawDestroy(Degalai[i]);
        TextDrawDestroy(Judejimas[i]);
        ++i;
    }
    TextDrawDestroy(JuodojiDeze);
    KillTimer(DegaluTaimeris);

    while (m != MAX_VEHICLES)
    {
        Benzinas[m] = 100;
        ++m;
    }
    return 1;
}

//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
public SiurbDegalus()
{

    new
        i;

    while (i != GetMaxPlayers())
    {
        if (IsPlayerInAnyVehicle(i))
        {
            if(GetPlayerState(i) == PLAYER_STATE_PASSENGER) return 1;
            new string[128];
            if(Benzinas[GetPlayerVehicleID(i)] <0) Benzinas[GetPlayerVehicleID(i)] = 0;
            if(IsPlayerInAnyVehicle(i))
            {
                Benzinas[GetPlayerVehicleID(i)]-=1;
                format(string, 128, "Degalai:       %%%d", Benzinas[GetPlayerVehicleID(i)]);
                TextDrawSetString(Degalai[i], string), TextDrawShowForPlayer(i, Degalai[i]),
                    TextDrawShowForPlayer(i, JuodojiDeze),
                        TextDrawTextSize(Judejimas[i], (354.0 - (Benzinas[GetPlayerVehicleID(i)] / KRITIMAS)), 0.000000),
                            TextDrawShowForPlayer(i, Judejimas[i]);
            }
            if (Benzinas[GetPlayerVehicleID(i)] < 1)
            {
                if(GetPlayerState(i) == PLAYER_STATE_PASSENGER) return 1;
                Benzinas[GetPlayerVehicleID(i)] = 0;
                GameTextForPlayer(i, "~n~~n~~n~~n~~n~~n~~n~~w~Jus neturite benzino savo Automobilyje.", 4000, 3);

                RemovePlayerFromVehicle(i);
            }
        }
        else
        {
            if(GetPlayerState(i) == PLAYER_STATE_PASSENGER) return 1;
            TextDrawHideForPlayer(i, Degalai[i]),
                TextDrawHideForPlayer(i, JuodojiDeze),
                    TextDrawHideForPlayer(i, Judejimas[i]);
            GameTextForPlayer(i, " ", 100, 3);
        }
        ++i;
    }
    return 1;
}
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
public OnVehicleSpawn(vehicleid)
{
    Benzinas[vehicleid] = random(100);
}
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
public OnPlayerConnect(playerid)
{

    DegaluKanistras[playerid] = false;
    return 1;
}
//=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
public OnPlayerDisconnect(playerid, reason)
{

    DOCP_OnPlayerDisconnect(playerid);
    TextDrawHideForPlayer(playerid, Degalai[playerid]);
    TextDrawHideForPlayer(playerid, Judejimas[playerid]);
    TextDrawHideForPlayer(playerid, JuodojiDeze);
    return 1;
}
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
public OnPlayerDeath(playerid, killerid, reason)
{
    TextDrawHideForPlayer(playerid, Degalai[playerid]);
    TextDrawHideForPlayer(playerid, Judejimas[playerid]);
    TextDrawHideForPlayer(playerid, JuodojiDeze);
    return 1;
}
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
public OnPlayerExitVehicle(playerid, vehicleid)
{
    return 1;
}
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    new
        string[128],
        string2[128];

    if(newstate == PLAYER_STATE_DRIVER)
    {
        if(newstate == PLAYER_STATE_PASSENGER)  {  return 1;  }
        format(string, 128, "Degalai:       %%%d", Benzinas[GetPlayerVehicleID(playerid)]);
        TextDrawSetString(Degalai[playerid], string),
            TextDrawShowForPlayer(playerid, Degalai[playerid]),
                TextDrawShowForPlayer(playerid, JuodojiDeze),
                    TextDrawTextSize(Judejimas[playerid], (354.0 - (Benzinas[GetPlayerVehicleID(playerid)] / KRITIMAS)), 0.000000),
                        TextDrawShowForPlayer(playerid, Judejimas[playerid]);
        if (Benzinas[GetPlayerVehicleID(playerid)] < 1)
        {
            if(newstate == PLAYER_STATE_PASSENGER)  {  return 1;  }
            Benzinas[GetPlayerVehicleID(playerid)] = 1;
            format(string2, 128, "Degalai:       %%%d", Benzinas[GetPlayerVehicleID(playerid)]);
            TextDrawSetString(Degalai[playerid], string2),
                TextDrawShowForPlayer(playerid, Degalai[playerid]),
                    TextDrawTextSize(Judejimas[playerid], (354.0 - (Benzinas[GetPlayerVehicleID(playerid)] / KRITIMAS)), 0.000000),
                        TextDrawShowForPlayer(playerid, Judejimas[playerid]);
        }
        if(Benzinas[GetPlayerVehicleID(playerid)]  < 1)
        {
            if(newstate == PLAYER_STATE_PASSENGER)  {  return 1;  }
            Benzinas[GetPlayerVehicleID(playerid)] = 0;
            GameTextForPlayer(playerid, "~n~~n~~n~~n~~n~~n~~n~~w~Jus nebeturite degalu savo Automobilyje.", 4000, 3);
            RemovePlayerFromVehicle(playerid);
        }
    }
    else if (newstate == PLAYER_STATE_ONFOOT)
    {
        if(newstate == PLAYER_STATE_PASSENGER)  {  return 1;  }
        TextDrawHideForPlayer(playerid, Degalai[playerid]),
            TextDrawHideForPlayer(playerid, JuodojiDeze),
                TextDrawHideForPlayer(playerid, Judejimas[playerid]);
    }
    return 1;
}
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
public OnPlayerCommandText(playerid, cmdtext[])
{
    dcmd(uzpilti, 7, cmdtext);
    dcmd(pirktidegalus, 13, cmdtext);
    dcmd(naudotidegalus, 14, cmdtext);
    return 0;
}
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
dcmd_uzpilti (playerid, params[])
{
    new
        miktar,
        string[128],
        string2[128],
        string3[128],
        string4[128],
        Kaina,
        Suma;

    if (!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, RAUDONA, ">> Jus nesate Automobilyje kad ji pripildytumet!");
    if (!JisYraDegalineje(playerid)) return SendClientMessage(playerid, RAUDONA, ">> Jus nesate degalineje!");
    if (!strlen(params)) return SendClientMessage(playerid, RAUDONA, ">> /uzpilti [suma nuo 0 - 100 l]");
    miktar = strval(params);
    if (miktar < 1 || miktar > 100) return SendClientMessage(playerid, RAUDONA, ">> Blogas kiekis litrais! (nuo 0-100l)");
    if (Benzinas[GetPlayerVehicleID(playerid)] >= 100) return SendClientMessage(playerid, RAUDONA, ">> Daugiau nebetelpa...!");
    Kaina = (miktar * 3);
    format(string2, 128, ">> Jus neturite pakankamai pinigu! Jums reikia $%d.", Kaina);
    if (GetPlayerMoney(playerid) < Kaina) return SendClientMessage(playerid, RAUDONA, string2);
    GivePlayerMoney(playerid, -Kaina);
    format(string, 128, ">> Jus pripildete savo automobili %d litru benzino. Kaina: $%d.", miktar, Kaina);
    SendClientMessage(playerid, GELTONA, string);
    Benzinas[GetPlayerVehicleID(playerid)] += miktar;
    if (Benzinas[GetPlayerVehicleID(playerid)] > 100) Suma = miktar*2-Benzinas[GetPlayerVehicleID(playerid)]+100, GivePlayerMoney(playerid, Suma), format(string4, 128, ">> Jus pasirinkote per dideli kieki degalu,jusu masinoteje nebetilpo. Stai jusu graza($%d).", Suma), SendClientMessage(playerid, ORANDZINE, string4), Benzinas[GetPlayerVehicleID(playerid)] = 100;
    format(string3, 128, "Degalai:       %%%d", Benzinas[GetPlayerVehicleID(playerid)]);
    TextDrawSetString(Degalai[playerid], string3),
        TextDrawShowForPlayer(playerid, Degalai[playerid]),
            TextDrawTextSize(Judejimas[playerid], (354.0 - (Benzinas[GetPlayerVehicleID(playerid)] / KRITIMAS)), 0.000000),
                TextDrawShowForPlayer(playerid, Judejimas[playerid]);
    return 1;
}

dcmd_pirktidegalus (playerid, params[])
{
    #pragma unused params
    if (!JisYraDegalineje(playerid)) return SendClientMessage(playerid, RAUDONA, ">> Jus nesate degalineje!");
    if (DegaluKanistras[playerid] == true) return SendClientMessage(playerid, RAUDONA, ">> Jus negalite tureti daugiau nei viena kanistra degalu!");
    InfoBoxForPlayer(playerid,"~b~>> Jus nusipirkote 25 litru degalu kanistra. Jus galite ji panaudoti kai liko nedauk degalu. (/naudotidegalus)");
    DegaluKanistras[playerid] = true;
    return 1;
}

dcmd_naudotidegalus (playerid, params[])
{
    new
        string[128];

    #pragma unused params
    if (!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, RAUDONA, ">> Jus nesate jokiame Automobilyje!");
    if (DegaluKanistras[playerid] == false) return SendClientMessage(playerid, RAUDONA, ">> Jus neturite degalu kanistro su savimi. Nusipirkite viena rasydami /pirktidegalus.");
    if (Benzinas[GetPlayerVehicleID(playerid)] >= 40) return SendClientMessage(playerid, RAUDONA, ">> Jus turite pakankamai degalu.");
    InfoBoxForPlayer(playerid,"~b~>> Jus panaudojote degalu kanistra. (Degalai +25l)");
    Benzinas[GetPlayerVehicleID(playerid)] += 25;
    DegaluKanistras[playerid] = false;
    format(string, 128, "Degalai:       %%%d", Benzinas[GetPlayerVehicleID(playerid)]);
    TextDrawSetString(Degalai[playerid], string),
        TextDrawShowForPlayer(playerid, Degalai[playerid]),
            TextDrawTextSize(Judejimas[playerid], (354.0 - (Benzinas[GetPlayerVehicleID(playerid)] / KRITIMAS)), 0.000000),
                TextDrawShowForPlayer(playerid, Judejimas[playerid]);
    return 1;
}



//=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
public PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z)
{

    if(IsPlayerConnected(playerid))
    {
        new Float:oldposx, Float:oldposy, Float:oldposz;
        new Float:tempposx, Float:tempposy, Float:tempposz;
        GetPlayerPos(playerid, oldposx, oldposy, oldposz);
        tempposx = (oldposx -x);
        tempposy = (oldposy -y);
        tempposz = (oldposz -z);
        if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
        {
            return 1;
        }
    }
    return 0;
}
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
stock JisYraDegalineje(playerid)
{
    if(IsPlayerConnected(playerid))
    {
        if(IsPlayerInRangeOfPoint(playerid, 10.0,-1676.9453,412.9915,6.7240) || IsPlayerInRangeOfPoint(playerid, 10.0,-2413.0183,976.0416,44.8628) || IsPlayerInRangeOfPoint(playerid, 10.0,-2025.0022,155.7136,28.8359))
        {
            return 1;
        }

    }
    return 0;
}
stock InfoBoxForPlayer(playerid, text[])
{
//  TextDrawDestroy(InformacijosDezute[playerid]);
    new string[800];
    RodymoDezute[playerid] = 1;
    format(string, sizeof(string), "%s~n~~n~~y~Kuro sistema ~w~©2010-FeaR", text);
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)