[Ajuda] Concessionбria
#1

Assim, baixei um FS de concessionбria aqui do fуrum e ele й assim:
vocк cria os carros, eles ficam estacionados onde vc os criou, aн vc entra em um deles pra comprar e quando compra, outro desse carro й criado pra vc, por exemplo,
vc quer comprar um yosemite, vc entrou na yosemite que tem estacionada lб e compra ela, daн vc й teleportado pra uma cordenada com uma yosemite nova sу sua, eu gostaria que NГO CRIASSE UM CARRO NOVO, que o player comprasse direto aquele carro que tб estacionado no local, podendo assim ter apenas 1 carro daquele tipo a venda e sу 1 pessoa teria, e tambйm queria que o carro nгo sumisse ao ser vendido, mas sim voltasse pra concessionбria onde foi criado e voltasse a estar a venda, como faзo isso?

esse o й FS: Concessionбria
pawn Code:
/*
>>>>>>>>>>>>>>>>>>>> Como adicionar Veiculos para venda no FilterScripts

- > Primeiro :

Adicionar no InfoVenda um valor atribuido ao Veiculo
 Exemplo :
 ID | Preзo
 \/    \/
{455,500000}

- > Segundo :

No 'CarrosConcessionaria' , adicione um numero a mais e crie-o no 'OnGameModeInit'
Para tranca-lo vб em OnPlayerConnect e vocк aprenderб rapidamente.

- > Terзeiro :
Adicionar no 'ShowPlayerDialog' do '/comprarcarro' o nome do veiculo.
Exemplo
'\nFlatbed\n'

- > Quarto e Ultimo :
Na Public de forзar o valor do veiculo. Adicione um novo 'case' para forзar e mostrar no dialog o valor do veiculo.
 Exemplo :
 case: 455 = InfoVenda [ playerid ] [ PrecoCarro ] = 250000 ;
O numero ao lado do 'case' , significa o ID do veiculo.
O '250000' й o preзo do veiculo.

 -------------------- Seguindo essas instruзхes , vocк conseguirб fazer um veiculo a venda sem Bugґs !

>>>>>>>>>>>>>>>>>>>>> Comandos do FilterScript :

/comprarcarro
/vendercarro
/estacionar
/localizarcarro
/pintar



>>>>>>>>>>>>>>>>>>>>>>>>>>>> Crйditos :
                            []BlackGangsta[] - Idealizador e Criador
                            Josma_CMD - Ajudante - Ajudou em varias coisas no Game Mode


*/

#include < a_samp >
#include < Dini >

forward PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z);

enum iCarro
{
    s_Dono[ 24 ],
    s_Modelo,
    Float:s_PosX,
    Float:s_PosY,
    Float:s_PosZ,
    Float:s_PosA,
    s_Cor1,
    s_Cor2,
    s_Respawn
};
new
    InfoCarro [ MAX_PLAYERS ] [ iCarro ] ,
    CarroConcessionaria [ 10 ] ,
    CarroJogador [ MAX_PLAYERS ] ,
    String [ 128 ] ,
    Checkpoint [ MAX_PLAYERS ] ,
    ModeloIDCarro [ MAX_PLAYERS ]
    ;

enum iVenda {ModeloCarro,PrecoCarro};
new
    InfoVenda[10][iVenda] =
{  //Modelo, Nome, Preco
    {439,1000000}, // Stallion = 1,000.000
    {518,800000}, // Bucaneer = 800.000
    {549,900000}, // Tampa = 900.000
    {542,750000}, // Clover = 750.000
    {587,1000000}, // Euros = 1,000.000
    {483,700000}, // Camper = 700.000
    {550,780000}, // Sunrise = 780.000
    {580,740000}, // Stafford = 740.000
    {554,720000}, // Yosemite = 720.000
    {468,670000} // Sanchez = 670.000
};

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);
        //printf("DEBUG: X:%f Y:%f Z:%f",posx,posy,posz);
        if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
        {
            return 1;
        }
    }
    return 0;
}

public
    OnVehicleSpawn ( vehicleid )
{
    for(new i ; i < MAX_PLAYERS ; ++i)
    {
            format ( String , 30 , "GMNovo/CarrosProprios/%s.ini" , PlayerName ( i ) ) ;
            if ( fexist ( String ) )
            {
                if ( dini_Int ( String , "Estacionado" ) == 10 )
                {
                    SetVehiclePos ( vehicleid , dini_Int ( String , "PosX" ) , dini_Int ( String , "PosY" ) , dini_Int ( String , "PosZ" ) ) ;
                }
            }
        }
    return true ;
}

public
    OnGameModeInit ( )
    {

    CarroConcessionaria [ 0 ] = CreateVehicle (439,1648.8824,-1079.9027,23.6294,89.9744,0,1,50000);
    CarroConcessionaria [ 1 ] = CreateVehicle (518,1648.8286,-1084.7128,23.6332,90.0272,0,1,50000);
    CarroConcessionaria [ 2 ] = CreateVehicle (549,1649.0682,-1089.0574,23.6333,89.8122,0,1,50000);
    CarroConcessionaria [ 3 ] = CreateVehicle (542,1648.8564,-1093.5950,23.6333,89.1213,0,1,50000);
    CarroConcessionaria [ 4 ] = CreateVehicle (587,1649.4242,-1098.0247,23.6333,90.2521,0,1,50000);
    CarroConcessionaria [ 5 ] = CreateVehicle (483,1649.3087,-1102.5265,23.6333,89.6396,0,1,50000);
    CarroConcessionaria [ 6 ] = CreateVehicle (550,1649.2238,-1107.1091,23.6333,90.3518,0,1,50000);
    CarroConcessionaria [ 7 ] = CreateVehicle (580,1649.0168,-1111.6848,23.6411,90.2045,0,1,50000);
    CarroConcessionaria [ 8 ] = CreateVehicle (554,1630.0378,-1098.5574,23.6333,270.4074,0,1,50000);
    CarroConcessionaria [ 9 ] = CreateVehicle (468,1630.0051,-1094.0928,23.6372,269.2899,0,1,50000);

    return true;
}

public
    OnGameModeExit ( )
    {
    SetTimer ( "GameModeExitFunc" , 2000 , 0 ) ;
    return true ;
}

public
    OnPlayerConnect ( playerid )
    {
        new
             iEngine , iEngine2 , iEngine3 , iEngine4 ,
             iLights , iLights2 , iLights3 , iLights4 ,
             iAlarm , iAlarm2 , iAlarm3 , iAlarm4 ,
             iDoors , iDoors2 , iDoors3 , iDoors4 ,
             iBonnet , iBonnet2 , iBonnet3 , iBonnet4 ,
             iBoot , iBoot2 , iBoot3 , iBoot4 ,
             iObjective , iObjective2 , iObjective3 , iObjective4
         ;

        GetVehicleParamsEx ( CarroConcessionaria [ 0 ] , iEngine , iLights , iAlarm , iDoors , iBonnet , iBoot , iObjective ) ;
        SetVehicleParamsEx ( CarroConcessionaria [ 0 ] , false , false , false , false , false , false , 0 ) ;

        GetVehicleParamsEx ( CarroConcessionaria [ 1 ] , iEngine2 , iLights2 , iAlarm2 , iDoors2 , iBonnet2 , iBoot2 , iObjective2 ) ;
        SetVehicleParamsEx ( CarroConcessionaria [ 1 ] , false , false , false , false , false , false , 0 ) ;

        GetVehicleParamsEx ( CarroConcessionaria [ 2 ] , iEngine3 , iLights3 , iAlarm3 , iDoors3 , iBonnet3 , iBoot3 , iObjective3 ) ;
        SetVehicleParamsEx ( CarroConcessionaria [ 2 ] , false , false , false , false , false , false , 0 ) ;

        GetVehicleParamsEx ( CarroConcessionaria [ 3 ] , iEngine4 , iLights4 , iAlarm4 , iDoors4 , iBonnet4 , iBoot4 , iObjective4 ) ;
        SetVehicleParamsEx ( CarroConcessionaria [ 3 ] , false , false , false , false , false , false , 0 ) ;

        format ( String , sizeof ( String ) , "GMNovo/CarrosProprios/%s.ini" , PlayerName ( playerid ) ) ;
        if ( dini_Exists ( String ) )
        {
            InfoCarro[ playerid ] [ s_Dono ] = dini_Int ( String , "DonoCarro" ) ;
            InfoVenda[ playerid ] [ ModeloCarro ] = dini_Int ( String , "Modelo" ) ;
            InfoCarro[ playerid ] [ s_PosX ] = dini_Float ( String , "PosX" ) ;
            InfoCarro[ playerid ] [ s_PosY ] = dini_Float ( String , "PosY" ) ;
            InfoCarro[ playerid ] [ s_PosZ ] = dini_Float ( String , "PosZ" ) ;
            InfoCarro[ playerid ] [ s_PosA ] = dini_Float ( String , "Angulo" ) ;
            InfoCarro[ playerid ] [ s_Cor1 ] = dini_Int ( String , "Cor1" ) ;
            InfoCarro[ playerid ] [ s_Cor2 ] = dini_Int ( String , "Cor2" ) ;
            InfoCarro[ playerid ] [ s_Respawn ] = dini_Int ( String , "Respawn" ) ;
            CarroJogador [ playerid ] = CreateVehicle ( InfoVenda[ playerid ] [ ModeloCarro ] , InfoCarro[ playerid ] [ s_PosX ] , InfoCarro[ playerid ] [ s_PosY ] , InfoCarro[ playerid ] [ s_PosZ ] , InfoCarro[ playerid ] [ s_PosA ] , InfoCarro[ playerid ] [ s_Cor1 ] , InfoCarro[ playerid ] [ s_Cor2 ] , InfoCarro[ playerid ] [ s_Respawn ] ) ;
        }
        return true ;
}

public
    OnPlayerSpawn ( playerid )
        return SetPlayerPos ( playerid , 1691.1439 , 1430.6595 , 10.7658 ) ;

public
    OnPlayerDisconnect ( playerid , reason )
    {
        format ( String , sizeof ( String ) , "GMNovo/CarrosProprios/%s.ini" , PlayerName ( playerid ) ) ;
        if ( dini_Exists ( String ) )
        {
            dini_IntSet ( String , "Preзo" , InfoVenda [ playerid ] [ PrecoCarro ] ) ;
            dini_IntSet ( String , "Modelo" , InfoVenda [ playerid ] [ ModeloCarro ] ) ;
            dini_FloatSet ( String , "PosX" , InfoCarro [ playerid ] [ s_PosX ] ) ;
            dini_FloatSet ( String , "PosY" , InfoCarro [ playerid ] [ s_PosY ] ) ;
            dini_FloatSet ( String , "PosZ" , InfoCarro [ playerid ] [ s_PosZ ] ) ;
            dini_FloatSet ( String , "Angulo" , InfoCarro [ playerid ] [ s_PosA ] ) ;
            dini_IntSet ( String , "Cor1" , 1 ) ;
            dini_IntSet ( String , "Cor2" , 1 ) ;
            dini_IntSet ( String , "Respawn" , -1 ) ;
            DestroyVehicle ( CarroJogador [ playerid ] ) ;
        }
        return true ;
}

public
    OnPlayerEnterCheckpoint ( playerid )
{
    if ( Checkpoint [ playerid ] == 1 )
    {
        PlayerPlaySound ( playerid , 1149 , 0.0 , 0.0 , 0.0 ) ;
        SendClientMessage ( playerid , -1 , "Seja Bem Vindo ao seu veiculo !" ) ;
        DisablePlayerCheckpoint ( playerid ) ;
        return true;
    }
    return true;
}

public
    OnPlayerCommandText ( playerid , cmdtext[] )
{
    new
        cmd [ 128 ] ,
        tmp [ 128 ] ,
        tmp2 ,
        idx,
        msg [ 128 ]
    ;

    cmd = strtok ( cmdtext , idx ) ;
    tmp = strtok ( cmdtext , idx ) ;
    tmp2 = strval ( tmp ) ;

    format ( String , sizeof ( String ) , "GMNovo/CarrosProprios/%s.ini" , PlayerName ( playerid ) ) ;

    if ( strcmp ( "/comprarcarro" , cmdtext ) == 0 )
    {
        if(PlayerToPoint(1.0, playerid,1648.8824,-1079.9027,23.6294) || PlayerToPoint(1.0, playerid,1648.8286,-1084.7128,23.6332) || PlayerToPoint(1.0, playerid,1649.0682,-1089.0574,23.6333)
          || PlayerToPoint(1.0, playerid,1648.8564,-1093.5950,23.6333) || PlayerToPoint(1.0, playerid,1649.4242,-1098.0247,23.6333) || PlayerToPoint(1.0, playerid,1649.3087,-1102.5265,23.6333)
          || PlayerToPoint(1.0, playerid,1649.2238,-1107.1091,23.6333) || PlayerToPoint(1.0, playerid,1649.0168,-1111.6848,23.6411) || PlayerToPoint(1.0, playerid,1630.0378,-1098.5574,23.6333)
          || PlayerToPoint(1.0, playerid,1630.0051,-1094.0928,23.6372))
        {
        SendClientMessage(playerid,0xFFFFFFFF,"Vocк nгo estб na concessionбria!");

        if ( dini_Exists ( String ) )
            return SendClientMessage ( playerid , -1 , "Vocк jб possui um veiculo !" ) ;

        ShowPlayerDialog ( playerid , 120+120, DIALOG_STYLE_LIST, "Compra de Veiculos","Stallion\nBucaneer\nTampa\nClover\nEuros\nCamper\nSunrise\nStafford\nYosemite\nSanchez","Certo","Cancelar");
        return true;
    }}
    if ( strcmp ("/vendercarro" , cmdtext ) == 0 )
    {
        if (! dini_Exists ( String ) )
            return SendClientMessage ( playerid , -1 , "Vocк nгo possui um veiculo !" ) ;

        if ( ! IsPlayerInVehicle ( playerid , CarroJogador [ playerid ] ) )
            return SendClientMessage ( playerid , 0xFFFFFFAA , "Vocк nгo estб em seu veiculo." ) ;


        format(msg, sizeof(msg), "Vocк vendeu seu carro por um valor 50 por cento, para $ %i.",  InfoVenda [ playerid ] [ PrecoCarro ] / 2 ) ;
        GivePlayerMoney ( playerid ,  InfoVenda [ playerid ] [ PrecoCarro ] / 2 ) ;
        DestroyVehicle ( CarroJogador [ playerid ] ) ;
        dini_Remove ( String ) ;
        CarroJogador [ playerid ] = 0 ;
        InfoVenda [ playerid ] [ ModeloCarro ] = 0 ;
        InfoVenda [ playerid ] [ PrecoCarro ] = 0 ;
        InfoCarro [ playerid ] [ s_PosX ] = 0 ;
        InfoCarro [ playerid ] [ s_PosY ] = 0 ;
        InfoCarro [ playerid ] [ s_PosZ ] = 0 ;
        InfoCarro [ playerid ] [ s_PosA ] = 0 ;
        SendClientMessage ( playerid , 0xFFFF00FF , msg ) ;
        return 1;
    }

    if ( strcmp ( "/estacionar" , cmdtext ) == 0 )
    {
        if ( ! IsPlayerInVehicle ( playerid , CarroJogador [ playerid ] ) )
                return  SendClientMessage ( playerid , 0xFFFFFFAA , "Vocк nгo estб no seu veiculo." ) ;

        AtualizarPos ( ) ;

        InfoVenda [ playerid ] [ ModeloCarro ] = GetVehicleModel ( GetPlayerVehicleID ( playerid ) ) ;
        InfoCarro [ playerid ] [ s_PosX ] = GetPVarFloat ( playerid , "PosX" ) ;
        InfoCarro [ playerid ] [ s_PosY ] = GetPVarFloat ( playerid , "PosY" ) ;
        InfoCarro [ playerid ] [ s_PosZ ] = GetPVarFloat ( playerid , "PosZ" ) ;
        InfoCarro [ playerid ] [ s_PosA ] = GetPVarFloat ( playerid , "PosA" ) ;

        printf ( "PosX: %f, PosY: %f, PosZ: %f, PosA: %f" , GetPVarFloat ( playerid , "PosX" ) , GetPVarFloat ( playerid , "PosY" ) , GetPVarFloat ( playerid , "PosZ" ) , GetPVarFloat ( playerid , "PosA" ) ) ;


        SendClientMessage ( playerid , 0xFFFF00FF , "Carro estacionado com sucesso !" ) ;
        return true;
    }

    if ( strcmp ( "/localizarcarro" , cmdtext ) == 0 )
    {
        new
            Float:vx ,
            Float:vy ,
            Float:vz
        ;

        GetVehiclePos ( CarroJogador [ playerid ] , vx , vy , vz ) ;
        SetPlayerCheckpoint ( playerid , vx , vy , vz , 10.0 ) ;
        Checkpoint [ playerid ] = 1 ;
        SendClientMessage ( playerid , 0xFFFFFFAA , "Vб ate o Checkpoint para Localizar o seu carro !" ) ;
        return true;
    }

    if ( strcmp ( cmd , "/pintar" , true ) == 0 )
    {
            if ( ! dini_Exists ( String ) )
                return SendClientMessage ( playerid , -1 , "Vocк nгo possui um veiculo !" ) ;

            if ( ! IsPlayerInVehicle ( playerid , CarroJogador [ playerid ] ) )
                return  SendClientMessage ( playerid , 0xFFFFFFAA , "Vocк nгo estб no seu veiculo." ) ;

            if ( ! strlen ( tmp ) )
                return SendClientMessage ( playerid , -1 , "Use /pintar [ Cor ]" ) ;

            ChangeVehicleColor ( GetPlayerVehicleID ( playerid ) , tmp2 , tmp2 ) ;
            format ( String , sizeof ( String ) , "Voce Mudou a Cor do seu veiculo para : %i" , tmp2 ) ;
            SendClientMessage ( playerid , -1 , String ) ;
            return 1;
    }

    if ( strcmp ( "/ajudacarro" , cmdtext ) == 0 )
    {
        SendClientMessage ( playerid , 0xCBCCCEFF, "*** CARRO *** /estacionar /vendercarro /localizarcarro /pintar");
        return true;
    }

    if ( strcmp ( cmdtext , "/testarpos" , true ) == 0 )
    {
        AtualizarPos ( ) ;
        printf ( "PosX: %f, PosY: %f, PosZ: %f, PosA: %f" , GetPVarFloat ( playerid , "PosX" ) , GetPVarFloat ( playerid , "PosY" ) , GetPVarFloat ( playerid , "PosZ" ) , GetPVarFloat ( playerid , "PosA" ) ) ;
        return true ;
    }

    return false;
}

public
    OnPlayerStateChange(playerid, newstate, oldstate)
{
    if ( newstate == PLAYER_STATE_DRIVER )
        {
        if ( CarroJogador [ playerid ] == GetPlayerVehicleID ( playerid ) )
            {
            new
                owner [ MAX_PLAYER_NAME ]
            ;
            GetPlayerName ( InfoCarro [ playerid ] [ s_Dono ] , owner , sizeof ( owner ) ) ;
            format ( String , sizeof ( String ) , "Este(a) \"%s\" pertence a %s." , GetVehicleNameFromID ( GetPlayerVehicleID ( playerid ) ) , owner ) ;
            SendClientMessage ( playerid , 0xFFFFFFAA , String ) ;
            }
        }
        else if ( newstate == PLAYER_STATE_DRIVER )
        {
            if ( CarroJogador [ playerid ] != GetPlayerVehicleID ( playerid ) )
            {
                format ( String, sizeof ( String ) , "Veнculo de %s somente ele(a) pode dirigi-lo!" , InfoCarro[ playerid ] [ s_Dono ] ) ;
                SendClientMessage ( playerid , -1 , String ) ;
                PlayerPlaySound ( playerid , 1147 , 0.0 , 0.0 , 0.0) ;
                RemovePlayerFromVehicle ( playerid ) ;
            }
    }
    return true;
}

public
    OnDialogResponse ( playerid , dialogid , response , listitem , inputtext[] )
{
    if ( dialogid == 120+120 )
    {
        if ( response )
        {
        //TogglePlayerControllable ( playerid , false ) ;
        PutPlayerInVehicle ( playerid , CarroConcessionaria [ listitem ] , 0 ) ;
        new stringdois[128];
        format(stringdois, sizeof(stringdois), "Vocк deseja comprar este %s por %d ?", GetVehicleNameFromID(GetPlayerVehicleID(playerid)), RetornarCarro ( playerid ) );
        ShowPlayerDialog ( playerid , 120+121 , DIALOG_STYLE_MSGBOX , "Compra de Veiculo" , stringdois , "Sim" , "Nгo" ) ;
        ModeloIDCarro [ playerid ] = GetVehicleModel ( GetPlayerVehicleID ( playerid ) ) ;
        }
        return true;
    }

    if ( dialogid == 120+121 )
    {
        if(response)
        {
        if ( GetPlayerMoney ( playerid ) < InfoVenda [ playerid ] [ PrecoCarro ] )
                    return SendClientMessage ( playerid , -1 , "Vocк nгo tem dinheiro suficiente !" ) ;
        SetPlayerPos ( playerid , 1699.2 , 1435.1 , 10.7 ) ;

        new
            Float:x_set ,
            Float:y_set ,
            Float:z_set ,
            Float:a_set
        ;

        GetPlayerPos( playerid, x_set, y_set, z_set ) ;
        GetPlayerFacingAngle( playerid, a_set ) ;

        format( String , sizeof ( String ) , "GMNovo/CarrosProprios/%s.ini" , PlayerName ( playerid ) ) ;

        if(! dini_Create ( String ) ) return dini_Create ( String ) ;
        CarroJogador [ playerid ]   = CreateVehicle ( ModeloIDCarro [ playerid ] , 1699.2 , 1435.1 , 10.7 , a_set , 1 , 1, -1 ) ;

        PutPlayerInVehicle ( playerid , CarroJogador [ playerid ] , 0 ) ;
        dini_Set ( String , "DonoCarro" , PlayerName ( playerid ) ) ;
        dini_IntSet ( String , "Preзo" , InfoVenda [ playerid ] [ PrecoCarro ] ) ;
        dini_IntSet ( String , "Modelo" , InfoVenda [ playerid ] [ ModeloCarro ] ) ;
        dini_FloatSet ( String , "PosX" , x_set ) ;
        dini_FloatSet ( String , "PosY" , y_set ) ;
        dini_FloatSet ( String , "PosZ" , z_set ) ;
        dini_FloatSet ( String , "Angulo" , a_set ) ;
        dini_IntSet ( String , "Cor1" , 1 ) ;
        dini_IntSet ( String , "Cor2" , 1 ) ;
        dini_IntSet ( String , "Respawn" , -1 ) ;

        format( InfoCarro[ GetPlayerVehicleID ( playerid ) ][ s_Dono ], 24, dini_Get( String, "DonoCarro" ));

        InfoCarro[ playerid ] [ s_Dono ] = dini_Int ( String , "DonoCarro" ) ;
        InfoVenda[ playerid ] [ ModeloCarro ] = dini_Int ( String , "Modelo" ) ;
        InfoCarro[ playerid ] [ s_PosX ] = dini_Float ( String , "PosX" ) ;
        InfoCarro[ playerid ] [ s_PosY ] = dini_Float ( String , "PosY" ) ;
        InfoCarro[ playerid ] [ s_PosZ ] = dini_Float ( String , "PosZ" ) ;
        InfoCarro[ playerid ] [ s_PosA ] = dini_Float ( String , "Angulo" ) ;
        InfoCarro[ playerid ] [ s_Cor1 ] = dini_Int ( String , "Cor1" ) ;
        InfoCarro[ playerid ] [ s_Cor2 ] = dini_Int ( String , "Cor2" ) ;
        InfoCarro[ playerid ] [ s_Respawn ] = dini_Int ( String , "Respawn" ) ;
        RemovePlayerFromVehicle ( playerid ) ;
        TogglePlayerControllable ( playerid , true ) ;
        }
        else
        {
        RemovePlayerFromVehicle ( playerid ) ;
        TogglePlayerControllable ( playerid , true ) ;
        }
    }
    return true;
}

forward RetornarCarro ( playerid ) ;
public
    RetornarCarro ( playerid )
{
    switch ( GetVehicleModel ( GetPlayerVehicleID ( playerid ) ) )
    {
        case 439: InfoVenda [ playerid ] [ PrecoCarro ] = 1000000 ;
        case 518: InfoVenda [ playerid ] [ PrecoCarro ] = 800000 ;
        case 549: InfoVenda [ playerid ] [ PrecoCarro ] = 900000 ;
        case 542: InfoVenda [ playerid ] [ PrecoCarro ] = 750000 ;
        case 587: InfoVenda [ playerid ] [ PrecoCarro ] = 1000000 ;
        case 483: InfoVenda [ playerid ] [ PrecoCarro ] = 700000 ;
        case 550: InfoVenda [ playerid ] [ PrecoCarro ] = 780000 ;
        case 580: InfoVenda [ playerid ] [ PrecoCarro ] = 740000 ;
        case 554: InfoVenda [ playerid ] [ PrecoCarro ] = 720000 ;
        case 468: InfoVenda [ playerid ] [ PrecoCarro ] = 670000 ;
    }
    return InfoVenda [ playerid ] [ PrecoCarro ];
}

forward AtualizarPos ( ) ;
public
    AtualizarPos ( )
{
    for ( new i ; i < MAX_PLAYERS ; i ++ )
    {
        if ( ! IsPlayerConnected ( i ) ) continue ;
        new
            Float:JK [ 4 ]
        ;
        GetPlayerPos ( i , JK [ 0 ] , JK [ 1 ] , JK [ 2 ] ) ;
        GetPlayerFacingAngle ( i , JK [ 3 ] ) ;
        SetPVarFloat ( i , "PosX" , JK [ 0 ] ) ;
        SetPVarFloat ( i , "PosY" , JK [ 1 ] ) ;
        SetPVarFloat ( i , "PosZ" , JK [ 2 ] ) ;
        SetPVarFloat ( i , "PosA" , JK [ 3 ] ) ;
    }
    return true ;
}

forward GameModeExitFunc ( playerid ) ;
public
    GameModeExitFunc ( playerid )
{
    format ( String , sizeof ( String ) , "GMNovo/CarrosProprios/%s.ini" , PlayerName ( playerid ) ) ;
    if ( dini_Exists ( String ) )
    {
        dini_IntSet ( String , "Preзo" , InfoVenda [ playerid ] [ PrecoCarro ] ) ;
        dini_IntSet ( String , "Modelo" , InfoVenda [ playerid ] [ ModeloCarro ] ) ;
        dini_FloatSet ( String , "PosX" , InfoCarro [ playerid ] [ s_PosX ] ) ;
        dini_FloatSet ( String , "PosY" , InfoCarro [ playerid ] [ s_PosY ] ) ;
        dini_FloatSet ( String , "PosZ" , InfoCarro [ playerid ] [ s_PosZ ] ) ;
        dini_FloatSet ( String , "Angulo" , InfoCarro [ playerid ] [ s_PosA ] ) ;
        dini_IntSet ( String , "Cor1" , InfoCarro [ playerid ] [ s_Cor1 ] ) ;
        dini_IntSet ( String , "Cor2" , InfoCarro [ playerid ] [ s_Cor2 ] ) ;
        dini_IntSet ( String , "Respawn" , InfoCarro [ playerid ] [ s_Respawn ] ) ;
        DestroyVehicle ( CarroJogador [ playerid ] ) ;
    }
    return true;
}

stock
    PlayerName ( playerid )
    {
    new Nome [ MAX_PLAYER_NAME ] ;
    GetPlayerName ( playerid , Nome , sizeof ( Nome ) ) ;
    return Nome;
}

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
    GetVehicleNameFromID(vehicleid)
{
    static const scVehicleNames [ ] [ 18 ] = {
        "Landstalker",
        "Bravura",
        "Buffalo",
        "Linerunner",
        "Perrenial",
        "Sentinel",
        "Dumper",
        "Firetruck",
        "Trashmaster",
        "Stretch",
        "Manana",
        "Infernus",
        "Voodoo",
        "Pony",
        "Mule",
        "Cheetah",
        "Ambulance",
        "Leviathan",
        "Moonbeam",
        "Esperanto",
        "Taxi",
        "Washington",
        "Bobcat",
        "Mr Whoopee",
        "BF Injection",
        "Hunter",
        "Premier",
        "Enforcer",
        "Securicar",
        "Banshee",
        "Predator",
        "Bus",
        "Rhino",
        "Barracks",
        "Hotknife",
        "Trailer 1",
        "Previon",
        "Coach",
        "Cabbie",
        "Stallion",
        "Rumpo",
        "RC Bandit",
        "Romero",
        "Packer",
        "Monster",
        "Admiral",
        "Squalo",
        "Seasparrow",
        "Pizzaboy",
        "Tram",
        "Trailer 2",
        "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",
        "Cropdust",
        "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 LA",
        "Hustler",
        "Intruder",
        "Primo",
        "Cargobob",
        "Tampa",
        "Sunrise",
        "Merit",
        "Utility",
        "Nevada",
        "Yosemite",
        "Windsor",
        "Monster A",
        "Monster B",
        "Uranus",
        "Jester",
        "Sultan",
        "Stratum",
        "Elegy",
        "Raindance",
        "RC Tiger",
        "Flash",
        "Tahoma",
        "Savanna",
        "Bandito",
        "Freight Flat",
        "Streak Carriage",
        "Kart",
        "Mower",
        "Duneride",
        "Sweeper",
        "Broadway",
        "Tornado",
        "AT-400",
        "DFT-30",
        "Huntley",
        "Stafford",
        "BF-400",
        "Newsvan",
        "Tug",
        "Trailer 3",
        "Emperor",
        "Wayfarer",
        "Euros",
        "Hotdog",
        "Club",
        "Freight Carriage",
        "Trailer 3",
        "Andromada",
        "Dodo",
        "RC Cam",
        "Launch",
        "LS Police Car",
        "SF Police Car",
        "LV Police Car",
        "Police Ranger",
        "Picador",
        "S.W.A.T. Van",
        "Alpha",
        "Phoenix",
        "Glendale",
        "Sadler",
        "Luggage Trailer A",
        "Luggage Trailer B",
        "Stair Trailer",
        "Boxville",
        "Farm Plow",
        "Utility Trailer"
    },
    scOnFoot [ 18 ] = "OnFoot" ;
    if ( vehicleid > 0 ) {
        return scVehicleNames [ GetVehicleModel ( vehicleid ) - 400 ] ;
    }
    else {
        return scOnFoot ;
    }
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)