[AJUDA] Mudar botao pra por marcha
#1

eu achei um comando de marcha e qero sabe como poe pra passa em vez de control para 0

PHP код:
#include <a_samp>
#define MaxPlayers 500
new
    
vTests[MaxPlayers],
    
TransAtual[MaxPlayers],
        
Text:KmTrans[MaxPlayers],
        
Text:OneTrans[MaxPlayers],
        
Text:TwoTrans[MaxPlayers],
        
Text:BackTrans[MaxPlayers],
        
Text:TreeTrans[MaxPlayers],
        
Text:FourTrans[MaxPlayers],
        
Text:FiveTrans[MaxPlayers],
        
Text:VeloTrans[MaxPlayers],
        
Text:CountTrans[MaxPlayers];
stock SemMarcha(vehicleid)
{
        new 
result;
        new 
model GetVehicleModel(vehicleid);
    switch(
model)
    {
        case 
595593592577563553548520519513512511510509497493488487481476473472469460454453452447446430425417result model;
        default: 
result 0;
    }
        return 
result;
}
enum mInfo {    MarchaSpeed };
new 
MarchaInfo[][mInfo] = {     {0,000},        {1,025},        {2,055},        {3,085},        {4,115},        {5,140} };
#define PRESSED(%0) \
        
(((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0))) //
public OnPlayerConnect(playerid)
{
        
BackTrans[playerid] = TextDrawCreate(250.000000380.000000"a");
        
TextDrawBackgroundColor(BackTrans[playerid], 255);
        
TextDrawFont(BackTrans[playerid], 1);
        
TextDrawLetterSize(BackTrans[playerid], 0.0000004.000000);
        
TextDrawColor(BackTrans[playerid], -1);
        
TextDrawSetOutline(BackTrans[playerid], 0);
        
TextDrawSetProportional(BackTrans[playerid], 1);
        
TextDrawSetShadow(BackTrans[playerid], 1);
        
TextDrawUseBox(BackTrans[playerid], 1);
        
TextDrawBoxColor(BackTrans[playerid], 255);
        
TextDrawTextSize(BackTrans[playerid], 358.000000140.000000);
        
OneTrans[playerid] = TextDrawCreate(250.000000340.000000"-");
        
TextDrawBackgroundColor(OneTrans[playerid], 255);
        
TextDrawFont(OneTrans[playerid], 1);
        
TextDrawLetterSize(OneTrans[playerid], 0.20000010.799995);
        
TextDrawColor(OneTrans[playerid], -1);
        
TextDrawSetOutline(OneTrans[playerid], 0);
        
TextDrawSetProportional(OneTrans[playerid], 1);
        
TextDrawSetShadow(OneTrans[playerid], 1);
        
TwoTrans[playerid]  = TextDrawCreate(255.000000340.000000"-");
        
TextDrawBackgroundColor(TwoTrans[playerid] , 255);
        
TextDrawFont(TwoTrans[playerid] , 1);
        
TextDrawLetterSize(TwoTrans[playerid] , 0.20000010.799995);
        
TextDrawColor(TwoTrans[playerid] , -1);
        
TextDrawSetOutline(TwoTrans[playerid] , 0);
        
TextDrawSetProportional(TwoTrans[playerid] , 1);
        
TextDrawSetShadow(TwoTrans[playerid] , 1);
        
TreeTrans[playerid] = TextDrawCreate(260.000000340.000000"-");
        
TextDrawBackgroundColor(TreeTrans[playerid], 255);
        
TextDrawFont(TreeTrans[playerid], 1);
        
TextDrawLetterSize(TreeTrans[playerid], 0.20000010.799995);
        
TextDrawColor(TreeTrans[playerid], -1);
        
TextDrawSetOutline(TreeTrans[playerid], 0);
        
TextDrawSetProportional(TreeTrans[playerid], 1);
        
TextDrawSetShadow(TreeTrans[playerid], 1);
        
FourTrans[playerid] = TextDrawCreate(265.000000340.000000"-");
        
TextDrawBackgroundColor(FourTrans[playerid], 255);
        
TextDrawFont(FourTrans[playerid], 1);
        
TextDrawLetterSize(FourTrans[playerid], 0.20000010.799995);
        
TextDrawColor(FourTrans[playerid], -1);
        
TextDrawSetOutline(FourTrans[playerid], 0);
        
TextDrawSetProportional(FourTrans[playerid], 1);
        
TextDrawSetShadow(FourTrans[playerid], 1);
        
FiveTrans[playerid] = TextDrawCreate(270.000000340.000000"-");
        
TextDrawBackgroundColor(FiveTrans[playerid], 255);
        
TextDrawFont(FiveTrans[playerid], 1);
        
TextDrawLetterSize(FiveTrans[playerid], 0.20000010.799995);
        
TextDrawColor(FiveTrans[playerid], -1);
        
TextDrawSetOutline(FiveTrans[playerid], 0);
        
TextDrawSetProportional(FiveTrans[playerid], 1);
        
TextDrawSetShadow(FiveTrans[playerid], 1);
        
KmTrans[playerid] = TextDrawCreate(315.000000395.000000"KM/H");
        
TextDrawBackgroundColor(KmTrans[playerid], 255);
        
TextDrawFont(KmTrans[playerid], 1);
        
TextDrawLetterSize(KmTrans[playerid], 0.5000001.000000);
        
TextDrawColor(KmTrans[playerid], -1);
        
TextDrawSetOutline(KmTrans[playerid], 0);
        
TextDrawSetProportional(KmTrans[playerid], 1);
        
TextDrawSetShadow(KmTrans[playerid], 1);
        
VeloTrans[playerid] = TextDrawCreate(281.000000396.000000"_");
        
TextDrawBackgroundColor(VeloTrans[playerid], 255);
        
TextDrawFont(VeloTrans[playerid], 1);
        
TextDrawLetterSize(VeloTrans[playerid], 0.5000001.000000);
        
TextDrawColor(VeloTrans[playerid], -1);
        
TextDrawSetOutline(VeloTrans[playerid], 0);
        
TextDrawSetProportional(VeloTrans[playerid], 1);
        
TextDrawSetShadow(VeloTrans[playerid], 1);
        
CountTrans[playerid] = TextDrawCreate(283.000000381.000000"Trans:~r~");
        
TextDrawBackgroundColor(CountTrans[playerid], 255);
        
TextDrawFont(CountTrans[playerid], 1);
        
TextDrawLetterSize(CountTrans[playerid], 0.5000001.000000);
        
TextDrawColor(CountTrans[playerid], -1);
        
TextDrawSetOutline(CountTrans[playerid], 0);
        
TextDrawSetProportional(CountTrans[playerid], 1);
        
TextDrawSetShadow(CountTrans[playerid], 1);
        return 
true;
}
stock LimitarVelocidade(playerid,vAtual,Vid)
{
    new 
mAtual TransAtual[playerid];
    if(
vAtual MarchaInfo[mAtual][Speed] && mAtual != 5)
    {
        ++
vTests[playerid];
        
GameTextForPlayer(playerid,"~r~Cuidado - Troque de Marcha ! Striker Samp",2000,5);
    }
    if(
vTests[playerid] >= 3)
    {
        
vTests[playerid] = 0;
        
SetVehicleSpeed(Vid,(MarchaInfo[mAtual][Speed] - 5));
    }
        if(
vAtual MarchaInfo[mAtual][Speed] - 35)     --TransAtual[playerid];
        if(
vAtual == 0)                                                   TransAtual[playerid] = 0;
    return 
true;
}
stock AtualizarVelocidade(playerid,vAtual)
{
    if(!
SemMarcha(playerid) && IsPlayerInAnyVehicle(playerid))
    {
                new     
sString[18];
                
format(sString,18,"~r~%d",vAtual);
                
TextDrawHideForPlayer(playeridVeloTrans[playerid]);
                
TextDrawSetString(VeloTrans[playerid],sString);
                
TextDrawShowForPlayer(playeridVeloTrans[playerid]);
    }
        return 
true;
}
stock AtualizarMarcha(playerid,number)
{
        new
                
sString[100];
        if(
IsPlayerInAnyVehicle(playerid))
    {
        
format(sString,18,"Trans:~r~%d",TransAtual[playerid]);
        
TextDrawHideForPlayer(playeridCountTrans[playerid]);
        
TextDrawSetString(CountTrans[playerid],sString);
        
TextDrawShowForPlayer(playeridCountTrans[playerid]);
        }
        if(
number == 0)
        {
                
TextDrawHideForPlayer(playeridOneTrans[playerid]);
                
TextDrawHideForPlayer(playeridTwoTrans[playerid]);
                
TextDrawHideForPlayer(playeridTreeTrans[playerid]);
                
TextDrawHideForPlayer(playeridFourTrans[playerid]);
                
TextDrawHideForPlayer(playeridFiveTrans[playerid]);
        }
        if(
number == 1)
        {
                
TextDrawShowForPlayer(playeridOneTrans[playerid]);
                
TextDrawHideForPlayer(playeridTwoTrans[playerid]);
                
TextDrawHideForPlayer(playeridTreeTrans[playerid]);
                
TextDrawHideForPlayer(playeridFourTrans[playerid]);
                
TextDrawHideForPlayer(playeridFiveTrans[playerid]);
        }
        if(
number == 2)
        {
                
TextDrawShowForPlayer(playeridOneTrans[playerid]);
                
TextDrawShowForPlayer(playeridTwoTrans[playerid]);
                
TextDrawHideForPlayer(playeridTreeTrans[playerid]);
                
TextDrawHideForPlayer(playeridFourTrans[playerid]);
                
TextDrawHideForPlayer(playeridFiveTrans[playerid]);
        }
        if(
number == 3)
        {
                
TextDrawShowForPlayer(playeridOneTrans[playerid]);
                
TextDrawShowForPlayer(playeridTwoTrans[playerid]);
                
TextDrawShowForPlayer(playeridTreeTrans[playerid]);
                
TextDrawHideForPlayer(playeridFourTrans[playerid]);
                
TextDrawHideForPlayer(playeridFiveTrans[playerid]);
        }
        if(
number == 4)
        {
                
TextDrawShowForPlayer(playeridOneTrans[playerid]);
                
TextDrawShowForPlayer(playeridTwoTrans[playerid]);
                
TextDrawShowForPlayer(playeridTreeTrans[playerid]);
                
TextDrawShowForPlayer(playeridFourTrans[playerid]);
                
TextDrawHideForPlayer(playeridFiveTrans[playerid]);
        }
        if(
number == 5)
        {
                
TextDrawShowForPlayer(playeridOneTrans[playerid]);
                
TextDrawShowForPlayer(playeridTwoTrans[playerid]);
                
TextDrawShowForPlayer(playeridTreeTrans[playerid]);
                
TextDrawShowForPlayer(playeridFourTrans[playerid]);
                
TextDrawShowForPlayer(playeridFiveTrans[playerid]);
        }
        if(
number == 10)
        {
                
TextDrawShowForPlayer(playeridOneTrans[playerid]);
                
TextDrawShowForPlayer(playeridTwoTrans[playerid]);
                
TextDrawShowForPlayer(playeridTreeTrans[playerid]);
                
TextDrawShowForPlayer(playeridFourTrans[playerid]);
                
TextDrawShowForPlayer(playeridFiveTrans[playerid]);
        }
        return 
true;
}
public 
OnPlayerUpdate(playerid)
{
        if(!
IsPlayerInAnyVehicle(playerid))
        {
        
TextDrawHideForPlayer(playeridBackTrans[playerid]);
        
TextDrawHideForPlayer(playeridOneTrans[playerid]);
        
TextDrawHideForPlayer(playeridTwoTrans[playerid]);
        
TextDrawHideForPlayer(playeridTreeTrans[playerid]);
        
TextDrawHideForPlayer(playeridFourTrans[playerid]);
        
TextDrawHideForPlayer(playeridFiveTrans[playerid]);
        
TextDrawHideForPlayer(playeridKmTrans[playerid]);
        
TextDrawHideForPlayer(playeridVeloTrans[playerid]);
        
TextDrawHideForPlayer(playeridCountTrans[playerid]);
        }
        if(
IsPlayerInAnyVehicle(playerid))
        {
                new
                        
Vid GetPlayerVehicleID(playerid),
                        
vAtual GetPlayerSpeed(playerid,true);
                
LimitarVelocidade(playerid,vAtual,Vid);
                
AtualizarVelocidade(playerid,vAtual);
        }
        if(
TransAtual[playerid] < 0TransAtual[playerid] = 0;
        return 
true;
}
public 
OnPlayerStateChange(playerid,newstate,oldstate)
{
        if(
newstate == PLAYER_STATE_DRIVER)
        {
                
TextDrawShowForPlayer(playeridBackTrans[playerid]);
                
TextDrawShowForPlayer(playeridKmTrans[playerid]);
                
TextDrawShowForPlayer(playeridVeloTrans[playerid]);
                
TextDrawShowForPlayer(playeridCountTrans[playerid]);
        }
        else
        {
        
TextDrawHideForPlayer(playeridBackTrans[playerid]);
                
TextDrawHideForPlayer(playeridOneTrans[playerid]);
                
TextDrawHideForPlayer(playeridTwoTrans[playerid]);
                
TextDrawHideForPlayer(playeridTreeTrans[playerid]);
                
TextDrawHideForPlayer(playeridFourTrans[playerid]);
                
TextDrawHideForPlayer(playeridFiveTrans[playerid]);
                
TextDrawHideForPlayer(playeridKmTrans[playerid]);
                
TextDrawHideForPlayer(playeridVeloTrans[playerid]);
                
TextDrawHideForPlayer(playeridCountTrans[playerid]);
        }
    return 
true;
}
public 
OnPlayerExitVehicle(playerid,vehicleid)
{
                
TextDrawHideForPlayer(playeridBackTrans[playerid]);
                
TextDrawHideForPlayer(playeridOneTrans[playerid]);
                
TextDrawHideForPlayer(playeridTwoTrans[playerid]);
                
TextDrawHideForPlayer(playeridTreeTrans[playerid]);
                
TextDrawHideForPlayer(playeridFourTrans[playerid]);
                
TextDrawHideForPlayer(playeridFiveTrans[playerid]);
                
TextDrawHideForPlayer(playeridKmTrans[playerid]);
                
TextDrawHideForPlayer(playeridVeloTrans[playerid]);
                
TextDrawHideForPlayer(playeridCountTrans[playerid]);
                
TransAtual[vehicleid] = 0;
                return 
1;
}
public 
OnPlayerKeyStateChange(playeridnewkeysoldkeys)
{
    if(
SemMarcha(GetPlayerVehicleID(playerid)))
        {
        new     
sString[50];
        
TransAtual[playerid] = 10;
        
TextDrawHideForPlayer(playeridVeloTrans[playerid]);
        
format(sString,50,"~r~Auto");
        
TextDrawSetString(VeloTrans[playerid],sString);
        }
        if (
newkeys KEY_FIRE && IsPlayerInAnyVehicle(playerid)  && !SemMarcha(GetPlayerVehicleID(playerid)))                  TransAtual[playerid]++  ;
        if(
TransAtual[playerid] > && IsPlayerInAnyVehicle(playerid)  && !SemMarcha(GetPlayerVehicleID(playerid)))     TransAtual[playerid] = 5;
        
AtualizarMarcha(playerid,               TransAtual[playerid])   ;
        return 
true;
}
public 
OnPlayerEnterVehicle(playerid,vehicleid)
{
    if(
SemMarcha(GetPlayerVehicleID(playerid)))
        {
        new     
sString[50];
        
TransAtual[playerid] = 10;
        
TextDrawHideForPlayer(playeridVeloTrans[playerid]);
        
format(sString,50,"~r~Auto");
        
TextDrawSetString(VeloTrans[playerid],sString);
        }
        return 
1;
}
stock GetPlayerSpeed(playerid,bool:kmh)//by misco
{
  new 
Float:Vx,Float:Vy,Float:Vz,Float:rtn;
  if(
IsPlayerInAnyVehicle(playerid)) GetVehicleVelocity(GetPlayerVehicleID(playerid),Vx,Vy,Vz);
  
rtn floatsqroot(floatabs(floatpower(Vx Vy Vz,2)));
  return 
kmh?floatround(rtn 100 1.61):floatround(rtn 100);
}
stock SetVehicleSpeed vehicleid Float:speed mode //
{
        new 
Float:vAngle;
    
GetVehicleZAngle vehicleid vAngle ) ;
    
speed = ( ( !mode ) ? ( floatdiv speed105.0 ) ) : ( floatdiv speed170.0 ) ) );
        return 
SetVehicleVelocity vehicleid speed floatsin ( -vAngle degrees ) , speed floatcos ( -vAngle degrees ) , 0.0 ) ;

Reply


Messages In This Thread
[AJUDA] Mudar botao pra por marcha - by rene20 - 03.06.2012, 16:52
Re: [AJUDA] Mudar botao pra por marcha - by paulor - 03.06.2012, 17:27

Forum Jump:


Users browsing this thread: 1 Guest(s)