public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if(IsPlayerInAnyVehicle(playerid))
{
new cont,
engine, lights, alarm, doors, bonnet, boot, objective,
vehicleid = GetPlayerVehicleID(playerid);
if(newkeys == 65536)
{
if(cont == 0)
{
GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
SetVehicleParamsEx(vehicleid, true, lights, alarm, doors, bonnet, boot, objective);
cont = 1;
}
}
else if(newkeys == 65536)
{
if(cont == 1)
{
GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
SetVehicleParamsEx(vehicleid, false, lights, alarm, doors, bonnet, boot, objective);
cont = 0;
}
}
}
return 1;
}
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if(IsPlayerInAnyVehicle(playerid))
{
new cont,
engine, lights, alarm, doors, bonnet, boot, objective,
vehicleid = GetPlayerVehicleID(playerid);
if(newkeys == 65536)
{
if(cont == 0)
{
GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
SetVehicleParamsEx(vehicleid, true, lights, alarm, doors, bonnet, boot, objective);
cont = 1;
}
else {
GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
SetVehicleParamsEx(vehicleid, false, lights, alarm, doors, bonnet, boot, objective);
cont = 0;
}
}
}
return 1;
}
new cont[MAX_VEHICLES];
if(!cont) {
// your code
}
// your other code
if(newkeys == X){
// your code
}
else if(newkeys == X){
// your code
}
if(newkeys == X){
if(!cont) {
// your code
}
// your other code
}
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if(IsPlayerInAnyVehicle(playerid))
{
new bool:cont,
engine, lights, alarm, doors, bonnet, boot, objective,
vehicleid = GetPlayerVehicleID(playerid);
if(newkeys == 65536)
{
if(!cont)
{
GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
SetVehicleParamsEx(vehicleid, true, lights, alarm, doors, bonnet, boot, objective);
SendClientMessage(playerid, -1, #Motor ligado);
cont = true;
if(cont)
{
GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
SetVehicleParamsEx(vehicleid, false, lights, alarm, doors, bonnet, boot, objective);
SendClientMessage(playerid, -1, #Motor desligado);
cont = false;
}
}
}
}
return 1;
}
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if(IsPlayerInAnyVehicle(playerid))
{
new cont[MAX_VEHICLES],
engine, lights, alarm, doors, bonnet, boot, objective,
vehicleid = GetPlayerVehicleID(playerid);
if(newkeys == 65536)
{
if(cont[vehicleid] == 0)
{
GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
SetVehicleParamsEx(vehicleid, true, lights, alarm, doors, bonnet, boot, objective);
SendClientMessage(playerid, -1, #Motor ligado);
cont[vehicleid] = 1;
}
else if(cont[vehicleid] == 1)
{
GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
SetVehicleParamsEx(vehicleid, false, lights, alarm, doors, bonnet, boot, objective);
SendClientMessage(playerid, -1, #Motor desligado);
cont[vehicleid] = 0;
}
}
}
return 1;
}
#include <a_samp> new motor[MAX_PLAYERS], farol[MAX_PLAYERS]; public OnGameModeInit() { ManualVehicleEngineAndLights(); return 1; } public OnPlayerKeyStateChange(playerid, newkeys, oldkeys) { if(IsPlayerInAnyVehicle(playerid) && newkeys == 1) { if(motor[playerid] == 0) { new car = GetPlayerVehicleID(playerid), wi, ll, ia, n, dlc, dmais, he; GetVehicleParamsEx(car, wi, ll, ia, n, dlc, dmais, he); SetVehicleParamsEx(car, VEHICLE_PARAMS_ON, ll, ia, n, dlc, dmais, he); motor[playerid] = 1; SendClientMessage(playerid, -1, "Motor ligado."); return 1; } else if(motor[playerid] == 1) { new car = GetPlayerVehicleID(playerid), wi, ll, ia, n, dlc, dmais, he; GetVehicleParamsEx(car, wi, ll, ia, n, dlc, dmais, he); SetVehicleParamsEx(car, VEHICLE_PARAMS_OFF, ll, ia, n, dlc, dmais, he); motor[playerid] = 0; SendClientMessage(playerid,-1, "Motor desligado."); return 1; } return 1; } if(IsPlayerInAnyVehicle(playerid) && newkeys == 2) { if(farol[playerid] == 0) { new car = GetPlayerVehicleID(playerid), wi, ll, ia, n, dlc, dmais, he; GetVehicleParamsEx(car, wi, ll, ia, n, dlc, dmais, he); SetVehicleParamsEx(car, wi, VEHICLE_PARAMS_ON, ia, n, dlc, dmais, he); farol[playerid] = 1; SendClientMessage(playerid, -1, "Farol ligado."); return 1; } else if(farol[playerid] == 1) { new car = GetPlayerVehicleID(playerid), wi, ll, ia, n, dlc, dmais, he; GetVehicleParamsEx(car, wi, ll, ia, n, dlc, dmais, he); SetVehicleParamsEx(car, wi, VEHICLE_PARAMS_OFF, ia, n, dlc, dmais, he); farol[playerid] = 0; SendClientMessage(playerid, -1, "Farol desligado."); return 1; } return 1; } return 1; }
// topo do GM/Abaixo das Includes
new cont[MAX_VEHICLES],
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if(IsPlayerInAnyVehicle(playerid))
{
new engine, lights, alarm, doors, bonnet, boot, objective,
vehicleid = GetPlayerVehicleID(playerid);
if(newkeys == 65536)
{
if(cont[vehicleid] == 0)
{
GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
SetVehicleParamsEx(vehicleid, true, lights, alarm, doors, bonnet, boot, objective);
SendClientMessage(playerid, -1, #Motor ligado);
cont[vehicleid] = 1;
}
else if(cont[vehicleid] == 1)
{
GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
SetVehicleParamsEx(vehicleid, false, lights, alarm, doors, bonnet, boot, objective);
SendClientMessage(playerid, -1, #Motor desligado);
cont[vehicleid] = 0;
}
}
}
return 1;
}
iCasTiel
Funcionou mano. Valeu. + REP AssasinoLM essa Key 2 й que tecla ? |