[FilterScript] Sistema de Concessionбrias by: LeLeTe
#21

Й que os carros nao estгo salvando. Jб criei a pasta que foi pedido mas nгo salva nada dentro.
Reply
#22

Gente.


Voltei a scriptar um velho GM de um amigo meu, e ele tб pagando host e tudo (Server de RP).


E entгo, nгo posso dar continuidade a 2.0.


MASSS - Ela vai estar incluida nesse GM.


E.



Eu vou arrumar os bugs, pelo menos.
Reply
#23

Servidor de RP 100% ?
Reply
#24

100%. ._.


Eu era scripter do antigo Connection Los Santos Roleplay


Eu decidi entгo deletar 80% das funзхes do LARP, editar o resto delas, e adicionar mais cosas.


O server serб rodado em FC, com maps por um amigo meu
Reply
#25

Alguem ajuda? ta dando erro na hora de compilar...
__________________________________________________ _____________________________________________
C:\Documents and Settings\Administraзгo\Meus documentos\Downloads\Concessionaria_LeLeTe.pwn(215 ) : error 001: expected token: ";", but found "forward"
C:\Documents and Settings\Administraзгo\Meus documentos\Downloads\Concessionaria_LeLeTe.pwn(216 ) : error 001: expected token: ";", but found "stock"
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


2 Errors.

__________________________________________________ _____________________________________________
Reply
#26

Troca por isso as linahs de erro:

pawn Code:
//1є Erro
forward ini_GetValue( line[] );

//2є Erro
stock ini_GetKey( line[] );
Reply
#27

legal !
Reply
#28

Code:
C:\Users\Cliente\Desktop\.....\filterscripts\Concessionaria_LeLeTe.pwn(129) : error 001: expected token: ";", but found "forward"
C:\Users\Cliente\Desktop\.....\filterscripts\Concessionaria_LeLeTe.pwn(130) : error 001: expected token: ";", but found "stock"
C:\Users\Cliente\Desktop\.....\filterscripts\Concessionaria_LeLeTe.pwn(298) : error 001: expected token: ";", but found "-identifier-"
C:\Users\Cliente\Desktop\.....\filterscripts\Concessionaria_LeLeTe.pwn(502) : error 001: expected token: ";", but found "}"
Linhas de Erros:
128~130
Code:
forward ini_GetKey( line[] )
forward ini_GetValue( line[] )
stock ini_GetKey( line[] )
297~298
Code:
new sendername[MAX_PLAYER_NAME]
        sendername = ReturnPlayerName(playerid);
Esse e um comando mais o erro esta numa chave!

491~502
Code:
    if(strcmp(cmd, "/carros", true) == 0)
    {
        nome = strtok(cmdtext, idx);
        if(!strlen(nome)) return SendClientMessage(playerid, 0xFFFFFF, "Uso: /carros [nome] [preзo] [modelo]");
        preco = strtok(cmdtext, idx);
        if(!strlen(preco)) return SendClientMessage(playerid, 0xFFFFFF, "Uso: /carros [nome] [preзo] [modelo]");
        new price = strval(preco);
        modelo = strtok(cmdtext, idx);
        if(!strlen(modelo)) return SendClientMessage(playerid, 0xFFFFFF, "Uso: /carros [nome] [preзo] [modelo]");
        new model = strval(modelo);
        Concessionaria(playerid, nome, price, model, SPAWN_X, SPAWN_Y, SPAWN_Z, ANGULO)
    }
Code:
}
Reply
#29

Como eu tinha dito, falta de ";"
pawn Code:
forward ini_GetKey( line[] );
forward ini_GetValue( line[] );
stock ini_GetKey( line[] )

new sendername[MAX_PLAYER_NAME];
sendername = ReturnPlayerName(playerid);

Esse e um comando mais o erro esta numa chave!

    if(strcmp(cmd, "/carros", true) == 0)
    {
        nome = strtok(cmdtext, idx);
        if(!strlen(nome)) return SendClientMessage(playerid, 0xFFFFFF, "Uso: /carros [nome] [preзo] [modelo]");
        preco = strtok(cmdtext, idx);
        if(!strlen(preco)) return SendClientMessage(playerid, 0xFFFFFF, "Uso: /carros [nome] [preзo] [modelo]");
        new price = strval(preco);
        modelo = strtok(cmdtext, idx);
        if(!strlen(modelo)) return SendClientMessage(playerid, 0xFFFFFF, "Uso: /carros [nome] [preзo] [modelo]");
        new model = strval(modelo);
        Concessionaria(playerid, nome, price, model, SPAWN_X, SPAWN_Y, SPAWN_Z, ANGULO);
    }
Reply
#30

Lelete seu FS e Legal mais eu acho que esta bugado pois quamdo eu digito /concessionaria e seleciono a classe de
carros nao aparece nada nemhum dialogo como prometido voce pode me ajudar com isso ou algem?

FS:


Code:
// This is a comment
// uncomment the line below if you want to write a filterscript
#define FILTERSCRIPT

#define CARROS 1 //Coloque aqui a quantidade de carros no seu servidor +1
#define MAX_CARROS 10 //Aqui, coloque o limite de carros do FS.
#define SPAWN_X 2128.7856//Aqui, defina a posiзгo X de spawn dos carros recйm-comprados da concessionбria.
#define SPAWN_Y -1142.3700//Aqui, defina a posiзгo Y de spawn dos carros recйm-comprados da concessionбria.
#define SPAWN_Z 25.0067//Aqui, defina a posiзгo Z de spawn dos carros recйm-comprados da concessionбria.
#define ANGULO 359.1015//Aqui, defina o вngulo de spawn dos carros recйm-comprados da concessionбria.
#define Car_Infernus 30000
#define Car_Cheetah 30000
#define Car_Banshee 30000
#define Car_Hotknife 30000
#define Car_Turismo 30000
#define Car_ZR_350 30000
#define Car_Comet 30000
#define Car_Super_GT 30000
#define Car_Windsor 30000
#define Car_Feltzer 30000
#define Car_Euros 30000

#include <a_samp>
#include <core>
#include <float>
#include <time>
#include <file>

#pragma tabsize 0

new Text:Black0;
new Text:Black1;
new Text:Black2;
new Text:Black3;
new Text:LightBlack;
new Text:VHS[MAX_PLAYERS];
new bool:TextShow[MAX_PLAYERS];
new bool:VHSCreated[MAX_PLAYERS];
new Text3D:Placa[MAX_CARROS];
new gPlaca[MAX_PLAYERS][256];

stock strtok(const string[], &index)
{
    new length = strlen(string);
    while ((index < length) && (string[index] <= ' '))
    {
        index++;
    }

    new offset = index;
    new result[20];
    while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
    {
        result[index - offset] = string[index];
        index++;
    }
    result[index - offset] = EOS;
    return result;
}

stock ReturnPlayerName( playerid )
{
    new
    NameString[ MAX_PLAYER_NAME ],
    stringPos;
    GetPlayerName( playerid, NameString, MAX_PLAYER_NAME );
    stringPos = strfind( NameString, "_" );
    NameString[ stringPos ] = ' ';
    return NameString;
}

enum jInfo
{
    jChaveDoCarro,
    jPlaca[128],
}

new JogadorDataBase[MAX_PLAYERS][jInfo];

forward J_Salvar(playerid);
forward J_Carregar(playerid);
public J_Salvar(playerid)
{
    if(IsPlayerConnected(playerid))
    {
        new string3[64];
        new playername3[MAX_PLAYER_NAME];
        GetPlayerName(playerid, playername3, sizeof(playername3));
        format(string3, sizeof(string3), "LeLeTe/%s.ini", playername3);
        new File: hFile = fopen(string3, io_write);
        if (hFile)
        {
            new var[256];
            format(var, 64, "jChaveDoCarro=%d\r\n", JogadorDataBase[playerid][jChaveDoCarro]);fwrite(hFile, var);
            format(var, 64, "jPlaca=%s\r\n", JogadorDataBase[playerid][jPlaca]);fwrite(hFile, var);
            format(var, 255, "gPlaca=%s\r\n", gPlaca[playerid]);fwrite(hFile, var);
            fclose(hFile);
        }
    }
    return 1;
}

public J_Carregar(playerid)
{
    new string2[64];
    new playername2[MAX_PLAYER_NAME];
    new playernamesplit[3][MAX_PLAYER_NAME];
    GetPlayerName(playerid, playername2, sizeof(playername2));
    split(playername2, playernamesplit, '_');
    format(string2, sizeof(string2), "LeLeTe/%s.ini", playername2);
    new File: UserFile = fopen(string2, io_read);
    if ( UserFile )
    {
        new key[256], val[ 256 ];
        new Data[ 256 ];
        while ( fread( UserFile , Data , sizeof( Data ) ) )
        {
            key = ini_GetValue( Data );
            if( strcmp( key , "jChaveDoCarro" , true ) == 0 ) { val = ini_GetValue( Data ); JogadorDataBase[playerid][jChaveDoCarro] = strval( val ); }
            if( strcmp( key , "jPlaca" , true ) == 0 ) { val = ini_GetValue( Data ); strmid(JogadorDataBase[playerid][jPlaca], val, 0, strlen(val)-1, 255); }
            if( strcmp( key , "gPlaca" , true ) == 0 ) { val = ini_GetValue( Data ); strmid(gPlaca[playerid], val, 0, strlen(val)-1, 255); }
        }
        fclose(UserFile);
    }
    return 1;
}

forward ini_GetKey( line[] );
forward ini_GetValue( line[] );
stock ini_GetKey( line[] )
{
    new keyRes[256];
    keyRes[0] = 0;
    if ( strfind( line , "=" , true ) == -1 ) return keyRes;
    strmid( keyRes , line , 0 , strfind( line , "=" , true ) , sizeof( keyRes) );
    return keyRes;
}

stock ini_GetValue( line[] )
{
    new valRes[256];
    valRes[0]=0;
    if ( strfind( line , "=" , true ) == -1 ) return valRes;
    strmid( valRes , line , strfind( line , "=" , true )+1 , strlen( line ) , sizeof( valRes ) );
    return valRes;
}

forward split(const strsrc[], strdest[][], delimiter);
public split(const strsrc[], strdest[][], delimiter)
{
    new i, li;
    new aNum;
    new len;
    while(i <= strlen(strsrc)){
        if(strsrc[i]==delimiter || i==strlen(strsrc)){
            len = strmid(strdest[aNum], strsrc, li, i, 128);
            strdest[aNum][len] = 0;
            li = i+1;
            aNum++;
        }
        i++;
    }
    return 1;
}

enum Carros
{
    cModelo,
    Float:cx,
    Float:cy,
    Float:cz,
    Float:cangulo,
    cCor1,
    cCor2,
    cDono[MAX_PLAYER_NAME],
    cNome[MAX_PLAYER_NAME],
    cValor,
    cArrayQualquer,
    cRegistrado,
    cComprado,
    cTrava,
    cPlaca[30],
};

new CarrosInfo[MAX_CARROS][Carros];

forward OnPlayerEnterVehicle(playerid, vehicleid, ispassenger);
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
    if(CarrosInfo[vehicleid][cTrava] == 1 && CarrosInfo[vehicleid][cComprado] == 1)
    {
        new Float:Cx, Float:Cy, Float:Cz;
        GetPlayerPos(playerid, Cx, Cy, Cz);
        SetPlayerPos(playerid, Cx, Cy, Cz);
    }
    new string[128];
    format(string,sizeof(string),"|| Dono deste carro: %s ||",CarrosInfo[vehicleid][cDono]);
    SendClientMessage(playerid, 0x1A1AFFAA, string);
    return 1;
}

forward CarregarCarros();
public CarregarCarros()
{
    new arrCoords[14][64];
    new strFromFile2[256];
    new File: file = fopen("LeLeTe/Concessionaria_Carros.cfg", io_read);
    if (file)
    {
        new idx = CARROS;
        while (idx < sizeof(CarrosInfo))
        {
            fread(file, strFromFile2);
            split(strFromFile2, arrCoords, ',');
            CarrosInfo[idx][cModelo] = strval(arrCoords[0]);
            CarrosInfo[idx][cx] = floatstr(arrCoords[1]);
            CarrosInfo[idx][cy] = floatstr(arrCoords[2]);
            CarrosInfo[idx][cz] = floatstr(arrCoords[3]);
            CarrosInfo[idx][cangulo] = floatstr(arrCoords[4]);
            CarrosInfo[idx][cCor1] = strval(arrCoords[5]);
            CarrosInfo[idx][cCor2] = strval(arrCoords[6]);
            strmid(CarrosInfo[idx][cDono], arrCoords[7], 0, strlen(arrCoords[7]), 255);
            strmid(CarrosInfo[idx][cNome], arrCoords[8], 0, strlen(arrCoords[8]), 255);
            CarrosInfo[idx][cValor] = strval(arrCoords[9]);
            CarrosInfo[idx][cRegistrado] = strval(arrCoords[10]);
            CarrosInfo[idx][cComprado] = strval(arrCoords[11]);
            CarrosInfo[idx][cTrava] = strval(arrCoords[12]);
            strmid(CarrosInfo[idx][cPlaca], arrCoords[13], 0, strlen(arrCoords[13]), 30);
            printf("Nome do Carro: %d Dono:%s Placa %s",idx,CarrosInfo[idx][cDono],CarrosInfo[idx][cPlaca]);
            idx++;
        }
    }
    return 1;
}

forward SalvarCarros();
public SalvarCarros()
{
    new File: file2;
    new idx = CARROS;
    while (idx < sizeof(CarrosInfo))
    {
        new coordsstring[256];
        format(coordsstring, sizeof(coordsstring), "%d,%f,%f,%f,%f,%d,%d,%s,%s,%d,%d,%d,%d,%s\r\n",
        CarrosInfo[idx][cModelo],//
        CarrosInfo[idx][cx],//
        CarrosInfo[idx][cy],//
        CarrosInfo[idx][cz],//
        CarrosInfo[idx][cangulo],//
        CarrosInfo[idx][cCor1],//
        CarrosInfo[idx][cCor1],//
        CarrosInfo[idx][cDono],//
        CarrosInfo[idx][cNome],//
        CarrosInfo[idx][cValor],//
        CarrosInfo[idx][cRegistrado],//
        CarrosInfo[idx][cComprado],//
        CarrosInfo[idx][cTrava],
        CarrosInfo[idx][cPlaca]);
        if(idx == CARROS)
        {
            file2 = fopen("LeLeTe/Concessionaria_Carros.cfg", io_write);
        }
        else
        {
            file2 = fopen("LeLeTe/Concessionaria_Carros.cfg", io_append);
        }
        fwrite(file2, coordsstring);
        idx++;
        fclose(file2);
    }
    return 1;
}

stock CheckPlayerDistanceToVehicle(Float:radi, playerid, vehicleid)
{
    if(IsPlayerConnected(playerid))
    {
        new Float:PX,Float:PY,Float:PZ,Float:X,Float:Y,Float:Z;
        GetPlayerPos(playerid,PX,PY,PZ);
        GetVehiclePos(vehicleid, X,Y,Z);
        new Float:Distance = (X-PX)*(X-PX)+(Y-PY)*(Y-PY)+(Z-PZ)*(Z-PZ);
        if(Distance <= radi*radi)
        {
            return 1;
        }
    }
    return 0;
}

stock Concessionaria(playerid, nomedocarro[MAX_PLAYER_NAME], preco, modelo, Float:posX, Float:posY, Float:posZ, Float:angulo)
{
    if(GetPlayerMoney(playerid) >= preco )
    {
        new colorOne = 0 + random(255);
        new colorTwo = 0 + random(255);
        new idcar = AddStaticVehicleEx(modelo,posX,posY,posZ,angulo,colorOne,colorTwo,60000);
        new sendername[MAX_PLAYER_NAME];
        sendername = ReturnPlayerName(playerid);
        strmid(CarrosInfo[idcar][cDono], sendername, 0, strlen(sendername), 999);
        new result[128];
        format(result, sizeof(result), "[Por:LeLeTe]\n[|%s|]", nomedocarro);
        Placa[idcar] = Create3DTextLabel(result, 0xFFFFFFFF, 0.0, 0.0, 0.0, 50.0, -1, 0);
        Attach3DTextLabelToVehicle(Placa[idcar],idcar, 0.0, -2.9, 0.0);
        GivePlayerMoney(playerid,-preco);
        SendClientMessage(playerid, 0xFFFFFFFF, "Parabйns pelo seu carro!");
        JogadorDataBase[playerid][jChaveDoCarro] = idcar;
        CarrosInfo[idcar][cModelo] = modelo;
        CarrosInfo[idcar][cx] = posX;
        CarrosInfo[idcar][cy] = posY;
        CarrosInfo[idcar][cz] = posZ;
        CarrosInfo[idcar][cangulo] = angulo;
        CarrosInfo[idcar][cCor1] = colorOne;
        CarrosInfo[idcar][cCor2] = colorTwo;
        CarrosInfo[idcar][cValor] = preco;
        CarrosInfo[idcar][cNome] = nomedocarro;
        SalvarCarros();
        J_Salvar(playerid);
    }
}

public OnFilterScriptInit()
{
    CarregarCarros();
    print("\n--------------------------------------");
    print(" Sistema de Concessionбrias por: LeLeTe v1.5");
    print("--------------------------------------\n");
    for(new h = CARROS; h < sizeof(CarrosInfo); h++)
    {
        AddStaticVehicleEx(CarrosInfo[h][cModelo],CarrosInfo[h][cx],CarrosInfo[h][cy],CarrosInfo[h][cz]+1.0,CarrosInfo[h][cangulo],CarrosInfo[h][cCor1],CarrosInfo[h][cCor2],60000);
        new result[200];
        format(result, sizeof(result), "[Placa]\n[|%s|]", CarrosInfo[h][cPlaca]);
        Placa[h] = Create3DTextLabel(result, 0xFFFFFFFF, 0.0, 0.0, 0.0, 50.0, -1, 0);
        Attach3DTextLabelToVehicle(Placa[h], h, 0.0, -2.9, 0.0);
    }
    // TextDraws do Velocнmetro
    Black0 = TextDrawCreate(537.000000,133.000000," ");
    Black1 = TextDrawCreate(537.000000,133.000000," ");
    Black2 = TextDrawCreate(537.000000,170.000000," ");
    Black3 = TextDrawCreate(593.000000,133.000000," ");
    LightBlack = TextDrawCreate(541.000000,136.000000," ");
    TextDrawUseBox(Black0,1);
    TextDrawBoxColor(Black0,0x000000ff);
    TextDrawTextSize(Black0,593.000000,0.000000);
    TextDrawUseBox(Black1,1);
    TextDrawBoxColor(Black1,0x000000ff);
    TextDrawTextSize(Black1,537.000000,0.000000);
    TextDrawUseBox(Black2,1);
    TextDrawBoxColor(Black2,0x000000ff);
    TextDrawTextSize(Black2,593.000000,0.000000);
    TextDrawUseBox(Black3,1);
    TextDrawBoxColor(Black3,0x000000ff);
    TextDrawTextSize(Black3,593.000000,0.000000);
    TextDrawUseBox(LightBlack,1);
    TextDrawBoxColor(LightBlack,0x00000033);
    TextDrawTextSize(LightBlack,589.000000,0.000000);
    TextDrawAlignment(Black0,0);
    TextDrawAlignment(Black1,0);
    TextDrawAlignment(Black2,0);
    TextDrawAlignment(Black3,0);
    TextDrawAlignment(LightBlack,0);
    TextDrawBackgroundColor(Black0,0x000000ff);
    TextDrawBackgroundColor(Black1,0x000000ff);
    TextDrawBackgroundColor(Black2,0x000000ff);
    TextDrawBackgroundColor(Black3,0x000000ff);
    TextDrawBackgroundColor(LightBlack,0x000000ff);
    TextDrawFont(Black0,3);
    TextDrawLetterSize(Black0,1.000000,-0.000000);
    TextDrawFont(Black1,3);
    TextDrawLetterSize(Black1,1.300000,4.000000);
    TextDrawFont(Black2,3);
    TextDrawLetterSize(Black2,11.100000,-0.000000);
    TextDrawFont(Black3,3);
    TextDrawLetterSize(Black3,1.000000,4.099998);
    TextDrawFont(LightBlack,3);
    TextDrawLetterSize(LightBlack,1.000000,3.399999);
    TextDrawColor(Black0,0xffffffff);
    TextDrawColor(Black1,0xffffffff);
    TextDrawColor(Black2,0xffffffff);
    TextDrawColor(Black3,0xffffffff);
    TextDrawColor(LightBlack,0xffffffff);
    TextDrawSetOutline(Black0,1);
    TextDrawSetOutline(Black1,1);
    TextDrawSetOutline(Black2,1);
    TextDrawSetOutline(Black3,1);
    TextDrawSetOutline(LightBlack,1);
    TextDrawSetProportional(Black0,1);
    TextDrawSetProportional(Black1,1);
    TextDrawSetProportional(Black2,1);
    TextDrawSetProportional(Black3,1);
    TextDrawSetProportional(LightBlack,1);
    TextDrawSetShadow(Black0,1);
    TextDrawSetShadow(Black1,1);
    TextDrawSetShadow(Black2,1);
    TextDrawSetShadow(Black3,1);
    TextDrawSetShadow(LightBlack,1);
    SetTimer("DashBoard", 50, 1);
    return 0;
}

public OnPlayerConnect(playerid)
{
   J_Carregar(playerid);
   return 1;
}

forward DashBoard();
public DashBoard()
{
    for(new i=0; i<MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i))
        {
            if(IsPlayerInAnyVehicle(i))
            {
                if(TextShow[i] == false)
                {
                    TextDrawShowForPlayer(i, Text:Black0);
                    TextDrawShowForPlayer(i, Text:Black1);
                    TextDrawShowForPlayer(i, Text:Black2);
                    TextDrawShowForPlayer(i, Text:Black3);
                    TextDrawShowForPlayer(i, Text:LightBlack);
                    TextShow[i] = true;
                }
                new String[128];
                new Float:X, Float:Y, Float:Z, Float:Speed;
                GetVehicleVelocity(GetPlayerVehicleID(i), X, Y, Z);
                Speed = floatmul(floatmul(floatsqroot(floatadd(floatadd(floatpower(X, 2), floatpower(Y, 2)),  floatpower(Z, 2))), 100.0), 1.5);
                format(String,sizeof(String),"~b~Velocimetro~n~~r~Velocidade~n~~r~KM/H: ~w~%i", floatround(Speed, floatround_floor));
                if(VHSCreated[i] == true)
                {
                    TextDrawDestroy(VHS[i]);
                }
                VHS[i] = TextDrawCreate(541.000000,137.000000,String);
                TextDrawAlignment(VHS[i],0);
                TextDrawBackgroundColor(VHS[i],0x000000ff);
                TextDrawFont(VHS[i],1);
                TextDrawLetterSize(VHS[i],0.299999,1.000000);
                TextDrawColor(VHS[i],0xffffffff);
                TextDrawSetOutline(VHS[i],1);
                TextDrawSetProportional(VHS[i],1);
                TextDrawSetShadow(VHS[i],1);
                TextDrawShowForPlayer(i, VHS[i]);
                VHSCreated[i] = true;

            }
            else
            {
                if(TextShow[i] == true)
                {
                    TextDrawHideForPlayer(i, Text:Black0);
                    TextDrawHideForPlayer(i, Text:Black1);
                    TextDrawHideForPlayer(i, Text:Black2);
                    TextDrawHideForPlayer(i, Text:Black3);
                    TextDrawHideForPlayer(i, Text:LightBlack);
                    TextDrawHideForPlayer(i, Text:VHS[i]);
                    TextShow[i] = false;
                }
            }
        }
    }
}

public OnFilterScriptExit()
{
    SalvarCarros();
    for(new h = 0; h < sizeof(CarrosInfo); h++)
    {
        DestroyVehicle(h);
        Delete3DTextLabel(Placa[h]);
    }
    return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
    new cmd[128], nome[MAX_PLAYER_NAME], preco[128], modelo[128], idx;
    cmd = strtok(cmdtext, idx);
    if(strcmp(cmdtext, "/meucarro", true) == 0)
    {
        if(GetPlayerVehicleID(playerid) == JogadorDataBase[playerid][jChaveDoCarro])
        {
            ShowPlayerDialog(playerid, 5000, DIALOG_STYLE_LIST, "Meu Carro", "Placa\nEstacionar\nTrancar", "Acessar", "Cancelar");
            return 1;
        }
        else
        {
            SendClientMessage(playerid, 0xFFFFFFFF, "Vocк nгo tem um carro, ou nгo estб nele!");
            return 1;
        }
    }
    if(strcmp(cmd, "/carros", true) == 0)
    {
        nome = strtok(cmdtext, idx);
        if(!strlen(nome)) return SendClientMessage(playerid, 0xFFFFFF, "Uso: /carros [nome] [preзo] [modelo]");
        preco = strtok(cmdtext, idx);
        if(!strlen(preco)) return SendClientMessage(playerid, 0xFFFFFF, "Uso: /carros [nome] [preзo] [modelo]");
        new price = strval(preco);
        modelo = strtok(cmdtext, idx);
        if(!strlen(modelo)) return SendClientMessage(playerid, 0xFFFFFF, "Uso: /carros [nome] [preзo] [modelo]");
        new model = strval(modelo);
        Concessionaria(playerid, nome, price, model, SPAWN_X, SPAWN_Y, SPAWN_Z, ANGULO);
    }
    if(strcmp(cmdtext, "/concessionaria", true) == 0)
    {
        ShowPlayerDialog(playerid, 5100, DIALOG_STYLE_LIST, "Concessionбria", "Suvs & Vans\nSedans & Compactos\nSedans de Luxo\nMuscle Cars\nCarros de Rua\nCarros Esporte\nCaminhхes, Utilitбrios e Picapes\nLowriders\nBicicletas e Motocicletas", "Acessar", "Cancelar");
        return 1;
    }
    if(strcmp(cmdtext, "/irconcessionaria", true) == 0)
    {
        SetPlayerPos(playerid, SPAWN_X, SPAWN_Y, SPAWN_Z);
        return 1;
    }
    return 0;
}

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    new playername[MAX_PLAYER_NAME];
    if(IsPlayerConnected(playerid))
    {
        if(dialogid == 5000)
        {
            if(response)
            {
                if(listitem == 0)
                {
                    ShowPlayerDialog(playerid, 5001,DIALOG_STYLE_INPUT, "Minha Placa", "Digite aqui o texto de sua placa!", "Aceitar", "Cancelar");
                    return 1;
                }
                if(listitem == 1)
                {
                    new Float:x,Float:y,Float:z;
                    new Float:a;
                    new carid;
                    new getcarid;
                    carid = JogadorDataBase[playerid][jChaveDoCarro];
                    getcarid = GetPlayerVehicleID(playerid);
                    GetPlayerName(playerid, playername, sizeof(playername));
                    GetVehiclePos(carid, x, y, z);
                    GetVehicleZAngle(carid, a);
                    if(IsPlayerInVehicle(playerid,carid) && CarrosInfo[carid][cComprado] == 1)
                    {
                        if(carid != getcarid)
                        {
                            SendClientMessage(playerid, 0xFFFFFFFF, "Vocк nгo tem um carro, ou nгo estб nele!");
                            return 1;
                        }
                        if(getcarid == carid)
                        {
                            CarrosInfo[carid][cx] = x;
                            CarrosInfo[carid][cy] = y;
                            CarrosInfo[carid][cz] = z;
                            CarrosInfo[carid][cangulo] = a;
                            GameTextForPlayer(playerid, "Voce acaba de estacionar seu carro nessa posicao!", 1000, 3);
                            SalvarCarros();
                            DestroyVehicle(carid);
                            CreateVehicle(CarrosInfo[carid][cModelo],CarrosInfo[carid][cx],CarrosInfo[carid][cy],CarrosInfo[carid][cz]+1.0,CarrosInfo[carid][cangulo],CarrosInfo[carid][cCor1],CarrosInfo[carid][cCor2],60000);
                            TogglePlayerControllable(playerid, 1);
                            return 1;
                        }
                    }
                }
                if(listitem == 2)
                {
                    new CarKey = JogadorDataBase[playerid][jChaveDoCarro];
                    if(CarKey == CarrosInfo[CarKey][cRegistrado])
                    {
                        if(CarrosInfo[CarKey][cTrava] == 1)
                        {
                           for(new i = 0; i < MAX_PLAYERS; i++)
                           {
                                if (IsPlayerConnected(i))
                                {
                                    SetVehicleParamsForPlayer(CarKey,i,0,0);
                                }
                           }
                           GameTextForPlayer(playerid, "~w~Carro~n~~g~Destrancado", 4000, 3);
                           CarrosInfo[CarKey][cTrava] = 0;
                           SalvarCarros();
                           return 1;
                       }
                       else if(CarrosInfo[CarKey][cTrava] == 0)
                       {
                           for(new i = 0; i < MAX_PLAYERS; i++)
                           {
                               if (IsPlayerConnected(i))
                               {
                                    SetVehicleParamsForPlayer(CarKey,i,0,1);
                               }
                           }
                           GameTextForPlayer(playerid, "~w~Carro~n~~r~trancado", 4000, 3);
                           CarrosInfo[CarKey][cTrava] = 1;
                           SalvarCarros();
                           return 1;
                        }
                        else
                        {
                            SendClientMessage(playerid, 0xFFFFFFFF, " Vocк nгo estб perto de seu carro, ou nгo tem um carro!");
                            return 1;
                        }
                   }
                }
            }
        }
        if(dialogid == 5001)
        {
            if(response)
            {
                new plate[128], inputtext0[255];
                new carid = GetPlayerVehicleID(playerid);
                format(inputtext0, sizeof(inputtext0), "%s", inputtext);
                strmid(gPlaca[playerid], inputtext0, 0, 254, 255);
                strmid(JogadorDataBase[playerid][jPlaca], inputtext, 0, 127);
                strmid(CarrosInfo[carid][cPlaca], inputtext, 0, 29);
                J_Salvar(playerid);
                SalvarCarros();
                format(plate, sizeof(plate), "Vocк digitou o texto: %s", inputtext);
                SendClientMessage(playerid, 0xFFFFFFFF, plate);
                Placa[carid] = Create3DTextLabel(inputtext, 0xFFFFFFFF, 0.0, 0.0, 0.0, 60, -1, 0);
                Attach3DTextLabelToVehicle(Placa[carid], carid, 0.0, -2.9, 0.0);
                ShowPlayerDialog(playerid, 5002, DIALOG_STYLE_LIST,"Cores de Placa", "Marrom\nPreto\nAzul\nVerde\nBranco\nVermelho\nAmarelo\nAzul Claro\nVerde Escuro", "Selecionar", "Sair");
            }
            return 1;
        }
        if(dialogid == 5002)
        {
            if(response)
            {
                new carid = GetPlayerVehicleID(playerid);
                new result[200];
                format(result, sizeof(result), "[Placa]\n[|%s|]", gPlaca[playerid]);
                if(listitem == 0)
                {
                    Update3DTextLabelText(Placa[carid], 0x6D3636FF, result);
                }
                if(listitem == 1)
                {
                    Update3DTextLabelText(Placa[carid], 0x000000FF, result);
                }
                if(listitem == 2)
                {
                    Update3DTextLabelText(Placa[carid], 0x2828FFFF, result);
                }
                if(listitem == 3)
                {
                    Update3DTextLabelText(Placa[carid], 0x00C10AFF, result);
                }
                if(listitem == 4)
                {
                    Update3DTextLabelText(Placa[carid], 0xFFFFFFFF, result);
                }
                if(listitem == 5)
                {
                    Update3DTextLabelText(Placa[carid], 0xFF0006FF, result);
                }
                if(listitem == 6)
                {
                    Update3DTextLabelText(Placa[carid], 0xFFFF00FF, result);
                }
                if(listitem == 7)
                {
                    Update3DTextLabelText(Placa[carid], 0x00FFFFFF, result);
                }
                if(listitem == 8)
                {
                    Update3DTextLabelText(Placa[carid], 0x008000FF, result);
                }
                Attach3DTextLabelToVehicle(Placa[GetPlayerVehicleID(playerid)], carid, 0.0,-2.9,0.0);
                SendClientMessage(playerid, 0xFFFFFFFF, "PARABЙNS! Sua placa estб completa e instalada!");
            }
            return 1;
        }
        if(dialogid == 5100)
        {
            if(response)
            {
                if (listitem == 0)
                {
                    Concessionaria(playerid, "Infernus", Car_Infernus, 411, SPAWN_X, SPAWN_Y, SPAWN_Z, ANGULO);
                }
                if(listitem == 1)
                {
                    Concessionaria(playerid, "Cheetah", Car_Cheetah, 415, SPAWN_X, SPAWN_Y, SPAWN_Z, ANGULO);
                }
                if(listitem == 2)
                {
                    Concessionaria(playerid, "Banshee", Car_Banshee, 429, SPAWN_X, SPAWN_Y, SPAWN_Z, ANGULO);
                }
                if(listitem == 3)
                {
                    Concessionaria(playerid, "Hotknife", Car_Hotknife, 434, SPAWN_X, SPAWN_Y, SPAWN_Z, ANGULO);
                }
                if(listitem == 4)
                {
                    Concessionaria(playerid, "Turismo", Car_Turismo, 451, SPAWN_X, SPAWN_Y, SPAWN_Z, ANGULO);
                }
                if(listitem == 5)
                {
                    Concessionaria(playerid, "ZR 350", Car_ZR_350, 477, SPAWN_X, SPAWN_Y, SPAWN_Z, ANGULO);
                }
                if(listitem == 6)
                {
                    Concessionaria(playerid, "Comet", Car_Comet, 480, SPAWN_X, SPAWN_Y, SPAWN_Z, ANGULO);
                }
                if (listitem == 7)
                {
                    Concessionaria(playerid, "Super GT", Car_Super_GT, 506, SPAWN_X, SPAWN_Y, SPAWN_Z, ANGULO);
                }
                if (listitem == 8)
                {
                    Concessionaria(playerid, "Windsor", Car_Windsor, 555, SPAWN_X, SPAWN_Y, SPAWN_Z, ANGULO);
                }
                if (listitem == 9)
                {
                    Concessionaria(playerid, "Feltzer", Car_Feltzer, 533, SPAWN_X, SPAWN_Y, SPAWN_Z, ANGULO);
                }
                if (listitem == 10)
                {
                    Concessionaria(playerid, "Euros", Car_Euros, 587, SPAWN_X, SPAWN_Y, SPAWN_Z, ANGULO);
                }
            }
        }
    }
    else
    {
       return 0;
    }
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)