[FilterScript] Cofre casa [PPC_Trucking]
#1

Olб aqui e DonSpeed e venho trazendo mais uma novidade para os que usam o GM PPC_Trucking!
Suas casas iram possuir cofre , cada casa seu cofre!
Bom nao tem muito o que falar.
Voce so precisa substituir essas callbackґs.

pawn Code:
enum THouseData
{
    PickupID,
    Text3D:DoorText,
    MapIconID,
    HouseName[100],
    Insurance,
    Float:HouseX,
    Float:HouseY,
    Float:HouseZ,
    HouseLevel,
    HouseMaxLevel,
    HousePrice,
    bool:Owned,
    Owner[24],
    bool:HouseOpened,
    VehicleIDs[10],
    MoneyHouse
}
new AHouseData[MAX_HOUSES][THouseData];
HouseFile_Load(HouseID, bool:OnlyLoadVehicles = false)
{
    new file[100], File:HFile, LineFromFile[100], ParameterName[50], ParameterValue[50];
    new cModel, cPaint, components[14], Float:cx, Float:cy, Float:cz, Float:crot, Col1, Col2, vid, bool:VehicleClamped, cFuel = -1;

    format(file, sizeof(file), HouseFile, HouseID);

    if (fexist(file))
    {
        HFile = fopen(file, io_read);
        fread(HFile, LineFromFile);
        AHouseData[HouseID][HouseOpened] = false;
        while (strlen(LineFromFile) > 0)
        {
            StripNewLine(LineFromFile);
            sscanf(LineFromFile, "s[50]s[50]", ParameterName, ParameterValue);
            if (OnlyLoadVehicles == false)
            {
                if (strcmp(ParameterName, "HouseName", false) == 0)
                    format(AHouseData[HouseID][HouseName], 24, ParameterValue);
                if (strcmp(ParameterName, "HouseX", false) == 0)
                    AHouseData[HouseID][HouseX] = floatstr(ParameterValue);
                if (strcmp(ParameterName, "HouseY", false) == 0)
                    AHouseData[HouseID][HouseY] = floatstr(ParameterValue);
                if (strcmp(ParameterName, "HouseZ", false) == 0)
                    AHouseData[HouseID][HouseZ] = floatstr(ParameterValue);
                if (strcmp(ParameterName, "HouseLevel", false) == 0)
                    AHouseData[HouseID][HouseLevel] = strval(ParameterValue);
                if (strcmp(ParameterName, "HouseMaxLevel", false) == 0)
                    AHouseData[HouseID][HouseMaxLevel] = strval(ParameterValue);
                if (strcmp(ParameterName, "HousePrice", false) == 0)
                    AHouseData[HouseID][HousePrice] = strval(ParameterValue);
                if (strcmp(ParameterName, "MoneyHouse", false) == 0)
                    AHouseData[HouseID][MoneyHouse] = strval(ParameterValue);
                if (strcmp(ParameterName, "Owned", false) == 0)
                {
                    if (strcmp(ParameterValue, "Yes", false) == 0)
                        AHouseData[HouseID][Owned] = true;
                    else
                        AHouseData[HouseID][Owned] = false;
                }
                if (strcmp(ParameterName, "Owner", false) == 0)
                    format(AHouseData[HouseID][Owner], 24, ParameterValue);
                if (strcmp(ParameterName, "Insurance", false) == 0)
                    AHouseData[HouseID][Insurance] = strval(ParameterValue);
            }
            else
            {
                if (strcmp(ParameterName, "[Vehicle]", false) == 0)
                {
                    cModel = 0;
                    cPaint = 0;
                    cFuel = -1;
                    for (new i; i < 14; i++)
                        components[i] = 0;
                }
                if (strcmp(ParameterName, "VehicleModel", false) == 0)
                    cModel = strval(ParameterValue);
                if (strcmp(ParameterName, "Fuel", false) == 0)
                    cFuel = strval(ParameterValue);
                if (strcmp(ParameterName, "VehiclePaintJob", false) == 0)
                    cPaint = strval(ParameterValue);
                if (strcmp(ParameterName, "VehicleSpoiler", false) == 0)
                    components[0] = strval(ParameterValue);
                if (strcmp(ParameterName, "VehicleHood", false) == 0)
                    components[1] = strval(ParameterValue);
                if (strcmp(ParameterName, "VehicleRoof", false) == 0)
                    components[2] = strval(ParameterValue);
                if (strcmp(ParameterName, "VehicleSideSkirt", false) == 0)
                    components[3] = strval(ParameterValue);
                if (strcmp(ParameterName, "VehicleLamps", false) == 0)
                    components[4] = strval(ParameterValue);
                if (strcmp(ParameterName, "VehicleNitro", false) == 0)
                    components[5] = strval(ParameterValue);
                if (strcmp(ParameterName, "VehicleExhaust", false) == 0)
                    components[6] = strval(ParameterValue);
                if (strcmp(ParameterName, "VehicleWheels", false) == 0)
                    components[7] = strval(ParameterValue);
                if (strcmp(ParameterName, "VehicleStereo", false) == 0)
                    components[8] = strval(ParameterValue);
                if (strcmp(ParameterName, "VehicleHydraulics", false) == 0)
                    components[9] = strval(ParameterValue);
                if (strcmp(ParameterName, "VehicleFrontBumper", false) == 0)
                    components[10] = strval(ParameterValue);
                if (strcmp(ParameterName, "VehicleRearBumper", false) == 0)
                    components[11] = strval(ParameterValue);
                if (strcmp(ParameterName, "VehicleVentRight", false) == 0)
                    components[12] = strval(ParameterValue);
                if (strcmp(ParameterName, "VehicleVentLeft", false) == 0)
                    components[13] = strval(ParameterValue);
                if (strcmp(ParameterName, "Color1", false) == 0)
                    Col1 = strval(ParameterValue);
                if (strcmp(ParameterName, "Color2", false) == 0)
                    Col2 = strval(ParameterValue);
                if (strcmp(ParameterName, "VehicleX", false) == 0)
                    cx = floatstr(ParameterValue);
                if (strcmp(ParameterName, "VehicleY", false) == 0)
                    cy = floatstr(ParameterValue);
                if (strcmp(ParameterName, "VehicleZ", false) == 0)
                    cz = floatstr(ParameterValue);
                if (strcmp(ParameterName, "VehicleAngle", false) == 0)
                    crot = floatstr(ParameterValue);

                if (strcmp(ParameterName, "Clamped", false) == 0)
                {
                    if (strcmp(ParameterValue, "Yes", false) == 0)
                        VehicleClamped = true;
                    else
                        VehicleClamped = false;
                }

                if (strcmp(ParameterName, "[/Vehicle]", false) == 0)
                {
                    if ((Col1 == 0) && (cPaint != 0))
                        Col1 = 1;
                    if ((Col2 == 0) && (cPaint != 0))
                        Col2 = 1;
                    vid = House_AddVehicle(HouseID, cModel, cPaint, components, cx, cy, cz, crot, Col1, Col2);
                    AVehicleData[vid][Clamped] = VehicleClamped;
                    if (cFuel == -1)
                        AVehicleData[vid][Fuel] = MaxFuel;
                    else
                        AVehicleData[vid][Fuel] = cFuel;
                }
            }
            fread(HFile, LineFromFile);
        }
        if (AHouseData[HouseID][HouseMaxLevel] == 0)
            AHouseData[HouseID][HouseMaxLevel] = 10;
        fclose(HFile);
        return 1;
    }
    else
        return 0;
}
HouseFile_Save(HouseID)
{
    new file[100], File:HFile, LineForFile[100], vid;
    format(file, sizeof(file), HouseFile, HouseID);
    HFile = fopen(file, io_write);
    format(LineForFile, 100, "HouseName %s\r\n", AHouseData[HouseID][HouseName]);
    fwrite(HFile, LineForFile);
    format(LineForFile, 100, "HouseX %f\r\n", AHouseData[HouseID][HouseX]);
    fwrite(HFile, LineForFile);
    format(LineForFile, 100, "HouseY %f\r\n", AHouseData[HouseID][HouseY]);
    fwrite(HFile, LineForFile);
    format(LineForFile, 100, "HouseZ %f\r\n", AHouseData[HouseID][HouseZ]);
    fwrite(HFile, LineForFile);
    format(LineForFile, 100, "HouseLevel %i\r\n", AHouseData[HouseID][HouseLevel]);
    fwrite(HFile, LineForFile);
    format(LineForFile, 100, "HouseMaxLevel %i\r\n", AHouseData[HouseID][HouseMaxLevel]);
    fwrite(HFile, LineForFile);
    format(LineForFile, 100, "HousePrice %i\r\n", AHouseData[HouseID][HousePrice]);
    fwrite(HFile, LineForFile);
    format(LineForFile, 100, "MoneyHouse %i\r\n", AHouseData[HouseID][MoneyHouse]);
    fwrite(HFile, LineForFile);
    if (AHouseData[HouseID][Owned] == true)
    {
        format(LineForFile, 100, "Owned Yes\r\n");
        fwrite(HFile, LineForFile);
    }
    else
    {
        format(LineForFile, 100, "Owned No\r\n");
        fwrite(HFile, LineForFile);
    }
    format(LineForFile, 100, "Owner %s\r\n", AHouseData[HouseID][Owner]);
    fwrite(HFile, LineForFile);
    format(LineForFile, 100, "Insurance %i\r\n", AHouseData[HouseID][Insurance]);
    fwrite(HFile, LineForFile);
    for (new CarSlot; CarSlot < 10; CarSlot++)
    {
        if (AHouseData[HouseID][VehicleIDs][CarSlot] != 0)
        {
            vid = AHouseData[HouseID][VehicleIDs][CarSlot];

            format(LineForFile, 100, "[Vehicle]\r\n");
            fwrite(HFile, LineForFile);
            format(LineForFile, 100, "VehicleModel %i\r\n", AVehicleData[vid][Model]);
            fwrite(HFile, LineForFile);
            format(LineForFile, 100, "Fuel %i\r\n", AVehicleData[vid][Fuel]);
            fwrite(HFile, LineForFile);
            format(LineForFile, 100, "VehiclePaintJob %i\r\n", AVehicleData[vid][PaintJob]);
            fwrite(HFile, LineForFile);
            format(LineForFile, 100, "VehicleSpoiler %i\r\n", AVehicleData[vid][Components][0]);
            fwrite(HFile, LineForFile);
            format(LineForFile, 100, "VehicleHood %i\r\n", AVehicleData[vid][Components][1]);
            fwrite(HFile, LineForFile);
            format(LineForFile, 100, "VehicleRoof %i\r\n", AVehicleData[vid][Components][2]);
            fwrite(HFile, LineForFile);
            format(LineForFile, 100, "VehicleSideSkirt %i\r\n", AVehicleData[vid][Components][3]);
            fwrite(HFile, LineForFile);
            format(LineForFile, 100, "VehicleLamps %i\r\n", AVehicleData[vid][Components][4]);
            fwrite(HFile, LineForFile);
            format(LineForFile, 100, "VehicleNitro %i\r\n", AVehicleData[vid][Components][5]);
            fwrite(HFile, LineForFile);
            format(LineForFile, 100, "VehicleExhaust %i\r\n", AVehicleData[vid][Components][6]);
            fwrite(HFile, LineForFile);
            format(LineForFile, 100, "VehicleWheels %i\r\n", AVehicleData[vid][Components][7]);
            fwrite(HFile, LineForFile);
            format(LineForFile, 100, "VehicleStereo %i\r\n", AVehicleData[vid][Components][8]);
            fwrite(HFile, LineForFile);
            format(LineForFile, 100, "VehicleHydraulics %i\r\n", AVehicleData[vid][Components][9]);
            fwrite(HFile, LineForFile);
            format(LineForFile, 100, "VehicleFrontBumper %i\r\n", AVehicleData[vid][Components][10]);
            fwrite(HFile, LineForFile);
            format(LineForFile, 100, "VehicleRearBumper %i\r\n", AVehicleData[vid][Components][11]);
            fwrite(HFile, LineForFile);
            format(LineForFile, 100, "VehicleVentRight %i\r\n", AVehicleData[vid][Components][12]);
            fwrite(HFile, LineForFile);
            format(LineForFile, 100, "VehicleVentLeft %i\r\n", AVehicleData[vid][Components][13]);
            fwrite(HFile, LineForFile);
            format(LineForFile, 100, "Color1 %i\r\n", AVehicleData[vid][Color1]);
            fwrite(HFile, LineForFile);
            format(LineForFile, 100, "Color2 %i\r\n", AVehicleData[vid][Color2]);
            fwrite(HFile, LineForFile);
            format(LineForFile, 100, "VehicleX %f\r\n", AVehicleData[vid][SpawnX]);
            fwrite(HFile, LineForFile);
            format(LineForFile, 100, "VehicleY %f\r\n", AVehicleData[vid][SpawnY]);
            fwrite(HFile, LineForFile);
            format(LineForFile, 100, "VehicleZ %f\r\n", AVehicleData[vid][SpawnZ]);
            fwrite(HFile, LineForFile);
            format(LineForFile, 100, "VehicleAngle %f\r\n", AVehicleData[vid][SpawnRot]);
            fwrite(HFile, LineForFile);
            if (AVehicleData[vid][Clamped] == true)
                format(LineForFile, 100, "Clamped Yes\r\n");
            else
                format(LineForFile, 100, "Clamped No\r\n");
            fwrite(HFile, LineForFile);
            format(LineForFile, 100, "[/Vehicle]\r\n");
            fwrite(HFile, LineForFile);
        }
    }

    fclose(HFile);

    return 1;
}

Agora voce tera que definir suas dialogґs para criar os comandos.

pawn Code:
#define DIALOGSAQUE                 2315
#define DIALOGHOUSECOLOCAR          2316
#define DIALOGHOUSETIRAR            2317
#define DIALOGINF                   2318

Agora o comando , eu optei por fazer um outro comando /cofrecasa

pawn Code:
COMMAND:cofrecasa(playerid, params[])
{
    new OptionsList[200], DialogTitle[200];
    SendAdminText(playerid, "/menucasa", params);
    if (APlayerData[playerid][LoggedIn] == true)
    {
        if (APlayerData[playerid][CurrentHouse] != 0)
        {
            format(DialogTitle, sizeof(DialogTitle), "Selecione a opзгo para: %s", AHouseData[APlayerData[playerid][CurrentHouse]][HouseName]);

            format(OptionsList, sizeof(OptionsList), "%sColocar\n", OptionsList);
            format(OptionsList, sizeof(OptionsList), "%sTirar\n", OptionsList);
            format(OptionsList, sizeof(OptionsList), "%sInfo\n", OptionsList);
            ShowPlayerDialog(playerid, DIALOGSAQUE, DIALOG_STYLE_LIST, DialogTitle, OptionsList, "Selecionar", "Cancelar");
        }
        else SendClientMessage(playerid, 0xFF0000FF, "[INFO] Vocк nгo possui uma casa , ou nao esta nela.");
    }
    return 1;
}

Agora as dialogґs necessarias!
LEMBRANDO VOCE PRECISA CONVERTER ELA !

pawn Code:
DIALOG_SAQUE(playerid, response, listitem)
{
    if(!response) return 1;
    new HouseID;
    HouseID = APlayerData[playerid][CurrentHouse];
    switch(listitem)
    {
        case 0:
        {
             ShowPlayerDialog(playerid, DIALOGHOUSECOLOCAR, 3, "Deposito", "Quanto deseja depositar em sua casa??", "Depositar", "Cancelar");
        }
        case 1:
        {
             ShowPlayerDialog(playerid, DIALOGHOUSETIRAR, 3, "Sacar", "Quanto deseja sacar de sua casa??", "Sacar", "Cancelar");
        }
        case 2:
        {
             new Don[100];
             format(Don,sizeof(Don),"Olб este e o menu info da sua casa id %d\n\n\n\n\nSua casa possui R$ %i\n\n\nObrigado!",HouseID,AHouseData[HouseID][MoneyHouse]);
             ShowPlayerDialog(playerid, DIALOGINF, DIALOG_STYLE_LIST, "Info-Money House", Don, "Ok", "");
        }
    }
    return true;
}
DIALOG_HOUSECOLOCAR(playerid, response, inputtext[])
{
    new HouseID;
    HouseID = APlayerData[playerid][CurrentHouse];
    switch (response)
    {
        case 0:
        case 1:
        {
              new DepositMoney, Msg[128];
              DepositMoney = strval(inputtext);
              if (DepositMoney > 0)
              {
                  if (DepositMoney <= APlayerData[playerid][PlayerMoney])
                  {
                      AHouseData[HouseID][MoneyHouse] += DepositMoney;
                      APlayerData[playerid][PlayerMoney] -= DepositMoney;
                     
                      format(Msg,sizeof(Msg),"[HOUSE] Sua casa ID: %d Possui: R$ %i. [Deposito de R$ %i]", HouseID, AHouseData[HouseID][MoneyHouse], DepositMoney);
                      SendClientMessage(playerid,GetPlayerColor(playerid),Msg);
                      HouseFile_Save(HouseID);
                  }else SendClientMessage(playerid,GetPlayerColor(playerid),"[Info] Voce nao tem essa grana.");
              }else SendClientMessage(playerid,GetPlayerColor(playerid),"[Info] Voce nao pode digitar valores negativos.");
        }
    }
    return true;
}
DIALOG_DIALOGHOUSETIRAR(playerid, response, inputtext[])
{
    new HouseID;
    HouseID = APlayerData[playerid][CurrentHouse];
    switch (response)
    {
        case 0:
        case 1:
        {
              new SacMoney, Msg[128];
              SacMoney = strval(inputtext);
              if (SacMoney > 0)
              {
                  if (SacMoney <= AHouseData[HouseID][MoneyHouse])
                  {
                      AHouseData[HouseID][MoneyHouse] -= SacMoney;
                      APlayerData[playerid][PlayerMoney] += SacMoney;

                      format(Msg,sizeof(Msg),"[HOUSE] Sua casa ID: Possui: R$ %i. [Saque de R$ %i]", HouseID, AHouseData[HouseID][MoneyHouse], SacMoney);
                      SendClientMessage(playerid,GetPlayerColor(playerid),Msg);
                      HouseFile_Save(HouseID);
                     
                  }else SendClientMessage(playerid,GetPlayerColor(playerid),"[Info] Casa nao tem essa grana.");
              }else SendClientMessage(playerid,GetPlayerColor(playerid),"[Info] Voce nao pode digitar valores negativos.");
        }
    }
    return true;
}

Como converter?
Apenas adicione isto \/ em OnDialogResponse

pawn Code:
case DIALOGSAQUE: DIALOG_SAQUE(playerid, response, listitem);
case DIALOGHOUSECOLOCAR: DIALOG_HOUSECOLOCAR(playerid, response, inputtext[]);
case DIALOGDIALOGHOUSETIRAR: DIALOG_DIALOGHOUSETIRAR(playerid, response, inputtext[]);
Testado e aprovado por os jogadores do Transportando o Brasil!


Tem mais uma coisa que eu atualizei!
Atualizei algumas dialog de venda de empresa e venda de casa!

pawn Code:
Dialog_SellHouse(playerid, response)// DIALOG
{
    if(!response) return 1;
    new HouseID = APlayerData[playerid][CurrentHouse];
    new Don[100];
    format(Don,sizeof(Don),"[AVISO]A casa id %d esta a venda(Preзo:%i , Level: %d).[Antigo dono: %s]", HouseID, AHouseData[HouseID][HousePrice], AHouseData[HouseID][HouseMaxLevel], AHouseData[HouseID][Owner]);
    SendClientMessageToAll(GetPlayerColor(playerid), Don);
    SetPlayerVirtualWorld(playerid, 0);
    SetPlayerInterior(playerid, 0);
    SetPlayerPos(playerid, AHouseData[HouseID][HouseX], AHouseData[HouseID][HouseY], AHouseData[HouseID][HouseZ]);
    APlayerData[playerid][CurrentHouse] = 0;
    AHouseData[HouseID][Owned] = false;
    AHouseData[HouseID][Owner] = 0;
    AHouseData[HouseID][HouseName] = 0;
    AHouseData[HouseID][HouseLevel] = 1;
    Dinheiro(playerid, House_CalcSellPrice(HouseID), 0);// ISSO FOI MODIFICADO EM MEU GM NAO LEMBRO O NOME CORRETO
    SendClientMessage(playerid, 0xFFFFFFFF, "{00FF00}Voce vendeu sua casa");
    for (new i; i < MAX_HOUSESPERPLAYER; i++)
    {
        if (APlayerData[playerid][Houses][i] == HouseID)
        {
            APlayerData[playerid][Houses][i] = 0;
            break;
        }
    }
    House_UpdateEntrance(HouseID);
    PlayerFile_Save(playerid);
    HouseFile_Save(HouseID);

    return 1;
}
Dialog_SellBusiness(playerid, response)//DIALOG
{
    if(!response) return 1;
    new BusID = APlayerData[playerid][CurrentBusiness];
    new BusType = ABusinessData[BusID][BusinessType];

    new Don[100];
    format(Don,sizeof(Don),"[AVISO]A empresa id %d esta a venda(Preзo:%i).[Antigo dono: %s]", BusID, AHouseData[BusID][BusPrice], AHouseData[BusID][Owner]);
    SendClientMessageToAll(GetPlayerColor(playerid), Don);

    SetPlayerVirtualWorld(playerid, 0);
    SetPlayerInterior(playerid, 0);
    SetPlayerPos(playerid, ABusinessData[BusID][BusinessX], ABusinessData[BusID][BusinessY], ABusinessData[BusID][BusinessZ]);
    APlayerData[playerid][CurrentBusiness] = 0;
    ABusinessData[BusID][Owned] = false;
    ABusinessData[BusID][Owner] = 0;
    ABusinessData[BusID][BusinessName] = 0;
    ABusinessData[BusID][BusinessLevel] = 1;
    Dinheiro(playerid, (ABusinessInteriors[BusType][BusPrice] * ABusinessData[BusID][BusinessLevel]) / 2, 0);
    SendClientMessage(playerid, 0xFFFFFFFF, "{00FF00}Voce vendeu seu negocio");
    for (new i; i < MAX_BUSINESSPERPLAYER; i++)
    {
        if (APlayerData[playerid][Business][i] == BusID)
        {
            APlayerData[playerid][Business][i] = 0;
            break;
        }
    }
    Business_UpdateEntrance(BusID);
    PlayerFile_Save(playerid);
    BusinessFile_Save(BusID);
    return 1;
}
Bom espero que tenha gostado!
Gostou Comente ae!


PS: Caso encontre bugґs mande-me mp.

Creditos
*DonSpeed
*Mautito > procura de bugs
*Players do TOB > Ajudou a testar
*E ao criador do GM PowerPC603 !

Ibagens
Reply
#2

Acho que nгo й ъtil vocк tirar um pouco do script do seu gamemode e postar aqui, vai ficar muito estranho, seria melhor se vocк tivesse o feito de raiz! Mesmo assim estб bom
Consegue postar imagens? Obrigado
Reply
#3

Quote:
Originally Posted by BlueX
View Post
Acho que nгo й ъtil vocк tirar um pouco do script do seu gamemode e postar aqui, vai ficar muito estranho, seria melhor se vocк tivesse o feito de raiz! Mesmo assim estб bom
Consegue postar imagens? Obrigado
Este gm e ingles e com varias includes .
Porriso por pedaзos !
Vou tirar fotos.
Reply
#4

Nice!
Reply
#5

Criador do gm й o PowerPC603 Don.

Bom.
Reply
#6

Quote:
Originally Posted by Sky_.
View Post
Nice!
Vlw.

Quote:
Originally Posted by Nill.Oliveira
View Post
Criador do gm й o PowerPC603 Don.

Bom.
Pdc ja dei edit!
Reply
#7

achei legal ia ser bom como dito anteriormente vocк criar o seu proprio do 0 e implantasse este sistema

mбs enfim! rep+
Reply
#8

Quote:
Originally Posted by Alex_Kidds
View Post
achei legal ia ser bom como dito anteriormente vocк criar o seu proprio do 0 e implantasse este sistema

mбs enfim! rep+
Vlw , ja estou a pensar em fazer algum GM do genero porem tenho que ter varias maneiras para deixa-lo salvo pq minha irma sempre estraga meu pc quando ta na metade , hj foi mais um GM e mais uma vez PC zerado!
Reply
#9

Ficou bom !
Reply
#10

Mesmo eu dando uma mгozinha ficou bom!
Parabens.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)