[Ajuda] Pneus
#1

Olб, eu fiz um sistema de pneus para veiculos mas eu nao sei como diferenciar as motos dos carros! porque eu quero que as motos precisem apenas de 4 pneus e os carros 4.. eu vi isso na GM: if(!IsABike(vehicleid)) que diferencia as bicicletas! mas como faзo para as motos?
Reply
#2

Esse tуpico pode te dar uma ajudinha: https://sampforum.blast.hk/showthread.php?tid=82664
Reply
#3

foi, mas tipo agora eu tou querendo colocar para que quando a moto estiver com 2 pneu o playernao possa adiocionar mais nela! coloquei assim?

OnPlayerUseItem:
PHP код:
        if(!strcmp(ItemName,"Tire",true))
    {
        new 
vehicleid GetPlayerVehicleID(playerid);
                            new 
Float:xFloat:yFloat:z;
                        for(new 
0GetVehiclePoolSize()+1mi++)
                        {
                            if(
GetVehicleModel(i) != 0)
                            {
                                
GetVehiclePos(ixyz);
                                if(
IsPlayerInRangeOfPoint(playerid5.0xyz))
                                {
                                if(
IsABike(vehicleid))
                                {
                                    if(
vInfo[i][vPneu] >= 2)
                                    return 
SendClientMessage(playerid0xFF0000Translate(Player[playerid][pIdioma], "[ERROR]: Esse Veiculo Ja Tem O Maximo De Pneus.""[ERROR]: This vehicle has the max tires."));
                                    else if
                                    
vInfo[i][vPneu]++;
                                    
SendClientMessage(playerid0xFF0000Translate(Player[playerid][pIdioma], "[INFO]: Pneu Colocado No Veiculo.""[INFO]: The tire were placed in the vehicle."));
                                     }
                                }
                            }
                        }
    } 
mas se eu coloco assim, o player nao consegue adicionar nenhum pneu! simplesmente acontece nada!

stock:

Quote:

stock IsBike(vehicleid)
{
switch(GetVehicleModel(vehicleid))
{
case 468: return 1;
default: return 0;
}
return 0;
}

HELP ME
Reply
#4

Se nгo me engano pode diferencia pelo id, por exemplo, se for veiculo 522 (NRG) ela explode, mais ou menos assm
Reply
#5

PHP код:
    if(!strcmp(ItemName,"Tire",true)) 
    { 
        new 
vehicleid GetPlayerVehicleID(playerid); 
                            new 
Float:xFloat:yFloat:z
                        for(new 
0GetVehiclePoolSize()+1mi++) 
                        { 
                            if(
GetVehicleModel(i) != 0
                            { 
                                
GetVehiclePos(ixyz); 
                                if(
IsPlayerInRangeOfPoint(playerid5.0xyz)) 
                                { 
                                if(
IsABike(vehicleid) && GetPlayerState(playerid) == 2)
                                { 
                                    if(
vInfo[i][vPneu] >= 2
                                    return 
SendClientMessage(playerid0xFF0000Translate(Player[playerid][pIdioma], "[ERROR]: Esse Veiculo Ja Tem O Maximo De Pneus.""[ERROR]: This vehicle has the max tires.")); 
                                    }
                                    else
                                    { 
                                    
vInfo[i][vPneu]++; 
                                    
SendClientMessage(playerid0xFF0000Translate(Player[playerid][pIdioma], "[INFO]: Pneu Colocado No Veiculo.""[INFO]: The tire were placed in the vehicle.")); 
                                     } 
                                } 
                            } 
                        } 
return 
1;
    } 
PHP код:
stock IsABike(veh)
{
  new 
Bike GetVehicleModel(veh);
  if(
bike == 448 || bike == 461 || bike == 463 || bike == 463 || bike == 468 || bike == 521 || bike == 522 || bike == 581 || bike == 586) return 1;
  return 
0// se for outro modelo

Reply
#6

https://sampforum.blast.hk/showthread.php?tid=441320

Seria isso ?
Reply
#7

Quote:
Originally Posted by MatheusOliveira
Посмотреть сообщение
PHP код:
    if(!strcmp(ItemName,"Tire",true)) 
    { 
        new 
vehicleid GetPlayerVehicleID(playerid); 
                            new 
Float:xFloat:yFloat:z
                        for(new 
0GetVehiclePoolSize()+1mi++) 
                        { 
                            if(
GetVehicleModel(i) != 0
                            { 
                                
GetVehiclePos(ixyz); 
                                if(
IsPlayerInRangeOfPoint(playerid5.0xyz)) 
                                { 
                                if(
IsABike(vehicleid) && GetPlayerState(playerid) == 2)
                                { 
                                    if(
vInfo[i][vPneu] >= 2
                                    return 
SendClientMessage(playerid0xFF0000Translate(Player[playerid][pIdioma], "[ERROR]: Esse Veiculo Ja Tem O Maximo De Pneus.""[ERROR]: This vehicle has the max tires.")); 
                                    }
                                    else
                                    { 
                                    
vInfo[i][vPneu]++; 
                                    
SendClientMessage(playerid0xFF0000Translate(Player[playerid][pIdioma], "[INFO]: Pneu Colocado No Veiculo.""[INFO]: The tire were placed in the vehicle.")); 
                                     } 
                                } 
                            } 
                        } 
return 
1;
    } 
PHP код:
stock IsABike(veh)
{
  new 
Bike GetVehicleModel(veh);
  if(
bike == 448 || bike == 461 || bike == 463 || bike == 463 || bike == 468 || bike == 521 || bike == 522 || bike == 581 || bike == 586) return 1;
  return 
0// se for outro modelo

Nгo ta limitando nao

Quote:
Originally Posted by Don_Speed
Посмотреть сообщение
nao :/
Reply
#8

cade o cуdigo que vocк verifica se estб em um veнculo para verificar os pneus ?
Reply
#9

Quote:
Originally Posted by [BOPE]Seu._.Madruga
Посмотреть сообщение
cade o cуdigo que vocк verifica se estб em um veнculo para verificar os pneus ?
eu fiz 2 pois eu acho que e a unica forma!

Apenas para motos:
PHP код:
    if(PRESSED(KEY_SUBMISSION))
{
    new 
vehicleid GetPlayerVehicleID(playerid);
    if(
GetPlayerState(playerid) != PLAYER_STATE_DRIVER)
    return 
SendClientMessage(playeridCOR_VERMELHOTranslate(Player[playerid][pIdioma], "[ERRO]: Vocк nгo estб dirigindo um veнculo.""[ERROR]: You're not driving a vehicle."));
    if(
IsBike(vehicleid))
    {
        if(
vInfo[vehicleid][vCombustivel] == 0)
        return 
SendClientMessage(playerid0xDE6847FFTranslate(Player[playerid][pIdioma], "[ERRO]: Sem Combustнvel." ,"[ERROR]: Empty fuel."));
        if(
vInfo[vehicleid][vTemMotor] == false)
          return 
SendClientMessage(playeridCOR_VERMELHOTranslate(Player[playerid][pIdioma], "[ERRO]: Este veнculo nгo tem motor.""[ERROR]: This vehicle not have engine."));
          if(
vInfo[vehicleid][vPneu] <= 1)
          return 
SendClientMessage(playeridCOR_VERMELHOTranslate(Player[playerid][pIdioma], "[ERRO]: Sem Pneus Suficiente.""[ERROR]: Not enough tires on the vehicle."));
        
GetVehicleParamsEx(vehicleidenginelightsalarmdoorsbonnetbootobjective);
        if(
vInfo[vehicleid][vMotor] == false)
        {
            
vInfo[vehicleid][vMotor] = true;
            
GameTextForPlayer(playerid"~w~Engine: ~g~ ON!"10003);
            
SetVehicleParamsEx(vehicleid1lightsalarmdoorsbonnetbootobjective);
        }
        else if(
vInfo[vehicleid][vMotor] == true)
        {
            
vInfo[vehicleid][vMotor] = false;
            
GameTextForPlayer(playerid"~w~Engine: ~r~ OFF!"10003);
            
SetVehicleParamsEx(vehicleid0lightsalarmdoorsbonnetbootobjective);
        }
    }

Para os restos dos veiculos com excessao das bicicletas!
PHP код:
if(PRESSED(KEY_SUBMISSION))
{
    new 
vehicleid GetPlayerVehicleID(playerid);
    if(
GetPlayerState(playerid) != PLAYER_STATE_DRIVER)
    return 
SendClientMessage(playeridCOR_VERMELHOTranslate(Player[playerid][pIdioma], "[ERRO]: Vocк nгo estб dirigindo um veнculo.""[ERROR]: You're not driving a vehicle."));
    if(!
IsABike(vehicleid) || !IsBike(vehicleid))
    {
        if(
vInfo[vehicleid][vCombustivel] == 0)
        return 
SendClientMessage(playerid0xDE6847FFTranslate(Player[playerid][pIdioma], "[ERRO]: Sem Combustнvel." ,"[ERROR]: Empty fuel."));
        if(
vInfo[vehicleid][vTemMotor] == false)
          return 
SendClientMessage(playeridCOR_VERMELHOTranslate(Player[playerid][pIdioma], "[ERRO]: Este veнculo nгo tem motor.""[ERROR]: This vehicle not have engine."));
          if(
vInfo[vehicleid][vPneu] <= 3)
          return 
SendClientMessage(playeridCOR_VERMELHOTranslate(Player[playerid][pIdioma], "[ERRO]: Sem Pneus Suficiente.""[ERROR]: Not enough tires on the vehicle."));
        
GetVehicleParamsEx(vehicleidenginelightsalarmdoorsbonnetbootobjective);
        if(
vInfo[vehicleid][vMotor] == false)
        {
            
vInfo[vehicleid][vMotor] = true;
            
GameTextForPlayer(playerid"~w~Engine: ~g~ ON!"10003);
            
SetVehicleParamsEx(vehicleid1lightsalarmdoorsbonnetbootobjective);
        }
        else if(
vInfo[vehicleid][vMotor] == true)
        {
            
vInfo[vehicleid][vMotor] = false;
            
GameTextForPlayer(playerid"~w~Engine: ~r~ OFF!"10003);
            
SetVehicleParamsEx(vehicleid0lightsalarmdoorsbonnetbootobjective);
        }
    } 
Reply
#10

Reconstrui o sistema! agora foi, obrigado a todos!
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)