SA-MP Forums

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

Reply
 
Thread Tools Display Modes
Old 02/12/2012, 07:31 PM   #1
Fire_Hell
Big Clucker
 
Join Date: Oct 2011
Posts: 103
Reputation: 0
Default Tecla pressionada

Olá, eu criar botar paara o Player PRESSIONAR uma tecla, e fazer para ela.
  • Ligar o carro
  • Ligar o farol do carro

Bom, aqui está a parte para ligar. Ele ta para apertar e ligar, eu queria que ele preciona-se para ligar.

PHP Code:
if((newkeys == 128) && (IsPlayerInAnyVehicle(playerid)))
    {
        
OnPlayerCommandText(playerid"/motor");
        return 
1;
}
if ((
newkeys 4) && (IsPlayerInAnyVehicle(playerid)))
    {
        
OnPlayerCommandText(playerid"/farol");
        return 
1;
    }
    return 
1;

Se poder mudar a tecla "Espaço" para ligar o carro para a tecla "Shift" agradeço.
__________________
_ _ _ _ _ _ _ _ _ _|INICIANTE EM PAWNO|_ _ _ _ _ _ _ _ _ _ _

Ajudei? Da um agradecer, não cai o dedo!
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
Fire_Hell is offline   Reply With Quote
Old 02/12/2012, 07:37 PM   #2
lucas_mdr1235
Gangsta
 
lucas_mdr1235's Avatar
 
Join Date: Jan 2010
Location: Ipatinga - MG
Posts: 746
Reputation: 34
Default Re: Tecla pressionada

so vc dar uma olhada e substituir pela desejada


@EDIT
Esta lista aki esta atualizada
http://wiki.sa-mp.com/wiki/GetPlayerKeys
__________________
O impossível e aquilo que ninguém consegue fazer. Até que você faça ! ! !
PlAy ViRtUaL ReAlItY
Minha mãe me disse certa vez que ninguém me amava mais do que DEUS. Eu perguntei a ela se ela enviaria alguém atrás de mim para me ferir, torturar e causar dor eterna se algum dia eu a renegasse. Ela olhou para mim chocada e respondeu:
-Claro que não! Eu disse a ela, bom, já temos uma pessoas que me ama mais do que DEUS.
By: Neal Jordan
Se, numa discussão, um dos muitos que gostariam de saber de tudo, mas se recusam a aprender qualquer coisa, nos pergunta a respeito da continuação da vida após a morte, a resposta mais adequada e mais correta e:"Após a morte você será o que era antes de nascer."
By: Arthur Schopenhauer
lucas_mdr1235 is offline   Reply With Quote
Old 02/12/2012, 07:48 PM   #3
Fire_Hell
Big Clucker
 
Join Date: Oct 2011
Posts: 103
Reputation: 0
Default Re: Tecla pressionada

Sim, trocar a tecla é o de menos, mais eu quero que o Player PRESSIONE a tecla para ligar o carro e o farol...
__________________
_ _ _ _ _ _ _ _ _ _|INICIANTE EM PAWNO|_ _ _ _ _ _ _ _ _ _ _

Ajudei? Da um agradecer, não cai o dedo!
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
Fire_Hell is offline   Reply With Quote
Old 02/12/2012, 08:07 PM   #4
adri1
Banned
 
Join Date: Oct 2010
Posts: 1,779
Reputation: 965
Default Respuesta: Tecla pressionada

No entiendo muy bien portugues. Pero aquí te dejo algo para que no haya errores futuros:
Code:
 
if((newkeys == 128) && (IsPlayerInAnyVehicle(playerid))) 
{ 
        new engine, lights, alarm, doors, bonnet, boot, objective;
        GetVehicleParamsEx(GetPlayerVehicleID(playerid), engine, lights, alarm, doors, bonnet, boot, objective);
        if(!engine) OnPlayerCommandText(playerid, "/motor"); 
        return 1; 
} 
if ((newkeys & 4) && (IsPlayerInAnyVehicle(playerid))) 
{ 
        new engine, lights, alarm, doors, bonnet, boot, objective;
        GetVehicleParamsEx(GetPlayerVehicleID(playerid), engine, lights, alarm, doors, bonnet, boot, objective);
        if(!lights) OnPlayerCommandText(playerid, "/farol"); 
        return 1; 
} 
return 1; 
}
and for the keys, is say in the topic


EDIT: Test this...
Code:
 
if((newkeys == 128) && (IsPlayerInAnyVehicle(playerid))) 
{ 
        new engine, lights, alarm, doors, bonnet, boot, objective;
        GetVehicleParamsEx(GetPlayerVehicleID(playerid), engine, lights, alarm, doors, bonnet, boot, objective);
        if(!engine) 
        {
              GetVehicleParamsEx(GetPlayerVehicleID(playerid), engine, lights, alarm, doors, bonnet, boot, objective);
              SetVehicleParamsEx(GetPlayerVehicleID(playerid), VEHICLE_PARAMS_ON, lights, alarm, doors, bonnet, boot, objective);
        }
        else
        {
              GetVehicleParamsEx(GetPlayerVehicleID(playerid), engine, lights, alarm, doors, bonnet, boot, objective);
              SetVehicleParamsEx(GetPlayerVehicleID(playerid), VEHICLE_PARAMS_OFF, lights, alarm, doors, bonnet, boot, objective);
        }
        return 1; 
} 
if ((newkeys & 4) && (IsPlayerInAnyVehicle(playerid))) 
{ 
        new engine, lights, alarm, doors, bonnet, boot, objective;
        GetVehicleParamsEx(GetPlayerVehicleID(playerid), engine, lights, alarm, doors, bonnet, boot, objective);
        if(!lights)
        {
              GetVehicleParamsEx(GetPlayerVehicleID(playerid), engine, lights, alarm, doors, bonnet, boot, objective);
              SetVehicleParamsEx(GetPlayerVehicleID(playerid), engine, VEHICLE_PARAMS_ON, alarm, doors, bonnet, boot, objective);
        }
        else
        {
              GetVehicleParamsEx(GetPlayerVehicleID(playerid), engine, lights, alarm, doors, bonnet, boot, objective);
              SetVehicleParamsEx(GetPlayerVehicleID(playerid), engine, VEHICLE_PARAMS_OFF, alarm, doors, bonnet, boot, objective);
        }
        return 1; 
} 
return 1; 
}
adri1 is offline   Reply With Quote
Old 02/12/2012, 08:17 PM   #5
Fire_Hell
Big Clucker
 
Join Date: Oct 2011
Posts: 103
Reputation: 0
Default Re: Tecla pressionada

Olá adi1, agora o comando não funcina.

Eu gostaria de dar um tempo pressionado para ligar o carro e o farol.

Obrigado.
__________________
_ _ _ _ _ _ _ _ _ _|INICIANTE EM PAWNO|_ _ _ _ _ _ _ _ _ _ _

Ajudei? Da um agradecer, não cai o dedo!
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
Fire_Hell is offline   Reply With Quote
Old 02/12/2012, 08:30 PM   #6
BreakDriFT
High-roller
 
BreakDriFT's Avatar
 
Join Date: Jun 2010
Location: Las Venturas
Posts: 1,553
Reputation: 138
Default Re: Tecla pressionada

http://wiki.sa-mp.com/wiki/OnPlayerKeyStateChange.


Para ter que esperar, pode usar um SetTimerEx
BreakDriFT is offline   Reply With Quote
Old 02/12/2012, 08:35 PM   #7
adri1
Banned
 
Join Date: Oct 2010
Posts: 1,779
Reputation: 965
Default Respuesta: Re: Tecla pressionada

Quote:
Originally Posted by Fire_Hell View Post
Olá adi1, agora o comando não funcina.

Eu gostaria de dar um tempo pressionado para ligar o carro e o farol.

Obrigado.
Okay. This is:
on top:
Code:
new TimerToVehicleParams[MAX_PLAYER];
in OnPlayerKeyStateChange:
Code:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if((newkeys == 128) && (IsPlayerInAnyVehicle(playerid))) 
{ 
        new engine, lights, alarm, doors, bonnet, boot, objective;
        GetVehicleParamsEx(GetPlayerVehicleID(playerid), engine, lights, alarm, doors, bonnet, boot, objective);
        if(!engine) 
        {
        TimerToVehicleParams[playerid] = SetTimerEx("ParamsVehicle", 3000, 0, "ii", playerid,1);
        SendClientMessage(playerid,-1,"On vehicle...");
        }
        else
        {
        TimerToVehicleParams[playerid] = SetTimerEx("ParamsVehicle", 3000, 0, "ii", playerid,2);
        SendClientMessage(playerid,-1,"Off vehicle...");
        }
        return 1; 
} 
if ((newkeys & 4) && (IsPlayerInAnyVehicle(playerid))) 
{ 
        new engine, lights, alarm, doors, bonnet, boot, objective;
        GetVehicleParamsEx(GetPlayerVehicleID(playerid), engine, lights, alarm, doors, bonnet, boot, objective);
        if(!lights)
        {
              GetVehicleParamsEx(GetPlayerVehicleID(playerid), engine, lights, alarm, doors, bonnet, boot, objective);
              SetVehicleParamsEx(GetPlayerVehicleID(playerid), engine, VEHICLE_PARAMS_ON, alarm, doors, bonnet, boot, objective);
        }
        else
        {
              GetVehicleParamsEx(GetPlayerVehicleID(playerid), engine, lights, alarm, doors, bonnet, boot, objective);
              SetVehicleParamsEx(GetPlayerVehicleID(playerid), engine, VEHICLE_PARAMS_OFF, alarm, doors, bonnet, boot, objective);
        }
        return 1; 
} 
return 1; 
}
}
now in OnPlayerStateChange:
Code:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if(oldstate == PLAYER_STATE_DRIVER && newstate == PLAYER_STATE_ONFOOT) 
    {
    KillTimer(TimerToVehicleParams[playerid]);
    }
    return 1;
}
now abajo:
Code:
forward ParamsVehicle(playerid,type);
public ParamsVehicle(playerid,type)
{
if(type == 1)
{
new engine, lights, alarm, doors, bonnet, boot, objective;
GetVehicleParamsEx(GetPlayerVehicleID(playerid), engine, lights, alarm, doors, bonnet, boot, objective);
SetVehicleParamsEx(GetPlayerVehicleID(playerid), VEHICLE_PARAMS_ON, lights, alarm, doors, bonnet, boot, objective);
}
else if(type == 2)
{
new engine, lights, alarm, doors, bonnet, boot, objective;
GetVehicleParamsEx(GetPlayerVehicleID(playerid), engine, lights, alarm, doors, bonnet, boot, objective);
SetVehicleParamsEx(GetPlayerVehicleID(playerid), VEHICLE_PARAMS_OFF, lights, alarm, doors, bonnet, boot, objective);
}
return 1;
}
adri1 is offline   Reply With Quote
Old 02/12/2012, 08:46 PM   #8
Fire_Hell
Big Clucker
 
Join Date: Oct 2011
Posts: 103
Reputation: 0
Default Re: Tecla pressionada

adri1 não é isto.

Bom, olha o que eu tentei.

PHP Code:
    if (PRESSED(newkeys 4) && (IsPlayerInAnyVehicle(playerid)))
    {
        
OnPlayerCommandText(playerid"/farol");
        return 
1;
    }
    return 
1
Olha o erro que da.

PHP Code:
error 017undefined symbol "PRESSED" 
__________________
_ _ _ _ _ _ _ _ _ _|INICIANTE EM PAWNO|_ _ _ _ _ _ _ _ _ _ _

Ajudei? Da um agradecer, não cai o dedo!
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
Fire_Hell is offline   Reply With Quote
Old 02/12/2012, 08:49 PM   #9
adri1
Banned
 
Join Date: Oct 2010
Posts: 1,779
Reputation: 965
Default Respuesta: Re: Tecla pressionada

Quote:
Originally Posted by Fire_Hell View Post

PHP Code:
error 017undefined symbol "PRESSED" 
On top:
PHP Code:
#define PRESSED(%0) \
    
(((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0))) 
adri1 is offline   Reply With Quote
Old 02/12/2012, 08:54 PM   #10
Fire_Hell
Big Clucker
 
Join Date: Oct 2011
Posts: 103
Reputation: 0
Default Re: Tecla pressionada

Não funciono...
__________________
_ _ _ _ _ _ _ _ _ _|INICIANTE EM PAWNO|_ _ _ _ _ _ _ _ _ _ _

Ajudei? Da um agradecer, não cai o dedo!
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
Fire_Hell 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] Comando / Tecla GuiihCamargo Português/Portuguese 3 11/11/2012 11:40 PM
[Ajuda] Qual a tecla... josias_mhl Português/Portuguese 3 18/09/2012 03:03 PM
[ajuda] CMD em tecla F Saw_BR Português/Portuguese 2 04/03/2012 10:51 PM
[DUV] Trocar um cmd por uma tecla benyskate Português/Portuguese 8 05/02/2010 05:37 PM


All times are GMT. The time now is 04:01 AM.


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