[Ajuda] KEY_YES
#1

Bom galera, o DiegoCosta estava me ajudando a arrumar o sistema de Ligar/Desligar o faro apertando a tecla Y, conseguimos concluir:
PHP код:
    if (newkeys KEY_YES)//Erro aki
    
{
        if(
IsPlayerInAnyVehicle(playerid))
        {
            if(
GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
            {
                new 
vehicleidenginelightsalarmdoorsbonnetbootobjective;
                
GetVehicleParamsEx(vehicleidenginelightsalarmdoorsbonnetbootobjective);
                if(
lights == 0)
                {
                
SetVehicleParamsEx(vehicleidengine0alarmdoorsbonnetbootobjective);
                }
                else
                {
                
SetVehicleParamsEx(vehicleidengine1alarmdoorsbonnetbootobjective);
                }
            }
            else
                
SendClientMessage(playerid0x00FF00FF"Voce nгo й o motorista do veнculo.");
        }
        else
            
SendClientMessage(playerid0x00FF00FF"Voce nгo estб em um veнculo");
    } 
Que por acaso estб a me ocasionar um erro:
PHP код:
Linha1181
Tipo
Erro 017
Explicaзгo
undefined symbol "KEY_YES" 
Bom, se alguem puder ajudar agradeзo.

Abraзos.
Reply
#2

Coloque na OnPlayerKeyStateChange

PHP код:
public OnPlayerKeyStateChange(playeridnewkeysoldkeys)
{
    if ((
newkeys KEY_YES) && !(oldkeys KEY_YES))
    {
        
        new 
vehicleidengine,lights,alarm,doors,bonnet,boot,objective;
        
vehicleid GetPlayerVehicleID(playerid);
        
GetVehicleParamsEx(vehicleidenginelightsalarmdoorsbonnetbootobjective);
        if (
vehicleid != 0)
        {
            
            if(
GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
            {
                if(
lights == 0)
                {
                    
                    
SetVehicleParamsEx(vehicleidengine1alarmdoorsbonnetbootobjective);
                }
                else
                
SetVehicleParamsEx(vehicleidengine0alarmdoorsbonnetbootobjective);
            }
        }
    }
return 
1;

Reply
#3

PHP код:
    new veiculoid GetPlayerVehicleID(playerid);
    new 
enginelightsalarmdoorsbonnetbootobjective;
    if ((
newkeys KEY_YES) && !(oldkeys KEY_YES) && GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
    {
            if (
IsPlayerInAnyVehicle(playerid))
            {
                if(
lights ==  VEHICLE_PARAMS_OFF)
                {
                    
SetVehicleParamsEx(veiculoidengineVEHICLE_PARAMS_ONfalsedoorsbonnetbootobjective);
                    
GameTextForPlayer(playerid"~w~farois ~b~~h~ligados~w~."10005);
                }
                else
                 if(
lights ==  VEHICLE_PARAMS_ON)
                {
                    
SetVehicleParamsEx(veiculoidengineVEHICLE_PARAMS_OFFfalsedoorsbonnetbootobjective);
                    
GameTextForPlayer(playerid"~w~farois ~r~desligados~w~."10005);
                }
            }
    } 
Reply
#4

Quote:
Originally Posted by LuisFerreira
Посмотреть сообщение
PHP код:
        if (IsPlayerConnected(playerid) && APlayerData[playerid][LoggedIn] == true
Apenas lembrando que: Se o GM nгo for baseado em PPC, nгo tiver sistema de login, ou se tiver mas o sistema for diferente, isso nгo vai funcionar.
Reply
#5

Ae й so trocar, exemplo:

PHP код:
PlayerInfo[playerid][Logado] == true
Reply
#6

Quote:
Originally Posted by LuisFerreira
Посмотреть сообщение
Ae й so trocar, exemplo:

PHP код:
PlayerInfo[playerid][Logado] == true
Sim, sу nгo entendi o pq de verificar isso, se jб й pressuposto que pra ele usar o comando ele deverб estar em um veiculo, e ele nгo estarб em um veiculo se nгo estiver conectado e logado...
Reply
#7

Bom й so retirar, refiz o que ele mandou rapidim, @EDIT.
Reply
#8

Quote:
Originally Posted by DiegoCosta
Посмотреть сообщение
Coloque na OnPlayerKeyStateChange

PHP код:
public OnPlayerKeyStateChange(playeridnewkeysoldkeys)
{
    if ((
newkeys KEY_YES) && !(oldkeys KEY_YES))
    {
        
        new 
vehicleidengine,lights,alarm,doors,bonnet,boot,objective;
        
vehicleid GetPlayerVehicleID(playerid);
        
GetVehicleParamsEx(vehicleidenginelightsalarmdoorsbonnetbootobjective);
        if (
vehicleid != 0)
        {
            
            if(
GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
            {
                if(
lights == 0)
                {
                    
                    
SetVehicleParamsEx(vehicleidengine1alarmdoorsbonnetbootobjective);
                }
                else
                
SetVehicleParamsEx(vehicleidengine0alarmdoorsbonnetbootobjective);
            }
        }
    }
return 
1;

Quote:
Originally Posted by LuisFerreira
Посмотреть сообщение
PHP код:
    new veiculoid GetPlayerVehicleID(playerid);
    new 
enginelightsalarmdoorsbonnetbootobjective;
    if ((
newkeys KEY_YES) && !(oldkeys KEY_YES) && GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
    {
            if (
IsPlayerInAnyVehicle(playerid))
            {
                if(
lights ==  VEHICLE_PARAMS_OFF)
                {
                    
SetVehicleParamsEx(veiculoidengineVEHICLE_PARAMS_ONfalsedoorsbonnetbootobjective);
                    
GameTextForPlayer(playerid"~w~farois ~b~~h~ligados~w~."10005);
                }
                else
                 if(
lights ==  VEHICLE_PARAMS_ON)
                {
                    
SetVehicleParamsEx(veiculoidengineVEHICLE_PARAMS_OFFfalsedoorsbonnetbootobjective);
                    
GameTextForPlayer(playerid"~w~farois ~r~desligados~w~."10005);
                }
            }
    } 
Qual foi a utilidade disso? Vocкs nгo resolveram o erro dele...o que diz й que nгo esta definido KEY_YES...


Topo do GM:
pawn Код:
#if defined KEY_YES
    #undef
#endif
#define KEY_YES (65536)
E acho estranho isto, pois jб esta definido em a_samp.inc
Reply
#9

Pois bem, em meu GM ainda continua o erro, testei todos os que vocкs postaram.
Erro:
PHP код:
H:\CargaPesada\gamemodes\PT_CP.pwn(1183) : error 017undefined symbol "KEY_YES" 
Alguem Sabe porque?

Abraзos.

@Edit:
Estava Postando Quando O Amigo Postou:
PHP код:
#if defined KEY_YES
    #undef
#endif
#define KEY_YES 65536 
Vou Tentar. Aguarde...

@EDIT2: Bom, retirou o erro, porem o codigo ainda nгo esta a funcionar completamente, ele Nгo desliga os farois, vou tentar edita-lo, Grato!

Abraзos Dnv!
Reply
#10

Quote:
Originally Posted by matheusspohr
Посмотреть сообщение
Pois bem, em meu GM ainda continua o erro, testei todos os que vocкs postaram.
Erro:
PHP код:
H:\CargaPesada\gamemodes\PT_CP.pwn(1183) : error 017undefined symbol "KEY_YES" 
Alguem Sabe porque?

Abraзos.
Veja o que postei acima...
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)