cуdigo n funciona -
dimy - 29.09.2018
Code:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if(newkeys == 65536 && GetPlayerState(playerid) == PLAYER_STATE_DRIVER) // Y
{
GetVehicleParamsEx(id, engine, lights, alarm, doors, bonnet, boot, objective);
if(boot == VEHICLE_PARAMS_OFF || boot == VEHICLE_PARAMS_UNSET) {
SetVehicleParamsEx(id, engine, lights, alarm, doors, bonnet, VEHICLE_PARAMS_ON, objective);
SendClientMessage(playerid, Branco, "Vocк abriu a mala do carro !");
}
else
{
SetVehicleParamsEx(id, engine, lights, alarm, doors, bonnet, VEHICLE_PARAMS_OFF, objective);
SendClientMessage(playerid, Cinza, "Vocк fechou a mala do carro !");
}
}
}
new t[80];
format(t, sizeof(t)," Tecla: %d", newkeys);
SendClientMessage(playerid, -1, t);
return true;
}
Fiz esse cуdigo pra abrir a mala do carro apertando Y mais n funciona.
@edit
Re: cуdigo n funciona -
GSantana - 29.09.2018
poderia me dizer aonde vocк pega o id do carro e insere na variavel "id" que estб usando para identificar o carro ?, creio que seu erro estб ai
Re: cуdigo n funciona -
Ermanhaut - 29.09.2018
Tente trocar
Code:
if(newkeys == 65536 && GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
Por:
Code:
if(newkeys & KEY_YES && GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
Re: cуdigo n funciona -
dimy - 29.09.2018
й uma variбvel global e eu to usando new id = GetPlayerVehicleID(playerid); dentro da public do KeyStage
Re: cуdigo n funciona -
dimy - 29.09.2018
Code:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
new id = GetPlayerVehicleID(playerid);
if(newkeys == 131072 && GetPlayerState(playerid) == PLAYER_STATE_DRIVER) // Verifica se o jogador pressionou o N
{
// A gente remove o IsPlayerAnyVehicle pois sempre que ele N espaзo irб aparecer a mensagem.
GetVehicleParamsEx(id, engine, lights, alarm, doors, bonnet, boot, objective);
if(engine == VEHICLE_PARAMS_OFF || engine == VEHICLE_PARAMS_UNSET) {
SetVehicleParamsEx(id, VEHICLE_PARAMS_ON, lights, alarm, doors, bonnet, boot, objective);
SendClientMessage(playerid, Branco, "Vocк ligou o seu veнculo!");
}
else
{
SetVehicleParamsEx(id, VEHICLE_PARAMS_OFF, lights, alarm, doors, bonnet, boot, objective);
SendClientMessage(playerid, Cinza, "Vocк desligou o seu veнculo!");
}
// ------------------------------------------------------------------------------- >>
// PRУXIMO ITEM
//------------------------------------------------------------------------------
if(newkeys & KEY_YES && GetPlayerState(playerid) == PLAYER_STATE_DRIVER) // Y
{
GetVehicleParamsEx(id, engine, lights, alarm, doors, bonnet, boot, objective);
if(boot == VEHICLE_PARAMS_OFF || boot == VEHICLE_PARAMS_UNSET) {
SetVehicleParamsEx(id, engine, lights, alarm, doors, bonnet, VEHICLE_PARAMS_ON, objective);
SendClientMessage(playerid, Branco, "Vocк abriu a mala do carro !");
}
else
{
SetVehicleParamsEx(id, engine, lights, alarm, doors, bonnet, VEHICLE_PARAMS_OFF, objective);
SendClientMessage(playerid, Cinza, "Vocк fechou a mala do carro !");
}
}
// ------------------------------------------------------------------------------- >>
// PRУXIMO ITEM
//------------------------------------------------------------------------------
}
/*
new t[80];
format(t, sizeof(t)," Tecla: %d", newkeys);
SendClientMessage(playerid, -1, t);
*/
return true;
}
public completa.
nгo ta funcionando
Ermanhaut
sinceramente pra mim ta tudo certo, o de desligar/ligar com N ta funcionando perfeitamente
serб que tem algo errado aqui
Code:
SetVehicleParamsEx(id, engine, lights, alarm, doors, bonnet, VEHICLE_PARAMS_ON, objective);
?
Re: cуdigo n funciona -
Ermanhaut - 29.09.2018
Code:
if(newkeys == 131072 && GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
Este mйtodo de verificar teclas й incorreto. Ao invйs de
== utilize &.
Para mais informaзхes, veja a pбgina da
Wiki
Eu arrumei seu cуdigo, veja se funciona:
Code:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
new id = GetPlayerVehicleID(playerid);
if(newkeys & KEY_NO && GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
GetVehicleParamsEx(id, engine, lights, alarm, doors, bonnet, boot, objective);
if(engine == VEHICLE_PARAMS_OFF || engine == VEHICLE_PARAMS_UNSET) {
SetVehicleParamsEx(id, VEHICLE_PARAMS_ON, lights, alarm, doors, bonnet, boot, objective);
SendClientMessage(playerid, Branco, "Vocк ligou o seu veнculo!");
}
else
{
SetVehicleParamsEx(id, VEHICLE_PARAMS_OFF, lights, alarm, doors, bonnet, boot, objective);
SendClientMessage(playerid, Cinza, "Vocк desligou o seu veнculo!");
}
}
if(newkeys & KEY_YES && GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
GetVehicleParamsEx(id, engine, lights, alarm, doors, bonnet, boot, objective);
if(boot == VEHICLE_PARAMS_OFF || boot == VEHICLE_PARAMS_UNSET) {
SetVehicleParamsEx(id, engine, lights, alarm, doors, bonnet, VEHICLE_PARAMS_ON, objective);
SendClientMessage(playerid, Branco, "Vocк abriu a mala do carro !");
}
else
{
SetVehicleParamsEx(id, engine, lights, alarm, doors, bonnet, VEHICLE_PARAMS_OFF, objective);
SendClientMessage(playerid, Cinza, "Vocк fechou a mala do carro !");
}
}
/*
new t[80];
format(t, sizeof(t)," Tecla: %d", newkeys);
SendClientMessage(playerid, -1, t);
*/
return true;
}
Re: cуdigo n funciona -
dimy - 29.09.2018
@edit
funcionou aqui obrigado !
qual o parвmetro do farol ?
Re: cуdigo n funciona -
Ermanhaut - 29.09.2018
Quote:
Originally Posted by dimy
@edit
funcionou aqui obrigado !
qual o parвmetro do farol ?
|
lights
Re: cуdigo n funciona -
dimy - 29.09.2018
ok obrigado + REP