caja de marchas?
#1

Hay algъn fs de cambio de marcha, caja de marchas yo antes avнa descargado un sistema de caja de marchas que al estar en la primera marcha apretabas la tecla shift y pasa a la segunda y asн sucesivamente pero se me perdiу alguien lo tiene? creo que era de grove4l
Reply
#2

https://www.youtube.com/watch?v=n4HixoV1L1I
PHP код:
//-------------------------------------------------//
//-------------------------------------------------//
//-------------------------------------------------//
/*
        +-------------------------------------+
        |                                     |
        |         Cajas de Velocidades        |
        |            Por GROVE4L              |
        |        www.pawnoscripting.com       |
        |                                     |
        +-------------------------------------+
*/
//-------------------------------------------------//
//-------------------------------------------------//
//-------------------------------------------------//
#include <a_samp>
#define PRESSED(%0) \
    
(((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0)))
    
// Cambios
#define De1a2Cambio 50
#define De2a3Cambio 90
#define De3a4Cambio 120
#define De4a5Cambio 500
    
new Text:Velocimetro0[MAX_PLAYERS];
new 
Text:Velocimetro1[MAX_PLAYERS];
new 
Text:Velocimetro2[MAX_PLAYERS];
new 
Text:Velocimetro3[MAX_PLAYERS];
new 
Marcha[MAX_PLAYERS] = 0;
new 
NeutroV[MAX_PLAYERS];
public 
OnPlayerSpawn(playerid)
{
    
Velocimetro0[playerid] = TextDrawCreate(461.000000,372.000000,"_");
    
Velocimetro1[playerid] = TextDrawCreate(462.000000,377.000000,"Marcha:");
    
Velocimetro2[playerid] = TextDrawCreate(532.000000,377.000000,"~g~1ra"); //
    
Velocimetro3[playerid] = TextDrawCreate(461.000000,396.000000,"Velocidad:~g~150 Km/h"); //
    
TextDrawUseBox(Velocimetro0[playerid],1);
    
TextDrawBoxColor(Velocimetro0[playerid],0x00000066);
    
TextDrawTextSize(Velocimetro0[playerid],610.000000,0.000000);
    
TextDrawAlignment(Velocimetro0[playerid],0);
    
TextDrawAlignment(Velocimetro1[playerid],0);
    
TextDrawAlignment(Velocimetro2[playerid],0);
    
TextDrawAlignment(Velocimetro3[playerid],0);
    
TextDrawBackgroundColor(Velocimetro0[playerid],0x000000ff);
    
TextDrawBackgroundColor(Velocimetro1[playerid],0x000000ff);
    
TextDrawBackgroundColor(Velocimetro2[playerid],0x000000ff);
    
TextDrawBackgroundColor(Velocimetro3[playerid],0x000000ff);
    
TextDrawFont(Velocimetro0[playerid],3);
    
TextDrawLetterSize(Velocimetro0[playerid],0.000000,5.099999);
    
TextDrawFont(Velocimetro1[playerid],1);
    
TextDrawLetterSize(Velocimetro1[playerid],0.499999,1.400000);
    
TextDrawFont(Velocimetro2[playerid],1);
    
TextDrawLetterSize(Velocimetro2[playerid],0.399999,1.400000);
    
TextDrawFont(Velocimetro3[playerid],1);
    
TextDrawLetterSize(Velocimetro3[playerid],0.399999,1.800000);
    
TextDrawColor(Velocimetro0[playerid],0xffffffff);
    
TextDrawColor(Velocimetro1[playerid],0xffffffff);
    
TextDrawColor(Velocimetro2[playerid],0xffffffff);
    
TextDrawColor(Velocimetro3[playerid],0xffffffff);
    
TextDrawSetOutline(Velocimetro0[playerid],1);
    
TextDrawSetOutline(Velocimetro1[playerid],1);
    
TextDrawSetOutline(Velocimetro2[playerid],1);
    
TextDrawSetOutline(Velocimetro3[playerid],1);
    
TextDrawSetProportional(Velocimetro0[playerid],1);
    
TextDrawSetProportional(Velocimetro1[playerid],1);
    
TextDrawSetProportional(Velocimetro2[playerid],1);
    
TextDrawSetProportional(Velocimetro3[playerid],1);
    
TextDrawSetShadow(Velocimetro0[playerid],1);
    
TextDrawSetShadow(Velocimetro1[playerid],1);
    
TextDrawSetShadow(Velocimetro2[playerid],1);
    
TextDrawSetShadow(Velocimetro3[playerid],1);
    return 
1;
}
public 
OnPlayerDeath(playerid,killerid,reason)
{
    
ChauTextDraw(playerid);
    return 
1;
}
public 
OnPlayerUpdate(playerid)
{
    if(
GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
    {
        new 
string[256];
        
MostrarTextDraw(playerid);
        if(
Marcha[playerid] == 0)
        {
            
TogglePlayerControllable(playerid,0);
            
TextDrawSetString(Velocimetro2[playerid],"~p~Neutro");
            
TextDrawShowForPlayer(playerid,Velocimetro2[playerid]);
        }
        else if(
Marcha[playerid] == 1)
        {
            
NeutroV[playerid] = 0;
            
TogglePlayerControllable(playerid,1);
            
TextDrawSetString(Velocimetro2[playerid],"~g~1ra");
            
TextDrawShowForPlayer(playerid,Velocimetro2[playerid]);
        }
        else if(
Marcha[playerid] == 2)
        {
            
TextDrawSetString(Velocimetro2[playerid],"~g~2da");
            
TextDrawShowForPlayer(playerid,Velocimetro2[playerid]);
        }
        else if(
Marcha[playerid] == 3)
        {
            
TextDrawSetString(Velocimetro2[playerid],"~y~3ra");
            
TextDrawShowForPlayer(playerid,Velocimetro2[playerid]);
        }
        else if(
Marcha[playerid] == 4)
        {
            
TextDrawSetString(Velocimetro2[playerid],"~y~4ta");
            
TextDrawShowForPlayer(playerid,Velocimetro2[playerid]);
        }
        else if(
Marcha[playerid] == 5)
        {
            
TextDrawSetString(Velocimetro2[playerid],"~r~5ta");
            
TextDrawShowForPlayer(playerid,Velocimetro2[playerid]);
        }
        else if(
Marcha[playerid] == -1)
        {
            
NeutroV[playerid] = 0;
            
TogglePlayerControllable(playerid,1);
            
TextDrawSetString(Velocimetro2[playerid],"~g~Reversa");
            
TextDrawShowForPlayer(playerid,Velocimetro2[playerid]);
        }
        
        if(
SacarV(playerid) >= && SacarV(playerid) <= 119)
        {
              
format(stringsizeof(string), "Velocidad: ~g~%d ~w~Km/h"SacarV(playerid));
              
TextDrawSetString(Velocimetro3[playerid],string);
              
TextDrawShowForPlayer(playerid,Velocimetro3[playerid]);
        }
        else if(
SacarV(playerid) >= 120 && SacarV(playerid) <= 149)
        {
              
format(stringsizeof(string), "Velocidad: ~y~%d ~w~Km/h"SacarV(playerid));
              
TextDrawSetString(Velocimetro3[playerid],string);
              
TextDrawShowForPlayer(playerid,Velocimetro3[playerid]);
        }
        else if(
SacarV(playerid) >= 150)
        {
            
format(stringsizeof(string), "Velocidad: ~r~%d ~w~Km/h"SacarV(playerid));
              
TextDrawSetString(Velocimetro3[playerid],string);
              
TextDrawShowForPlayer(playerid,Velocimetro3[playerid]);
        }
        
        new 
Float:Vel[3];
        if(
ManejaAtras(GetPlayerVehicleID(playerid)) && Marcha[playerid] >= 1)
        {
            
GetPlayerVelocity(playeridVel[0], Vel[1], Vel[2]);
            
SetVehicleVelocity(GetPlayerVehicleID(playerid), Vel[0], Vel[1], Vel[2]);
        }
           if(
SacarV(playerid) >= 50 && Marcha[playerid] == 1)
        {
            
GetPlayerVelocity(playeridVel[0], Vel[1], Vel[2]);
            
SetVehicleVelocity(GetPlayerVehicleID(playerid), Vel[0], Vel[1], Vel[2]);
        }
        if(
SacarV(playerid) >= 80 && Marcha[playerid] == 2)
        {
            
GetPlayerVelocity(playeridVel[0], Vel[1], Vel[2]);
            
SetVehicleVelocity(GetPlayerVehicleID(playerid), Vel[0], Vel[1], Vel[2]);
        }
        if(
SacarV(playerid) >= 110 && Marcha[playerid] == 3)
        {
            
GetPlayerVelocity(playeridVel[0], Vel[1], Vel[2]);
            
SetVehicleVelocity(GetPlayerVehicleID(playerid), Vel[0], Vel[1], Vel[2]);
        }
        if(
SacarV(playerid) >= 135 && Marcha[playerid] == 4)
        {
            
GetPlayerVelocity(playeridVel[0], Vel[1], Vel[2]);
            
SetVehicleVelocity(GetPlayerVehicleID(playerid), Vel[0], Vel[1], Vel[2]);
        }
        if(
Marcha[playerid] == -&& !ManejaAtras(GetPlayerVehicleID(playerid)))
        {
            
GetPlayerVelocity(playeridVel[0], Vel[1], Vel[2]);
            
SetVehicleVelocity(GetPlayerVehicleID(playerid), Vel[0], Vel[1], Vel[2]);
        }
        return 
1;
    }
    else
    {
        
Marcha[playerid] = 0;
        
ChauTextDraw(playerid);
        return 
1;
    }
}
public 
OnPlayerKeyStateChange(playeridnewkeysoldkeys)
{
    if(
IsPlayerInAnyVehicle(playerid))
    {
        if(
newkeys == KEY_SECONDARY_ATTACK)
        {
            if(
Marcha[playerid] == 0)
            {
                
TogglePlayerControllable(playerid1);
                
Marcha[playerid] = 1;
                
RemovePlayerFromVehicle(playerid);
                
TogglePlayerControllable(playerid1);
            }
        }
        if(
PRESSED(KEY_ANALOG_UP) || PRESSED(KEY_ANALOG_RIGHT))
        {
            new 
Float:Vel[3];
            
GetPlayerVelocity(playeridVel[0], Vel[1], Vel[2]);
            if(
Marcha[playerid] == 5)
            {
                
Marcha[playerid] = 5;
                return 
1;
            }
            else
            {
                if(
Marcha[playerid] == -1)
                {
                    
Marcha[playerid] = 0;
                }
                else if(
Marcha[playerid] == 0)
                {
                    
Marcha[playerid] = 1;
                }
                else if(
Marcha[playerid] == && SacarV(playerid) >= && SacarV(playerid) <= De1a2Cambio)
                {
                    
Marcha[playerid] = 2;
                }
                else if(
Marcha[playerid] == && SacarV(playerid) >= De1a2Cambio && SacarV(playerid) <= De2a3Cambio)
                {
                    
Marcha[playerid] = 3;
                }
                else if(
Marcha[playerid] == && SacarV(playerid) >= De2a3Cambio && SacarV(playerid) <= De3a4Cambio)
                {
                    
Marcha[playerid] = 4;
                }
                else if(
Marcha[playerid] == && SacarV(playerid) >= De3a4Cambio && SacarV(playerid) <= De4a5Cambio)
                {
                    
Marcha[playerid] = 5;
                }
                return 
1;
            }
        }
        if(
PRESSED(KEY_ANALOG_DOWN) || PRESSED(KEY_ANALOG_LEFT))
        {
            if(
Marcha[playerid] == -1)
            {
                
Marcha[playerid] = -1;
                return 
1;
            }
            else
            {
                
Marcha[playerid]--;
                return 
1;
            }
        }
    }
    return 
1;
}
stock SacarV(playerid)
{
    new 
Float:ST[4];
    if(
IsPlayerInAnyVehicle(playerid))
    
GetVehicleVelocity(GetPlayerVehicleID(playerid),ST[0],ST[1],ST[2]);
    else 
GetPlayerVelocity(playerid,ST[0],ST[1],ST[2]);
    
ST[3] = floatsqroot(floatpower(floatabs(ST[0]), 2.0) + floatpower(floatabs(ST[1]), 2.0) + floatpower(floatabs(ST[2]), 2.0)) * 180.3;
    return 
floatround(ST[3]);
}
stock MostrarTextDraw(playerid)
{
    
TextDrawShowForPlayer(playerid,Velocimetro0[playerid]);
    
TextDrawShowForPlayer(playerid,Velocimetro1[playerid]);
    
TextDrawShowForPlayer(playerid,Velocimetro2[playerid]);
    
TextDrawShowForPlayer(playerid,Velocimetro3[playerid]);
}
stock ChauTextDraw(playerid)
{
    
TextDrawHideForPlayer(playerid,Velocimetro0[playerid]);
    
TextDrawHideForPlayer(playerid,Velocimetro1[playerid]);
    
TextDrawHideForPlayer(playerid,Velocimetro2[playerid]);
    
TextDrawHideForPlayer(playerid,Velocimetro3[playerid]);
}
stock ManejaAtras(vehicleid// Funcion de Joker
{
    new
        
Float:Float[3]
    ;
    if(
GetVehicleVelocity(vehicleidFloat[1], Float[2], Float[0]))
    {
        
GetVehicleZAngle(vehicleidFloat[0]);
        if(
Float[0] < 90)
        {
            if(
Float[1] > && Float[2] < 0) return true;
        }
        else if(
Float[0] < 180)
        {
            if(
Float[1] > && Float[2] > 0) return true;
        }
        else if(
Float[0] < 270)
        {
            if(
Float[1] < && Float[2] > 0) return true;
        }
        else if(
Float[1] < && Float[2] < 0) return true;
    }
    return 
false;
}
//                          Cajas de Velocidades por GROVE4L
//                                 www.pawnoscripting.com 
Reply
#3

Jaja este era el mismo que buscaba pero hay un problema como hago para que cuando el auto llegue a un mбximo de velocidad definido en este caso que llega a 20 kph en la 1era marcha como hago para que no se frene en seco? porque se frena en seco y vuelve a los 0 kph
Reply


Forum Jump:


Users browsing this thread: