SA-MP Forums Archive
[AJUDA]Ligando e desligando carro. - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: Non-English (https://sampforum.blast.hk/forumdisplay.php?fid=9)
+--- Forum: Languages (https://sampforum.blast.hk/forumdisplay.php?fid=33)
+---- Forum: Português/Portuguese (https://sampforum.blast.hk/forumdisplay.php?fid=34)
+---- Thread: [AJUDA]Ligando e desligando carro. (/showthread.php?tid=275489)



[AJUDA]Ligando e desligando carro. - danktog - 09.08.2011

ola galera, blz ?
estou fazendo um servidor de corrida e estou querendo por isso em meu servidor:
Quando o cara entrar no veнculo ele tem que aperta a tecla "+" para ligar o carro, e tambem pra desligar o carro aperta "+". entendeu ?

Vlw ae gente, se puderem me ajudar !


Re: [AJUDA]Ligando e desligando carro. - Gabriel Duarte - 09.08.2011

Clique


Re: [AJUDA]Ligando e desligando carro. - RockFire - 09.08.2011

pawn Код:
public OnGameModeInit()
{
    ManualVehicleEngineAndLights();
    return 1;
}

public OnPlayerKeyStateChange(playerid,newkeys,oldkeys)
{
    if(newkeys == KEY_SUBMISSION)
    {
        new a[8];
        GetVehicleParamsEx(a[0],a[1],a[2],a[3],a[4],a[5],a[6],a[7]);
        if(a[1] == 0)
        {
            SendClientMessage(playerid,-1,"Vocк ligou o carro !");
            SetVehicleParamsEx(a[0],1,a[2],a[3],a[4],a[5],a[6],a[7]);
        }
        else
        {
            SendClientMessage(playerid,-1,"Vocк desligou o carro !");
            SetVehicleParamsEx(a[0],0,a[2],a[3],a[4],a[5],a[6],a[7]);
        }
    }
    return 1;
}



Re: [AJUDA]Ligando e desligando carro. - danktog - 09.08.2011

Sabe o ID do "+" ?


Re: [AJUDA]Ligando e desligando carro. - RockFire - 09.08.2011

KEY_SUBMISSION

@OFF Esse anti-flood me irrita, This forum requires that you wait 120 seconds between posts. Please try again in 36 seconds. -.-


Re: [AJUDA]Ligando e desligando carro. - danktog - 09.08.2011

So aparece que ligou o carro, nгo aparece que desligou !
tem id da tecla "-" ?


Re: [AJUDA]Ligando e desligando carro. - RockFire - 09.08.2011

Tenta:
pawn Код:
new bool:Ligou[MAX_PLAYERS] = false;

public OnGameModeInit()
{
    ManualVehicleEngineAndLights();
    return 1;
}

public OnPlayerKeyStateChange(playerid,newkeys,oldkeys)
{
    if(newkeys == KEY_SUBMISSION)
    {
        new a[8];
        GetVehicleParamsEx(a[0],a[1],a[2],a[3],a[4],a[5],a[6],a[7]);
        if(Ligou[playerid] == false)
        {
            SendClientMessage(playerid,-1,"Vocк ligou o carro !");
            SetVehicleParamsEx(a[0],1,a[2],a[3],a[4],a[5],a[6],a[7]);
            Ligou[playerid] = true;
        }
        else
        {
            SendClientMessage(playerid,-1,"Vocк desligou o carro !");
            SetVehicleParamsEx(a[0],0,a[2],a[3],a[4],a[5],a[6],a[7]);
            Ligou[playerid] = false;
        }
    }
    return 1;
}
e nгo tem nenhuma tecla pra " - "


Re: [AJUDA]Ligando e desligando carro. - Bruno Pereira - 09.08.2011

PHP код:
new CarroLigo[MAX_PLAYERS};// Comeзo do GM
public OnGameModeInit()
{
    
ManualVehicleEngineAndLights();
    
CarroLigo[playerid] == 0;
    return 
1;
}
public 
OnPlayerKeyStateChange(playerid,newkeys,oldkeys)
{
    if(
newkeys == KEY_SUBMISSION)
    {
        new 
a[8];
        
GetVehicleParamsEx(a[0],a[1],a[2],a[3],a[4],a[5],a[6],a[7]);
        if(
a[1] == 0)
        {
            if(
CarroLigo[playerid]  == 0)
            {
            
SendClientMessage(playerid,-1,"Vocк ligou o carro !");
            
SetVehicleParamsEx(a[0],1,a[2],a[3],a[4],a[5],a[6],a[7]);
            
CarroLigo[playerid] = 1;
            }
        }
        else
        {
            if(
CarroLigo[playerid]  == 1)
            {
            
SendClientMessage(playerid,-1,"Vocк desligou o carro !");
            
SetVehicleParamsEx(a[0],0,a[2],a[3],a[4],a[5],a[6],a[7]);
            
CarroLigo[playerid]  = 0;
            }
        }
    }
    return 
1;

Editado agora ta funfando creio eu O.o.


Re: [AJUDA]Ligando e desligando carro. - RockFire - 09.08.2011

Quote:
Originally Posted by DJ Bruninho
Посмотреть сообщение
PHP код:
new CarroLigo;// Comeзo do GM
public OnGameModeInit()
{
    
ManualVehicleEngineAndLights();
    
CarroLigo == 0;
    return 
1;
}
public 
OnPlayerKeyStateChange(playerid,newkeys,oldkeys)
{
    if(
newkeys == KEY_SUBMISSION)
    {
        new 
a[8];
        
GetVehicleParamsEx(a[0],a[1],a[2],a[3],a[4],a[5],a[6],a[7]);
        if(
a[1] == 0)
        {
            if(
CarroLigo == 0)
            {
            
SendClientMessage(playerid,-1,"Vocк ligou o carro !");
            
SetVehicleParamsEx(a[0],1,a[2],a[3],a[4],a[5],a[6],a[7]);
            
CarroLigo 1;
            }
        }
        else
        {
            if(
CarroLigo == 1)
            {
            
SendClientMessage(playerid,-1,"Vocк desligou o carro !");
            
SetVehicleParamsEx(a[0],0,a[2],a[3],a[4],a[5],a[6],a[7]);
            
CarroLigo 0;
            }
        }
    }
    return 
1;

Tenta ae!
Erros:

CarroLigo == 0;

e vocк deveria usar uma array com MAX_PLAYERS :B


@OFF: PQP
This forum requires that you wait 120 seconds between posts. Please try again in 28 seconds.


Re: [AJUDA]Ligando e desligando carro. - Bruno Pereira - 09.08.2011

Nossa viajei agora, confundi O.o.

This forum requires that you wait 120 seconds between posts. Please try again in 46 seconds.
...
This forum requires that you wait 120 seconds between posts. Please try again in 20 seconds.