Advertisement
Guest User

Untitled

a guest
Nov 29th, 2011
6,668
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 21.92 KB | None | 0 0
  1. /*
  2. >>>>>>>>>>>>>>>>>>>> Como adicionar Veiculos para venda no FilterScripts
  3.  
  4. - > Primeiro :
  5.  
  6. Adicionar no InfoVenda um valor atribuido ao Veiculo
  7.  Exemplo :
  8.  ID | Preço
  9.  \/    \/
  10. {455,500000}
  11.  
  12. - > Segundo :
  13.  
  14. No 'CarrosConcessionaria' , adicione um numero a mais e crie-o no 'OnGameModeInit'
  15. Para tranca-lo vá em OnPlayerConnect e você aprenderá rapidamente.
  16.  
  17. - > Terçeiro :
  18. Adicionar no 'ShowPlayerDialog' do '/comprarcarro' o nome do veiculo.
  19. Exemplo
  20. '\nFlatbed\n'
  21.  
  22. - > Quarto e Ultimo :
  23. Na Public de forçar o valor do veiculo. Adicione um novo 'case' para forçar e mostrar no dialog o valor do veiculo.
  24.  Exemplo :
  25.  case: 455 = InfoVenda [ playerid ] [ PrecoCarro ] = 250000 ;
  26. O numero ao lado do 'case' , significa o ID do veiculo.
  27. O '250000' é o preço do veiculo.
  28.  
  29.  -------------------- Seguindo essas instruções , você conseguirá fazer um veiculo a venda sem Bug´s !
  30.  
  31. >>>>>>>>>>>>>>>>>>>>> Comandos do FilterScript :
  32.  
  33. /comprarcarro
  34. /vendercarro
  35. /estacionar
  36. /localizarcarro
  37. /pintar
  38.  
  39.  
  40.  
  41. >>>>>>>>>>>>>>>>>>>>>>>>>>>> Créditos :
  42.                             []BlackGangsta[] - Idealizador e Criador
  43.                             Josma_CMD - Ajudante - Ajudou em varias coisas no Game Mode
  44.  
  45.  
  46. */
  47. #include < a_samp >
  48. #include < Dini >
  49.  
  50. enum iCarro
  51. {
  52.     s_Dono[ 24 ],
  53.     s_Modelo,
  54.     Float:s_PosX,
  55.     Float:s_PosY,
  56.     Float:s_PosZ,
  57.     Float:s_PosA,
  58.     s_Cor1,
  59.     s_Cor2,
  60.     s_Respawn
  61. };
  62. new
  63.     InfoCarro [ MAX_PLAYERS ] [ iCarro ] ,
  64.     CarroConcessionaria [ 4 ] ,
  65.     CarroJogador [ MAX_PLAYERS ] ,
  66.     String [ 128 ] ,
  67.     Checkpoint [ MAX_PLAYERS ] ,
  68.     ModeloIDCarro [ MAX_PLAYERS ]
  69.     ;
  70.  
  71. enum iVenda {ModeloCarro,PrecoCarro};
  72. new
  73.     InfoVenda[4][iVenda] =
  74. {  //Modelo, Nome, Preco
  75.     {411,500000}, // Infernus = 500.000
  76.     {522,100000}, // NRG-500 = 100.000
  77.     {451,450000}, // Turismo = 450.000
  78.     {415,200000} // Cheetah = 200.000
  79. };
  80.  
  81. public
  82.     OnVehicleSpawn ( vehicleid )
  83. {
  84.     for(new i ; i < MAX_PLAYERS ; ++i)
  85.     {
  86.             format ( String , 30 , "GMNovo/CarrosProprios/%s.ini" , PlayerName ( i ) ) ;
  87.             if ( fexist ( String ) )
  88.             {
  89.                 if ( dini_Int ( String , "Estacionado" ) == 10 )
  90.                 {
  91.                     SetVehiclePos ( vehicleid , dini_Int ( String , "PosX" ) , dini_Int ( String , "PosY" ) , dini_Int ( String , "PosZ" ) ) ;
  92.                 }
  93.             }
  94.         }
  95.     return true ;
  96. }
  97.  
  98. public
  99.     OnGameModeInit ( )
  100.     {
  101.    
  102.     CarroConcessionaria [ 0 ] = CreateVehicle ( 411 , 2149.5 , -1134.0 , 25.4 , 270.15 , 1 , 1 , 50000 ) ;
  103.     CarroConcessionaria [ 1 ] = CreateVehicle ( 522 , 2149.126220 , -1136.827514 , 25.151468 , 270.144958 , 1 , 1 , 50000 ) ;
  104.     CarroConcessionaria [ 2 ] = CreateVehicle ( 451 , 2148.9966 , -1139.7101 , 24.9981 , 269.0601 , 1 , 1 , 50000 ) ;
  105.     CarroConcessionaria [ 3 ] = CreateVehicle ( 415 , 2148.3689 , -1145.4435 , 24.3671 , 271.1245 , 1 , 1 , 50000 ) ;
  106.    
  107.     return true;
  108. }
  109.  
  110. public
  111.     OnGameModeExit ( )
  112.     {
  113.     SetTimer ( "GameModeExitFunc" , 2000 , 0 ) ;
  114.     return true ;
  115. }
  116.  
  117. public
  118.     OnPlayerConnect ( playerid )
  119.     {
  120.         new
  121.              iEngine , iEngine2 , iEngine3 , iEngine4 ,
  122.              iLights , iLights2 , iLights3 , iLights4 ,
  123.              iAlarm , iAlarm2 , iAlarm3 , iAlarm4 ,
  124.              iDoors , iDoors2 , iDoors3 , iDoors4 ,
  125.              iBonnet , iBonnet2 , iBonnet3 , iBonnet4 ,
  126.              iBoot , iBoot2 , iBoot3 , iBoot4 ,
  127.              iObjective , iObjective2 , iObjective3 , iObjective4
  128.          ;
  129.  
  130.         GetVehicleParamsEx ( CarroConcessionaria [ 0 ] , iEngine , iLights , iAlarm , iDoors , iBonnet , iBoot , iObjective ) ;
  131.         SetVehicleParamsEx ( CarroConcessionaria [ 0 ] , false , false , false , false , false , false , 0 ) ;
  132.  
  133.         GetVehicleParamsEx ( CarroConcessionaria [ 1 ] , iEngine2 , iLights2 , iAlarm2 , iDoors2 , iBonnet2 , iBoot2 , iObjective2 ) ;
  134.         SetVehicleParamsEx ( CarroConcessionaria [ 1 ] , false , false , false , false , false , false , 0 ) ;
  135.  
  136.         GetVehicleParamsEx ( CarroConcessionaria [ 2 ] , iEngine3 , iLights3 , iAlarm3 , iDoors3 , iBonnet3 , iBoot3 , iObjective3 ) ;
  137.         SetVehicleParamsEx ( CarroConcessionaria [ 2 ] , false , false , false , false , false , false , 0 ) ;
  138.  
  139.         GetVehicleParamsEx ( CarroConcessionaria [ 3 ] , iEngine4 , iLights4 , iAlarm4 , iDoors4 , iBonnet4 , iBoot4 , iObjective4 ) ;
  140.         SetVehicleParamsEx ( CarroConcessionaria [ 3 ] , false , false , false , false , false , false , 0 ) ;
  141.  
  142.         format ( String , sizeof ( String ) , "GMNovo/CarrosProprios/%s.ini" , PlayerName ( playerid ) ) ;
  143.         if ( dini_Exists ( String ) )
  144.         {
  145.             InfoCarro[ playerid ] [ s_Dono ] = dini_Int ( String , "DonoCarro" ) ;
  146.             InfoVenda[ playerid ] [ ModeloCarro ] = dini_Int ( String , "Modelo" ) ;
  147.             InfoCarro[ playerid ] [ s_PosX ] = dini_Float ( String , "PosX" ) ;
  148.             InfoCarro[ playerid ] [ s_PosY ] = dini_Float ( String , "PosY" ) ;
  149.             InfoCarro[ playerid ] [ s_PosZ ] = dini_Float ( String , "PosZ" ) ;
  150.             InfoCarro[ playerid ] [ s_PosA ] = dini_Float ( String , "Angulo" ) ;
  151.             InfoCarro[ playerid ] [ s_Cor1 ] = dini_Int ( String , "Cor1" ) ;
  152.             InfoCarro[ playerid ] [ s_Cor2 ] = dini_Int ( String , "Cor2" ) ;
  153.             InfoCarro[ playerid ] [ s_Respawn ] = dini_Int ( String , "Respawn" ) ;
  154.             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 ] ) ;
  155.         }
  156.         return true ;
  157. }
  158.  
  159. public
  160.     OnPlayerSpawn ( playerid )
  161.         return SetPlayerPos ( playerid , 1691.1439 , 1430.6595 , 10.7658 ) ;
  162.        
  163. public
  164.     OnPlayerDisconnect ( playerid , reason )
  165.     {
  166.         format ( String , sizeof ( String ) , "GMNovo/CarrosProprios/%s.ini" , PlayerName ( playerid ) ) ;
  167.         if ( dini_Exists ( String ) )
  168.         {
  169.             dini_IntSet ( String , "Preço" , InfoVenda [ playerid ] [ PrecoCarro ] ) ;
  170.             dini_IntSet ( String , "Modelo" , InfoVenda [ playerid ] [ ModeloCarro ] ) ;
  171.             dini_FloatSet ( String , "PosX" , InfoCarro [ playerid ] [ s_PosX ] ) ;
  172.             dini_FloatSet ( String , "PosY" , InfoCarro [ playerid ] [ s_PosY ] ) ;
  173.             dini_FloatSet ( String , "PosZ" , InfoCarro [ playerid ] [ s_PosZ ] ) ;
  174.             dini_FloatSet ( String , "Angulo" , InfoCarro [ playerid ] [ s_PosA ] ) ;
  175.             dini_IntSet ( String , "Cor1" , 1 ) ;
  176.             dini_IntSet ( String , "Cor2" , 1 ) ;
  177.             dini_IntSet ( String , "Respawn" , -1 ) ;
  178.             DestroyVehicle ( CarroJogador [ playerid ] ) ;
  179.         }
  180.         return true ;
  181. }
  182.  
  183. public
  184.     OnPlayerEnterCheckpoint ( playerid )
  185. {
  186.     if ( Checkpoint [ playerid ] == 1 )
  187.     {
  188.         PlayerPlaySound ( playerid , 1149 , 0.0 , 0.0 , 0.0 ) ;
  189.         SendClientMessage ( playerid , -1 , "Seja Bem Vindo ao seu veiculo !" ) ;
  190.         DisablePlayerCheckpoint ( playerid ) ;
  191.         return true;
  192.     }
  193.     return true;
  194. }
  195.  
  196. public
  197.     OnPlayerCommandText ( playerid , cmdtext[] )
  198. {
  199.     new
  200.         cmd [ 128 ] ,
  201.         tmp [ 128 ] ,
  202.         tmp2 ,
  203.         idx,
  204.         msg [ 128 ]
  205.     ;
  206.  
  207.     cmd = strtok ( cmdtext , idx ) ;
  208.     tmp = strtok ( cmdtext , idx ) ;
  209.     tmp2 = strval ( tmp ) ;
  210.    
  211.     format ( String , sizeof ( String ) , "GMNovo/CarrosProprios/%s.ini" , PlayerName ( playerid ) ) ;
  212.  
  213.     if ( strcmp ( "/comprarcarro" , cmdtext ) == 0 )
  214.     {
  215.         if ( dini_Exists ( String ) )
  216.             return SendClientMessage ( playerid , -1 , "Você já possui um veiculo !" ) ;
  217.            
  218.         ShowPlayerDialog ( playerid , 120+120, DIALOG_STYLE_LIST, "Compra de Veiculos","Infernus\nNRG-500\nTurismo\nCheetah","Certo","Cancelar");
  219.         return true;
  220.     }
  221.    
  222.     if ( strcmp ("/vendercarro" , cmdtext ) == 0 )
  223.     {
  224.         if (! dini_Exists ( String ) )
  225.             return SendClientMessage ( playerid , -1 , "Você não possui um veiculo !" ) ;
  226.            
  227.         if ( ! IsPlayerInVehicle ( playerid , CarroJogador [ playerid ] ) )
  228.             return SendClientMessage ( playerid , 0xFFFFFFAA , "Você não está em seu veiculo." ) ;
  229.            
  230.        
  231.         format(msg, sizeof(msg), "Você vendeu seu carro por um valor 50 por cento, para $ %i.",  InfoVenda [ playerid ] [ PrecoCarro ] / 2 ) ;
  232.         GivePlayerMoney ( playerid ,  InfoVenda [ playerid ] [ PrecoCarro ] / 2 ) ;
  233.         DestroyVehicle ( CarroJogador [ playerid ] ) ;
  234.         dini_Remove ( String ) ;
  235.         CarroJogador [ playerid ] = 0 ;
  236.         InfoVenda [ playerid ] [ ModeloCarro ] = 0 ;
  237.         InfoVenda [ playerid ] [ PrecoCarro ] = 0 ;
  238.         InfoCarro [ playerid ] [ s_PosX ] = 0 ;
  239.         InfoCarro [ playerid ] [ s_PosY ] = 0 ;
  240.         InfoCarro [ playerid ] [ s_PosZ ] = 0 ;
  241.         InfoCarro [ playerid ] [ s_PosA ] = 0 ;
  242.         SendClientMessage ( playerid , 0xFFFF00FF , msg ) ;
  243.         return 1;
  244.     }
  245.    
  246.     if ( strcmp ( "/estacionar" , cmdtext ) == 0 )
  247.     {
  248.         if ( ! IsPlayerInVehicle ( playerid , CarroJogador [ playerid ] ) )
  249.                 return  SendClientMessage ( playerid , 0xFFFFFFAA , "Você não está no seu veiculo." ) ;
  250.                
  251.         AtualizarPos ( ) ;
  252.  
  253.         InfoVenda [ playerid ] [ ModeloCarro ] = GetVehicleModel ( GetPlayerVehicleID ( playerid ) ) ;
  254.         InfoCarro [ playerid ] [ s_PosX ] = GetPVarFloat ( playerid , "PosX" ) ;
  255.         InfoCarro [ playerid ] [ s_PosY ] = GetPVarFloat ( playerid , "PosY" ) ;
  256.         InfoCarro [ playerid ] [ s_PosZ ] = GetPVarFloat ( playerid , "PosZ" ) ;
  257.         InfoCarro [ playerid ] [ s_PosA ] = GetPVarFloat ( playerid , "PosA" ) ;
  258.  
  259.         printf ( "PosX: %f, PosY: %f, PosZ: %f, PosA: %f" , GetPVarFloat ( playerid , "PosX" ) , GetPVarFloat ( playerid , "PosY" ) , GetPVarFloat ( playerid , "PosZ" ) , GetPVarFloat ( playerid , "PosA" ) ) ;
  260.  
  261.  
  262.         SendClientMessage ( playerid , 0xFFFF00FF , "Carro estacionado com sucesso !" ) ;
  263.         return true;
  264.     }
  265.  
  266.     if ( strcmp ( "/localizarcarro" , cmdtext ) == 0 )
  267.     {
  268.         new
  269.             Float:vx ,
  270.             Float:vy ,
  271.             Float:vz
  272.         ;
  273.        
  274.         GetVehiclePos ( CarroJogador [ playerid ] , vx , vy , vz ) ;
  275.         SetPlayerCheckpoint ( playerid , vx , vy , vz , 10.0 ) ;
  276.         Checkpoint [ playerid ] = 1 ;
  277.         SendClientMessage ( playerid , 0xFFFFFFAA , "Vá ate o Checkpoint para Localizar o seu carro !" ) ;
  278.         return true;
  279.     }
  280.  
  281.     if ( strcmp ( cmd , "/pintar" , true ) == 0 )
  282.     {
  283.             if ( ! dini_Exists ( String ) )
  284.                 return SendClientMessage ( playerid , -1 , "Você não possui um veiculo !" ) ;
  285.  
  286.             if ( ! IsPlayerInVehicle ( playerid , CarroJogador [ playerid ] ) )
  287.                 return  SendClientMessage ( playerid , 0xFFFFFFAA , "Você não está no seu veiculo." ) ;
  288.            
  289.             if ( ! strlen ( tmp ) )
  290.                 return SendClientMessage ( playerid , -1 , "Use /pintar [ Cor ]" ) ;
  291.  
  292.             ChangeVehicleColor ( GetPlayerVehicleID ( playerid ) , tmp2 , tmp2 ) ;
  293.             format ( String , sizeof ( String ) , "Voce Mudou a Cor do seu veiculo para : %i" , tmp2 ) ;
  294.             SendClientMessage ( playerid , -1 , String ) ;
  295.             return 1;
  296.     }
  297.    
  298.     if ( strcmp ( "/ajudacarro" , cmdtext ) == 0 )
  299.     {
  300.         SendClientMessage ( playerid , 0xCBCCCEFF, "*** CARRO *** /estacionar /vendercarro /localizarcarro /pintar");
  301.         return true;
  302.     }
  303.  
  304.     if ( strcmp ( cmdtext , "/testarpos" , true ) == 0 )
  305.     {
  306.         AtualizarPos ( ) ;
  307.         printf ( "PosX: %f, PosY: %f, PosZ: %f, PosA: %f" , GetPVarFloat ( playerid , "PosX" ) , GetPVarFloat ( playerid , "PosY" ) , GetPVarFloat ( playerid , "PosZ" ) , GetPVarFloat ( playerid , "PosA" ) ) ;
  308.         return true ;
  309.     }
  310.  
  311.     return false;
  312. }
  313.  
  314. public
  315.     OnPlayerStateChange(playerid, newstate, oldstate)
  316. {
  317.     if ( newstate == PLAYER_STATE_DRIVER )
  318.         {
  319.         if ( CarroJogador [ playerid ] == GetPlayerVehicleID ( playerid ) )
  320.             {
  321.             new
  322.                 owner [ MAX_PLAYER_NAME ]
  323.             ;
  324.             GetPlayerName ( InfoCarro [ playerid ] [ s_Dono ] , owner , sizeof ( owner ) ) ;
  325.             format ( String , sizeof ( String ) , "Este(a) \"%s\" pertence a %s." , GetVehicleNameFromID ( GetPlayerVehicleID ( playerid ) ) , owner ) ;
  326.             SendClientMessage ( playerid , 0xFFFFFFAA , String ) ;
  327.             }
  328.         }
  329.         else if ( newstate == PLAYER_STATE_DRIVER )
  330.         {
  331.             if ( CarroJogador [ playerid ] != GetPlayerVehicleID ( playerid ) )
  332.             {
  333.                 format ( String, sizeof ( String ) , "Veículo de %s somente ele(a) pode dirigi-lo!" , InfoCarro[ playerid ] [ s_Dono ] ) ;
  334.                 SendClientMessage ( playerid , -1 , String ) ;
  335.                 PlayerPlaySound ( playerid , 1147 , 0.0 , 0.0 , 0.0) ;
  336.                 RemovePlayerFromVehicle ( playerid ) ;
  337.             }
  338.     }
  339.     return true;
  340. }
  341.  
  342. public
  343.     OnDialogResponse ( playerid , dialogid , response , listitem , inputtext[] )
  344. {
  345.     if ( dialogid == 120+120 )
  346.     {
  347.         if ( response )
  348.         {
  349.         //TogglePlayerControllable ( playerid , false ) ;
  350.         PutPlayerInVehicle ( playerid , CarroConcessionaria [ listitem ] , 0 ) ;
  351.         new stringdois[128];
  352.         format(stringdois, sizeof(stringdois), "Você deseja comprar este %s por %d ?", GetVehicleNameFromID(GetPlayerVehicleID(playerid)), RetornarCarro ( playerid ) );
  353.         ShowPlayerDialog ( playerid , 120+121 , DIALOG_STYLE_MSGBOX , "Compra de Veiculo" , stringdois , "Sim" , "Não" ) ;
  354.         ModeloIDCarro [ playerid ] = GetVehicleModel ( GetPlayerVehicleID ( playerid ) ) ;
  355.         }
  356.         return true;
  357.     }
  358.  
  359.     if ( dialogid == 120+121 )
  360.     {
  361.         if(response)
  362.         {
  363.         if ( GetPlayerMoney ( playerid ) < InfoVenda [ playerid ] [ PrecoCarro ] )
  364.                     return SendClientMessage ( playerid , -1 , "Você não tem dinheiro suficiente !" ) ;
  365.         SetPlayerPos ( playerid , 1699.2 , 1435.1 , 10.7 ) ;
  366.        
  367.         new
  368.             Float:x_set ,
  369.             Float:y_set ,
  370.             Float:z_set ,
  371.             Float:a_set
  372.         ;
  373.        
  374.         GetPlayerPos( playerid, x_set, y_set, z_set ) ;
  375.         GetPlayerFacingAngle( playerid, a_set ) ;
  376.        
  377.         format( String , sizeof ( String ) , "GMNovo/CarrosProprios/%s.ini" , PlayerName ( playerid ) ) ;
  378.  
  379.         if(! dini_Create ( String ) ) return dini_Create ( String ) ;
  380.         CarroJogador [ playerid ]   = CreateVehicle ( ModeloIDCarro [ playerid ] , 1699.2 , 1435.1 , 10.7 , a_set , 1 , 1, -1 ) ;
  381.  
  382.         PutPlayerInVehicle ( playerid , CarroJogador [ playerid ] , 0 ) ;
  383.         dini_Set ( String , "DonoCarro" , PlayerName ( playerid ) ) ;
  384.         dini_IntSet ( String , "Preço" , InfoVenda [ playerid ] [ PrecoCarro ] ) ;
  385.         dini_IntSet ( String , "Modelo" , InfoVenda [ playerid ] [ ModeloCarro ] ) ;
  386.         dini_FloatSet ( String , "PosX" , x_set ) ;
  387.         dini_FloatSet ( String , "PosY" , y_set ) ;
  388.         dini_FloatSet ( String , "PosZ" , z_set ) ;
  389.         dini_FloatSet ( String , "Angulo" , a_set ) ;
  390.         dini_IntSet ( String , "Cor1" , 1 ) ;
  391.         dini_IntSet ( String , "Cor2" , 1 ) ;
  392.         dini_IntSet ( String , "Respawn" , -1 ) ;
  393.        
  394.         format( InfoCarro[ GetPlayerVehicleID ( playerid ) ][ s_Dono ], 24, dini_Get( String, "DonoCarro" ));
  395.        
  396.         InfoCarro[ playerid ] [ s_Dono ] = dini_Int ( String , "DonoCarro" ) ;
  397.         InfoVenda[ playerid ] [ ModeloCarro ] = dini_Int ( String , "Modelo" ) ;
  398.         InfoCarro[ playerid ] [ s_PosX ] = dini_Float ( String , "PosX" ) ;
  399.         InfoCarro[ playerid ] [ s_PosY ] = dini_Float ( String , "PosY" ) ;
  400.         InfoCarro[ playerid ] [ s_PosZ ] = dini_Float ( String , "PosZ" ) ;
  401.         InfoCarro[ playerid ] [ s_PosA ] = dini_Float ( String , "Angulo" ) ;
  402.         InfoCarro[ playerid ] [ s_Cor1 ] = dini_Int ( String , "Cor1" ) ;
  403.         InfoCarro[ playerid ] [ s_Cor2 ] = dini_Int ( String , "Cor2" ) ;
  404.         InfoCarro[ playerid ] [ s_Respawn ] = dini_Int ( String , "Respawn" ) ;
  405.         RemovePlayerFromVehicle ( playerid ) ;
  406.         TogglePlayerControllable ( playerid , true ) ;
  407.         }
  408.         else
  409.         {
  410.         RemovePlayerFromVehicle ( playerid ) ;
  411.         TogglePlayerControllable ( playerid , true ) ;
  412.         }
  413.     }
  414.     return true;
  415. }
  416.  
  417. forward RetornarCarro ( playerid ) ;
  418. public
  419.     RetornarCarro ( playerid )
  420. {
  421.     switch ( GetVehicleModel ( GetPlayerVehicleID ( playerid ) ) )
  422.     {
  423.         case 411: InfoVenda [ playerid ] [ PrecoCarro ] = 500000 ;
  424.         case 451: InfoVenda [ playerid ] [ PrecoCarro ] = 450000 ;
  425.         case 522: InfoVenda [ playerid ] [ PrecoCarro ] = 100000 ;
  426.         case 415: InfoVenda [ playerid ] [ PrecoCarro ] = 200000 ;
  427.     }
  428.     return InfoVenda [ playerid ] [ PrecoCarro ];
  429. }
  430.  
  431. forward AtualizarPos ( ) ;
  432. public
  433.     AtualizarPos ( )
  434. {
  435.     for ( new i ; i < MAX_PLAYERS ; i ++ )
  436.     {
  437.         if ( ! IsPlayerConnected ( i ) ) continue ;
  438.         new
  439.             Float:JK [ 4 ]
  440.         ;
  441.         GetPlayerPos ( i , JK [ 0 ] , JK [ 1 ] , JK [ 2 ] ) ;
  442.         GetPlayerFacingAngle ( i , JK [ 3 ] ) ;
  443.         SetPVarFloat ( i , "PosX" , JK [ 0 ] ) ;
  444.         SetPVarFloat ( i , "PosY" , JK [ 1 ] ) ;
  445.         SetPVarFloat ( i , "PosZ" , JK [ 2 ] ) ;
  446.         SetPVarFloat ( i , "PosA" , JK [ 3 ] ) ;
  447.     }
  448.     return true ;
  449. }
  450.  
  451. forward GameModeExitFunc ( playerid ) ;
  452. public
  453.     GameModeExitFunc ( playerid )
  454. {
  455.     format ( String , sizeof ( String ) , "GMNovo/CarrosProprios/%s.ini" , PlayerName ( playerid ) ) ;
  456.     if ( dini_Exists ( String ) )
  457.     {
  458.         dini_IntSet ( String , "Preço" , InfoVenda [ playerid ] [ PrecoCarro ] ) ;
  459.         dini_IntSet ( String , "Modelo" , InfoVenda [ playerid ] [ ModeloCarro ] ) ;
  460.         dini_FloatSet ( String , "PosX" , InfoCarro [ playerid ] [ s_PosX ] ) ;
  461.         dini_FloatSet ( String , "PosY" , InfoCarro [ playerid ] [ s_PosY ] ) ;
  462.         dini_FloatSet ( String , "PosZ" , InfoCarro [ playerid ] [ s_PosZ ] ) ;
  463.         dini_FloatSet ( String , "Angulo" , InfoCarro [ playerid ] [ s_PosA ] ) ;
  464.         dini_IntSet ( String , "Cor1" , InfoCarro [ playerid ] [ s_Cor1 ] ) ;
  465.         dini_IntSet ( String , "Cor2" , InfoCarro [ playerid ] [ s_Cor2 ] ) ;
  466.         dini_IntSet ( String , "Respawn" , InfoCarro [ playerid ] [ s_Respawn ] ) ;
  467.         DestroyVehicle ( CarroJogador [ playerid ] ) ;
  468.     }
  469.     return true;
  470. }
  471.  
  472. stock
  473.     PlayerName ( playerid )
  474.     {
  475.     new Nome [ MAX_PLAYER_NAME ] ;
  476.     GetPlayerName ( playerid , Nome , sizeof ( Nome ) ) ;
  477.     return Nome;
  478. }
  479.  
  480. strtok(const string[], &index)
  481. {
  482.     new length = strlen(string);
  483.     while((index < length)   &&(string[index] <= ' '))
  484.     {
  485.         index++;
  486.     }
  487.  
  488.     new offset = index;
  489.     new result[20];
  490.     while((index < length)   &&(string[index] > ' ')   &&((index - offset)   <(sizeof(result)   - 1)) )
  491.     {
  492.         result[index - offset] = string[index];
  493.         index++;
  494.     }
  495.     result[index - offset] = EOS;
  496.     return result;
  497. }
  498.  
  499. stock
  500.     GetVehicleNameFromID(vehicleid)
  501. {
  502.     static const scVehicleNames [ ] [ 18 ] = {
  503.         "Landstalker",
  504.         "Bravura",
  505.         "Buffalo",
  506.         "Linerunner",
  507.         "Perrenial",
  508.         "Sentinel",
  509.         "Dumper",
  510.         "Firetruck",
  511.         "Trashmaster",
  512.         "Stretch",
  513.         "Manana",
  514.         "Infernus",
  515.         "Voodoo",
  516.         "Pony",
  517.         "Mule",
  518.         "Cheetah",
  519.         "Ambulance",
  520.         "Leviathan",
  521.         "Moonbeam",
  522.         "Esperanto",
  523.         "Taxi",
  524.         "Washington",
  525.         "Bobcat",
  526.         "Mr Whoopee",
  527.         "BF Injection",
  528.         "Hunter",
  529.         "Premier",
  530.         "Enforcer",
  531.         "Securicar",
  532.         "Banshee",
  533.         "Predator",
  534.         "Bus",
  535.         "Rhino",
  536.         "Barracks",
  537.         "Hotknife",
  538.         "Trailer 1",
  539.         "Previon",
  540.         "Coach",
  541.         "Cabbie",
  542.         "Stallion",
  543.         "Rumpo",
  544.         "RC Bandit",
  545.         "Romero",
  546.         "Packer",
  547.         "Monster",
  548.         "Admiral",
  549.         "Squalo",
  550.         "Seasparrow",
  551.         "Pizzaboy",
  552.         "Tram",
  553.         "Trailer 2",
  554.         "Turismo",
  555.         "Speeder",
  556.         "Reefer",
  557.         "Tropic",
  558.         "Flatbed",
  559.         "Yankee",
  560.         "Caddy",
  561.         "Solair",
  562.         "Berkley's RC Van",
  563.         "Skimmer",
  564.         "PCJ-600",
  565.         "Faggio",
  566.         "Freeway",
  567.         "RC Baron",
  568.         "RC Raider",
  569.         "Glendale",
  570.         "Oceanic",
  571.         "Sanchez",
  572.         "Sparrow",
  573.         "Patriot",
  574.         "Quad",
  575.         "Coastguard",
  576.         "Dinghy",
  577.         "Hermes",
  578.         "Sabre",
  579.         "Rustler",
  580.         "ZR-350",
  581.         "Walton",
  582.         "Regina",
  583.         "Comet",
  584.         "BMX",
  585.         "Burrito",
  586.         "Camper",
  587.         "Marquis",
  588.         "Baggage",
  589.         "Dozer",
  590.         "Maverick",
  591.         "News Chopper",
  592.         "Rancher",
  593.         "FBI Rancher",
  594.         "Virgo",
  595.         "Greenwood",
  596.         "Jetmax",
  597.         "Hotring",
  598.         "Sandking",
  599.         "Blista Compact",
  600.         "Police Maverick",
  601.         "Boxville",
  602.         "Benson",
  603.         "Mesa",
  604.         "RC Goblin",
  605.         "Hotring Racer A",
  606.         "Hotring Racer B",
  607.         "Bloodring Banger",
  608.         "Rancher",
  609.         "Super GT",
  610.         "Elegant",
  611.         "Journey",
  612.         "Bike",
  613.         "Mountain Bike",
  614.         "Beagle",
  615.         "Cropdust",
  616.         "Stunt",
  617.         "Tanker",
  618.         "Roadtrain",
  619.         "Nebula",
  620.         "Majestic",
  621.         "Buccaneer",
  622.         "Shamal",
  623.         "Hydra",
  624.         "FCR-900",
  625.         "NRG-500",
  626.         "HPV1000",
  627.         "Cement Truck",
  628.         "Tow Truck",
  629.         "Fortune",
  630.         "Cadrona",
  631.         "FBI Truck",
  632.         "Willard",
  633.         "Forklift",
  634.         "Tractor",
  635.         "Combine",
  636.         "Feltzer",
  637.         "Remington",
  638.         "Slamvan",
  639.         "Blade",
  640.         "Freight",
  641.         "Streak",
  642.         "Vortex",
  643.         "Vincent",
  644.         "Bullet",
  645.         "Clover",
  646.         "Sadler",
  647.         "Firetruck LA",
  648.         "Hustler",
  649.         "Intruder",
  650.         "Primo",
  651.         "Cargobob",
  652.         "Tampa",
  653.         "Sunrise",
  654.         "Merit",
  655.         "Utility",
  656.         "Nevada",
  657.         "Yosemite",
  658.         "Windsor",
  659.         "Monster A",
  660.         "Monster B",
  661.         "Uranus",
  662.         "Jester",
  663.         "Sultan",
  664.         "Stratum",
  665.         "Elegy",
  666.         "Raindance",
  667.         "RC Tiger",
  668.         "Flash",
  669.         "Tahoma",
  670.         "Savanna",
  671.         "Bandito",
  672.         "Freight Flat",
  673.         "Streak Carriage",
  674.         "Kart",
  675.         "Mower",
  676.         "Duneride",
  677.         "Sweeper",
  678.         "Broadway",
  679.         "Tornado",
  680.         "AT-400",
  681.         "DFT-30",
  682.         "Huntley",
  683.         "Stafford",
  684.         "BF-400",
  685.         "Newsvan",
  686.         "Tug",
  687.         "Trailer 3",
  688.         "Emperor",
  689.         "Wayfarer",
  690.         "Euros",
  691.         "Hotdog",
  692.         "Club",
  693.         "Freight Carriage",
  694.         "Trailer 3",
  695.         "Andromada",
  696.         "Dodo",
  697.         "RC Cam",
  698.         "Launch",
  699.         "LS Police Car",
  700.         "SF Police Car",
  701.         "LV Police Car",
  702.         "Police Ranger",
  703.         "Picador",
  704.         "S.W.A.T. Van",
  705.         "Alpha",
  706.         "Phoenix",
  707.         "Glendale",
  708.         "Sadler",
  709.         "Luggage Trailer A",
  710.         "Luggage Trailer B",
  711.         "Stair Trailer",
  712.         "Boxville",
  713.         "Farm Plow",
  714.         "Utility Trailer"
  715.     },
  716.     scOnFoot [ 18 ] = "OnFoot" ;
  717.     if ( vehicleid > 0 ) {
  718.         return scVehicleNames [ GetVehicleModel ( vehicleid ) - 400 ] ;
  719.     }
  720.     else {
  721.         return scOnFoot ;
  722.     }
  723. }
  724.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement