[Ajuda] Tecla pressionada
#7

Quote:
Originally Posted by Fire_Hell
Посмотреть сообщение
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:
Код:
new TimerToVehicleParams[MAX_PLAYER];
in OnPlayerKeyStateChange:
Код:
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:
Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if(oldstate == PLAYER_STATE_DRIVER && newstate == PLAYER_STATE_ONFOOT) 
    {
    KillTimer(TimerToVehicleParams[playerid]);
    }
    return 1;
}
now abajo:
Код:
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;
}
Reply


Messages In This Thread
Tecla pressionada - by Fire_Hell - 02.12.2012, 19:31
Re: Tecla pressionada - by lucas_mdr1235 - 02.12.2012, 19:37
Re: Tecla pressionada - by Fire_Hell - 02.12.2012, 19:48
Respuesta: Tecla pressionada - by adri1 - 02.12.2012, 20:07
Re: Tecla pressionada - by Fire_Hell - 02.12.2012, 20:17
Re: Tecla pressionada - by BreakDriFT - 02.12.2012, 20:30
Respuesta: Re: Tecla pressionada - by adri1 - 02.12.2012, 20:35
Re: Tecla pressionada - by Fire_Hell - 02.12.2012, 20:46
Respuesta: Re: Tecla pressionada - by adri1 - 02.12.2012, 20:49
Re: Tecla pressionada - by Fire_Hell - 02.12.2012, 20:54

Forum Jump:


Users browsing this thread: 1 Guest(s)