Jump to content
  • 0

Modificare script


teo_730

Question

Urmatorul script face nitro-ul din San Andreas sa se comporte la fel cu cel din NFS. Partea proasta este ca e facut pentru Multi Player si mie imi trebuie pentru Single Player.

Va rog daca puteti sa il transformati intr-un script pentru SP si eventual sa imi spuneti unde il pun.

#include <a_samp>
new Text:td_show[MAX_PLAYERS];
new Text:g_ntw;
new VehNitro[MAX_VEHICLES],isInMode[MAX_PLAYERS];
new valid_vehicles[] = {
568,424,579,400,422,500,556,470,412,482,489,505,495,416,438,490,528,598,597,582,
420,536,575,534,413,567,535,566,576,543,605,459,552,478,554,480,533,439,555,602,
429,496,402,541,415,589,587,565,494,502,503,411,559,603,475,506,451,558,477,418,
404,479,458,561,483,434,545,588,423,442,428,409,525,445,504,401,518,527,542,507,
562,585,419,526,604,466,492,474,546,517,410,551,516,467,600,426,436,547,405,580,
560,550,549,540,491,529,421};
forward DoUpdateNtwo();
public OnFilterScriptInit()
{
        print("\n--------------------------------------");
        print(" NitroFS By BlackFoX_UD_");
        print("--------------------------------------\n");
        g_ntw = TextDrawCreate(51.000000,311.000000,"N20");
        TextDrawAlignment(g_ntw,0);
        TextDrawBackgroundColor(g_ntw,0x000000ff);
        TextDrawFont(g_ntw,1);
        TextDrawLetterSize(g_ntw,0.599999,1.000000);
        TextDrawColor(g_ntw,0x0000ffcc);
        TextDrawSetProportional(g_ntw,1);
        TextDrawSetShadow(g_ntw,1);
        SetTimer("DoUpdateNtwo",500,1);
        return 1;
}
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
        if(IsPlayerInAnyVehicle(playerid) && getValidModel(GetPlayerVehicleID(playerid)))
        {
                if(newkeys & KEY_FIRE)
                {
                        isInMode[playerid] = 1;
                        if(VehNitro[GetPlayerVehicleID(playerid)]>0)AddVehicleComponent(GetPlayerVehicleID(playerid),1010);
                }
                else if(oldkeys & KEY_FIRE)
                {
                        if(VehNitro[GetPlayerVehicleID(playerid)]>0)AddVehicleComponent(GetPlayerVehicleID(playerid),1010);
                        isInMode[playerid] = 0;
                }
        }
        return 1;
}
public DoUpdateNtwo()
{
        for(new i = 0;i<MAX_PLAYERS;i++)
        {
            if(!IsPlayerConnected(i) || IsPlayerNPC(i) || !IsPlayerInAnyVehicle(i))continue;
            if(VehNitro[GetPlayerVehicleID(i)]<1 || !getValidModel(GetPlayerVehicleID(i)))
            {
                RemoveVehicleComponent(GetPlayerVehicleID(i),1008);
                RemoveVehicleComponent(GetPlayerVehicleID(i),1009);
                RemoveVehicleComponent(GetPlayerVehicleID(i),1010);
            }
            if(!isInMode[i])continue;
            new doitin[20];
            VehNitro[GetPlayerVehicleID(i)]--;
                format(doitin,sizeof doitin,"%s",getNitroState(VehNitro[GetPlayerVehicleID(i)]));
                TextDrawSetString(td_show[i],doitin);
        }
        return 1;
}
public OnPlayerConnect(playerid)
{
        td_show[playerid] = TextDrawCreate(51.000000,321.000000,"@@@@@@@@@");
        TextDrawUseBox(td_show[playerid],1);
        TextDrawBoxColor(td_show[playerid],0x000000cc);
        TextDrawTextSize(td_show[playerid],149.000000,0.000000);
        TextDrawAlignment(td_show[playerid],0);
        TextDrawBackgroundColor(td_show[playerid],0x000000ff);
        TextDrawFont(td_show[playerid],3);
        TextDrawLetterSize(td_show[playerid],1.000000,1.000000);
        TextDrawColor(td_show[playerid],0xffffffff);
        TextDrawSetOutline(td_show[playerid],1);
        TextDrawSetProportional(td_show[playerid],1);
        TextDrawSetShadow(td_show[playerid],1);
        return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
        TextDrawDestroy(td_show[playerid]);
        return 1;
}
public OnPlayerStateChange(playerid, newstate, oldstate)
{
        if(newstate == 2){TextDrawShowForPlayer(playerid,td_show[playerid]);TextDrawShowForPlayer(playerid,g_ntw);}
        else {TextDrawHideForPlayer(playerid,td_show[playerid]);TextDrawHideForPlayer(playerid,g_ntw);}
        return 1;
}
getNitroState(const value)
{
        new nState[12];
        if(value > 0 && value < (11*2))nState = "@";
    else if(value >= (11*2) && value < (11*3))nState = "@@";
    else if(value >= (11*3) && value < (11*4))nState = "@@@";
    else if(value >= (11*4) && value < (11*5))nState = "@@@@";
    else if(value >= (11*5) && value < (11*6))nState = "@@@@@";
    else if(value >= (11*6) && value < (11*7))nState = "@@@@@@";
    else if(value >= (11*7) && value < (11*8))nState = "@@@@@@@";
    else if(value >= (11*8) && value < (11*9))nState = "@@@@@@@@";
    else if(value >= (11*9) && value < (11*10))nState = "@@@@@@@@@";
        else nState = "LEER";
    return nState;
}
getValidModel(vehicleid)
{
        new modelx = GetVehicleModel(vehicleid),bool:found = false;
        for(new i = 0;i<sizeof(valid_vehicles);i++){
        if(valid_vehicles[i] == modelx){found = true;break;}
        }
        return found;
}
public OnVehicleMod(playerid, vehicleid, componentid)
{
    switch(componentid)
    {
        case 1008:VehNitro[vehicleid] = 70;
        case 1009:VehNitro[vehicleid] = 40;
        case 1010:VehNitro[vehicleid] = 100;
    }
        return 1;
}
public OnVehicleDeath(vehicleid, killerid)
{
        if(VehNitro[vehicleid]>0)
        {
            VehNitro[vehicleid] = 0;
            RemoveVehicleComponent(vehicleid,1008);
            RemoveVehicleComponent(vehicleid,1009);
            RemoveVehicleComponent(vehicleid,1010);
        }
        return 1;
}
public OnPlayerExitVehicle(playerid, vehicleid)
{
        if(isInMode[playerid])AddVehicleComponent(vehicleid,GetVehicleComponentInSlot(vehicleid,5));
        return 1;
}

Link to comment
Share on other sites

1 answer to this question

Recommended Posts

Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more details you can also review our Terms of Use and Privacy Policy.