SA-MP Forums

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

Reply
 
Thread Tools Display Modes
Old 02/08/2020, 12:56 AM   #11
SkolPlay
Huge Clucker
 
Join Date: Aug 2016
Posts: 212
Reputation: 1
Default Re: Mudar de veiculo

Quote:
Originally Posted by Khivory View Post
Você precisa usar um timer, o jogo não vai adivinhar quando você estiver nessas coordenadas.

Mande a forma como você está fazendo.
pawn Code:
//OnGameModeInit
for(new I = 0; I < MAX_PLAYERS; I ++)
    {
SetTimerEx("Transformar", 1000, true, "i", I);

public Transformar(playerid)
{
    if(IsPlayerInRangeOfPoint(playerid, 1.0,133.3896,-83.0210,1.4297))
    {
    new Float:ppos[3];
    new vehicleid = GetPlayerVehicleID(playerid);
    DestroyVehicle(vehicleid);
    GetPlayerPos(playerid, ppos[0], ppos[1], ppos[2]);
    vehicleid = AddStaticVehicleEx(560, ppos[0], ppos[1], ppos[2], 360, 0, 0, -1);
    PutPlayerInVehicle(playerid, vehicleid, 0);
    }
    return 1;
}
SkolPlay is offline   Reply With Quote
Old 02/08/2020, 02:13 AM   #12
MasterWinX
Big Clucker
 
MasterWinX's Avatar
 
Join Date: Mar 2019
Location: San Fierro
Posts: 95
Reputation: 1
Default Re: Mudar de veiculo

PHP Code:
// Global
new Veiculo[MAX_PLAYERS];
//

public OnPlayerConnect(playerid)
{
    if(
Veiculo[playerid] != INVALID_VEHICLE_IDDestroyVehicle(Veiculo[playerid]);
    
Veiculo[playerid] = INVALID_VEHICLE_ID;
    
SetTimerEx("Transformar"1000true"i"playerid);
}
public 
Transformar(playerid)
{
    if(
IsPlayerInRangeOfPoint(playerid1.0,133.3896,-83.0210,1.4297))
    {
        if(
IsPlayerInAnyVehicle(playerid) && GetPlayerState(playerid) == 2DestroyVehicle(GetPlayerVehicleID(playerid));
        new 
Float:ppos[3];
        
GetPlayerPos(playeridppos[0], ppos[1], ppos[2]);
        
Veiculo[playerid] = AddStaticVehicleEx(560ppos[0], ppos[1], ppos[2], 36000, -1);
        
PutPlayerInVehicle(playeridvehicleid0);
    }
    return 
1;

__________________
MasterWinX is offline   Reply With Quote
Old 02/08/2020, 11:54 AM   #13
SkolPlay
Huge Clucker
 
Join Date: Aug 2016
Posts: 212
Reputation: 1
Default Re: Mudar de veiculo

Quote:
Originally Posted by MasterWinX View Post
PHP Code:
// Global
new Veiculo[MAX_PLAYERS];
//

public OnPlayerConnect(playerid)
{
    if(
Veiculo[playerid] != INVALID_VEHICLE_IDDestroyVehicle(Veiculo[playerid]);
    
Veiculo[playerid] = INVALID_VEHICLE_ID;
    
SetTimerEx("Transformar"1000true"i"playerid);
}
public 
Transformar(playerid)
{
    if(
IsPlayerInRangeOfPoint(playerid1.0,133.3896,-83.0210,1.4297))
    {
        if(
IsPlayerInAnyVehicle(playerid) && GetPlayerState(playerid) == 2DestroyVehicle(GetPlayerVehicleID(playerid));
        new 
Float:ppos[3];
        
GetPlayerPos(playeridppos[0], ppos[1], ppos[2]);
        
Veiculo[playerid] = AddStaticVehicleEx(560ppos[0], ppos[1], ppos[2], 36000, -1);
        
PutPlayerInVehicle(playeridvehicleid0);
    }
    return 
1;

Não funcionou...
SkolPlay is offline   Reply With Quote
Old 02/08/2020, 12:52 PM   #14
MasterWinX
Big Clucker
 
MasterWinX's Avatar
 
Join Date: Mar 2019
Location: San Fierro
Posts: 95
Reputation: 1
Default Re: Mudar de veiculo

Tá, mas não funcionou o que?


EDIT: Se sua gamemode tiver uma public "OnPlayerLogin" ou algo do tipo, você pode tentar colocar o timer lá.
__________________
MasterWinX is offline   Reply With Quote
Old 02/08/2020, 01:00 PM   #15
SkolPlay
Huge Clucker
 
Join Date: Aug 2016
Posts: 212
Reputation: 1
Default Re: Mudar de veiculo

Quote:
Originally Posted by MasterWinX View Post
Tá, mas não funcionou o que?


EDIT: Se sua gamemode tiver uma public "OnPlayerLogin" ou algo do tipo, você pode tentar colocar o timer lá.
Não destruiu o carro atual que estou, e nem criou o que quero. Estou fazendo isto em uma gm nova, pra depois testar na gm do servidor.
SkolPlay is offline   Reply With Quote
Old 02/08/2020, 01:50 PM   #16
MasterWinX
Big Clucker
 
MasterWinX's Avatar
 
Join Date: Mar 2019
Location: San Fierro
Posts: 95
Reputation: 1
Default Re: Mudar de veiculo

Mude o código para:

PHP Code:
public Transformar(playerid)
{
    if(
IsPlayerInRangeOfPoint(playerid4.0133.3896, -83.02101.4297))
    {
        if(
IsPlayerInAnyVehicle(playerid) && GetPlayerState(playerid) == 2DestroyVehicle(GetPlayerVehicleID(playerid));
        new 
Float:ppos[4];
        
GetPlayerPos(playeridppos[0], ppos[1], ppos[2]);
        
GetPlayerFacingAngle(playeridppos[3]);
        
Veiculo[playerid] = AddStaticVehicleEx(560ppos[0], ppos[1], ppos[2], ppos[3], -1, -1, -1);
        
PutPlayerInVehicle(playeridVeiculo[playerid], 0);
    }
    return 
1;

__________________
MasterWinX is offline   Reply With Quote
Old 02/08/2020, 02:23 PM   #17
SkolPlay
Huge Clucker
 
Join Date: Aug 2016
Posts: 212
Reputation: 1
Default Re: Mudar de veiculo

Quote:
Originally Posted by MasterWinX View Post
Mude o código para:

PHP Code:
public Transformar(playerid)
{
    if(
IsPlayerInRangeOfPoint(playerid4.0133.3896, -83.02101.4297))
    {
        if(
IsPlayerInAnyVehicle(playerid) && GetPlayerState(playerid) == 2DestroyVehicle(GetPlayerVehicleID(playerid));
        new 
Float:ppos[4];
        
GetPlayerPos(playeridppos[0], ppos[1], ppos[2]);
        
GetPlayerFacingAngle(playeridppos[3]);
        
Veiculo[playerid] = AddStaticVehicleEx(560ppos[0], ppos[1], ppos[2], ppos[3], -1, -1, -1);
        
PutPlayerInVehicle(playeridVeiculo[playerid], 0);
    }
    return 
1;

Continua com os mesmo problemas que citei acima
SkolPlay is offline   Reply With Quote
Old 02/08/2020, 02:49 PM   #18
Khivory
Huge Clucker
 
Khivory's Avatar
 
Join Date: Feb 2020
Posts: 366
Reputation: 23
Default Re: Mudar de veiculo

Apenas faça um debug para descobrir onde está o problema, sem complicação.

PHP Code:
public Transformar(playerid) {
    print(
"TIMER CHAMADO!");
        if(
IsPlayerInRangeOfPoint(playerid5.0XYZ)) {
            print(
"VERIFICAÇÃO PASSOU!");
        }
    }

Primeiro print não é exibido: Timer não está sendo chamado.
Segundo print não é exibido: Verificação está errada.
Segundo print é exibido: Erro nas funções.
Khivory is offline   Reply With Quote
Old 02/08/2020, 02:59 PM   #19
MasterWinX
Big Clucker
 
MasterWinX's Avatar
 
Join Date: Mar 2019
Location: San Fierro
Posts: 95
Reputation: 1
Default Re: Mudar de veiculo

Cara, eu testei aqui e está funcionando perfeitamente!
__________________
MasterWinX is offline   Reply With Quote
Old 02/08/2020, 03:41 PM   #20
oRaphael
Huge Clucker
 
oRaphael's Avatar
 
Join Date: Jul 2019
Location: Goiânia, Goias.
Posts: 377
Reputation: 3
Default Re: Mudar de veiculo

Quote:
Originally Posted by SkolPlay View Post
Continua com os mesmo problemas que citei acima
É falta de vontade.
__________________
Shooter - Bob Lee Swagger
https://forum.sa-mp.com/showthread.php?p=4157259#post4157259
oRaphael 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] Manter veiculo parado sem mudar parametros ENGINE zHellSync Português/Portuguese 2 03/06/2019 09:41 PM
[Tutorial] Como Mudar a Placa do Veiculo [iPs]Bruno Tadeu Lançamentos/Releases 12 03/04/2016 11:45 PM
[Ajuda] Como mudar o preço do veiculo maykom15 Português/Portuguese 9 18/03/2015 04:08 PM
[Ajuda] Mudar Este Comando de Ligar Veiculo Marquito Português/Portuguese 7 07/01/2015 08:57 PM
[Ajuda]Mudar Cor do veiculo Luiz98 Português/Portuguese 6 07/04/2011 11:53 PM


All times are GMT. The time now is 07:30 AM.


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