SA-MP Forums

Go Back   SA-MP Forums > Non-English > Languages > Português/Portuguese

Reply
 
Thread Tools Display Modes
Old 03/11/2019, 07:33 PM   #1
pedrotvr
Huge Clucker
 
Join Date: Nov 2013
Posts: 386
Reputation: 7
Default Detectar se carro tem 4 portas

Alguém sabe como fafz pra detectar se tá num carro com 4 portas?
pedrotvr is offline   Reply With Quote
Old 03/11/2019, 08:47 PM   #2
willttoonn
Gangsta
 
willttoonn's Avatar
 
Join Date: Nov 2011
Location: Brazil
Posts: 914
Reputation: 88
Default Re: Detectar se carro tem 4 portas

Use este código do Emmet_:

pawn Code:
#define GetVehicleModelSeats(%0)                EVF::VehicleSeats[((%0)-400)]

new const EVF::VehicleSeats[MAX_VEHICLE_MODELS] = {
    4,2,2,2,4,4,1,2,2,4,2,2,2,4,2,2,4,2,4,2,4,4,2,2,2,1,4,4,4,2,1,7,1,2,2,0,2,7,4,2,4,1,2,2,2,4,1,2,1,0,0,2,1,1,1,2,2,2,4,4,
    2,2,2,2,1,1,4,4,2,2,4,2,1,1,2,2,1,2,2,4,2,1,4,3,1,1,1,4,2,2,4,2,4,1,2,2,2,4,4,2,2,1,2,2,2,2,2,4,2,1,1,2,1,1,2,2,4,2,2,1,
    1,2,2,2,2,2,2,2,2,4,1,1,1,2,2,2,2,7,7,1,4,2,2,2,2,2,4,4,2,2,4,4,2,1,2,2,2,2,2,2,4,4,2,2,1,2,4,4,1,0,0,1,1,2,1,2,2,1,2,4,
    4,2,4,1,0,4,2,2,2,2,0,0,7,2,2,1,4,4,4,2,2,2,2,2,4,2,0,0,0,4,0,0
};

Use o modelo do veículo na função, exemplo:
pawn Code:
new vehicleid = GetPlayerVehicleID(playerid);
new model = GetVehicleModel(vehicleid);
new seats = GetVehicleModelSeats(model);
__________________
Sometimes a captain has to make the unpopular call because that's his responsibility

Advanced Roleplay - Management and Head Developer
Brazilian Hard Roleplay Server


willttoonn is offline   Reply With Quote
Old 04/11/2019, 12:19 AM   #3
moura98
Huge Clucker
 
moura98's Avatar
 
Join Date: Jul 2015
Location: Brasil
Posts: 397
Reputation: 18
Default Re: Detectar se carro tem 4 portas

vc tb pode criar uma stock para verificar quais os veiculos tem 4 portas

PHP Code:
stock IsCarrosDe4P(carid)
{
    new 
model GetVehicleModel(carid);
    if(
model == exemplo1 || model == exemplo1 || model == exemplo3 )
    {
        return 
true;
    }
    return 
false;
}
if( 
IsCarrosDe4P ) {
...
...

__________________
moura98 is offline   Reply With Quote
Old 04/11/2019, 01:06 AM   #4
NWDMadara
Huge Clucker
 
NWDMadara's Avatar
 
Join Date: Mar 2018
Posts: 483
Reputation: 16
Default Re: Detectar se carro tem 4 portas

Quote:
Originally Posted by moura98 View Post
vc tb pode criar uma stock para verificar quais os veiculos tem 4 portas

PHP Code:
stock IsCarrosDe4P(carid)
{
    new 
model GetVehicleModel(carid);
    if(
model == exemplo1 || model == exemplo1 || model == exemplo3 )
    {
        return 
true;
    }
    return 
false;
}
if( 
IsCarrosDe4P ) {
...
...

A forma mais complicada e demorada de se fazer, isso porque eu não consegui pensar em outra.
NWDMadara is offline   Reply With Quote
Old 08/11/2019, 01:57 AM   #5
pedrotvr
Huge Clucker
 
Join Date: Nov 2013
Posts: 386
Reputation: 7
Default Re: Detectar se carro tem 4 portas

Quote:
Originally Posted by willttoonn View Post
Use este código do Emmet_:

pawn Code:
#define GetVehicleModelSeats(%0)                EVF::VehicleSeats[((%0)-400)]

new const EVF::VehicleSeats[MAX_VEHICLE_MODELS] = {
    4,2,2,2,4,4,1,2,2,4,2,2,2,4,2,2,4,2,4,2,4,4,2,2,2,1,4,4,4,2,1,7,1,2,2,0,2,7,4,2,4,1,2,2,2,4,1,2,1,0,0,2,1,1,1,2,2,2,4,4,
    2,2,2,2,1,1,4,4,2,2,4,2,1,1,2,2,1,2,2,4,2,1,4,3,1,1,1,4,2,2,4,2,4,1,2,2,2,4,4,2,2,1,2,2,2,2,2,4,2,1,1,2,1,1,2,2,4,2,2,1,
    1,2,2,2,2,2,2,2,2,4,1,1,1,2,2,2,2,7,7,1,4,2,2,2,2,2,4,4,2,2,4,4,2,1,2,2,2,2,2,2,4,4,2,2,1,2,4,4,1,0,0,1,1,2,1,2,2,1,2,4,
    4,2,4,1,0,4,2,2,2,2,0,0,7,2,2,1,4,4,4,2,2,2,2,2,4,2,0,0,0,4,0,0
};

Use o modelo do veículo na função, exemplo:
pawn Code:
new vehicleid = GetPlayerVehicleID(playerid);
new model = GetVehicleModel(vehicleid);
new seats = GetVehicleModelSeats(model);
Vlw mito, +rep

Mas tá dando erro aqui:


pawn Code:
// pegar quantidade de assentos tem em um carro
#define GetVehicleModelSeats(%0)                EVF::VehicleSeats[((%0)-400)]

//error 001: expected token: ";", but found "::"
new const EVF::VehicleSeats[MAX_VEHICLE_MODELS] = {
    4,2,2,2,4,4,1,2,2,4,2,2,2,4,2,2,4,2,4,2,4,4,2,2,2,1,4,4,4,2,1,7,1,2,2,0,2,7,4,2,4,1,2,2,2,4,1,2,1,0,0,2,1,1,1,2,2,2,4,4,
    2,2,2,2,1,1,4,4,2,2,4,2,1,1,2,2,1,2,2,4,2,1,4,3,1,1,1,4,2,2,4,2,4,1,2,2,2,4,4,2,2,1,2,2,2,2,2,4,2,1,1,2,1,1,2,2,4,2,2,1,
    1,2,2,2,2,2,2,2,2,4,1,1,1,2,2,2,2,7,7,1,4,2,2,2,2,2,4,4,2,2,4,4,2,1,2,2,2,2,2,2,4,4,2,2,1,2,4,4,1,0,0,1,1,2,1,2,2,1,2,4,
    4,2,4,1,0,4,2,2,2,2,0,0,7,2,2,1,4,4,4,2,2,2,2,2,4,2,0,0,0,4,0,0
//error 010: invalid function or declaration
};
pedrotvr is offline   Reply With Quote
Old 08/11/2019, 08:31 AM   #6
Menorzin
Little Clucker
 
Join Date: May 2019
Posts: 26
Reputation: 0
Default Re: Detectar se carro tem 4 portas

Baixe essa include
https://forum.sa-mp.com/showthread.php?t=611142
__________________
Perfect City - RPG
  • Web Developer
Menorzin is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[Ajuda] Detectar batida de carro pedrotvr Português/Portuguese 5 28/02/2017 10:07 AM
[Ajuda] Portas axellech Português/Portuguese 1 16/04/2016 06:15 PM
[Ajuda] É possível detectar o player que destruiu um carro e matou quem tava dentro? arakuta Português/Portuguese 10 29/10/2013 04:46 AM
[Ajuda] portas Adriano_MQD Português/Portuguese 0 12/07/2012 06:19 PM
[AJUDA] Detectar Vida Do Carro Power_GamerX Português/Portuguese 13 09/02/2011 11:38 PM


All times are GMT. The time now is 08:58 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.