[Pedido] Juntar meu /motoron e meu /motoroff em /motor
#1

Fala galera fiz dois comandos pra ligar o veiculo, funcionaram direito e tal, mas o problema й que fiz pra ligar por teclas do teclado, sу que com dois comandos fica muito ruim queria passar o /motoron e /motoroff pra apenas /motor, qnd tive-se desligado ligava e qnd tive-se ligado ligava, vlw!

Ou entгo me ajude explicando sou mt novato nessa area, mas to gostando!

Quote:

new motor[MAX_PLAYERS], luz[MAX_PLAYERS], alarme[MAX_PLAYERS], portas[MAX_PLAYERS], capo[MAX_PLAYERS], portamalas[MAX_PLAYERS], objetivo[MAX_PLAYERS];

Quote:

if (strcmp("/motoron", cmdtext, true, 10) == 0)
{
new mot, lu, alar, por, cap, porma, ob;
new carro = GetPlayerVehicleID(playerid);
if(carro != INVALID_VEHICLE_ID)
{
if(motor[playerid] == 0)
{
GetVehicleParamsEx(carro, mot, lu, alar, por, cap, porma, ob);
SetVehicleParamsEx(carro, VEHICLE_PARAMS_ON, lu, alar, por, cap, porma, ob);
motor[playerid] = 1;
format(string, sizeof(string), " %s estб ligando o veiculo.", PlayerName(playerid));
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPL E,COLOR_PURPLE);
SendClientMessage(playerid, 0xFFFFFFAA, "Veiculo {2F991A}Ligado!");
}
}
}
if (strcmp("/motoroff", cmdtext, true, 10) == 0)
{
new mot, lu, alar, por, cap, porma, ob;
new carro = GetPlayerVehicleID(playerid);
if(carro != INVALID_VEHICLE_ID)
{
if(motor[playerid] == 1)
{
GetVehicleParamsEx(carro, mot, lu, alar, por, cap, porma, ob);
SetVehicleParamsEx(carro, VEHICLE_PARAMS_OFF, lu, alar, por, cap, porma, ob);
motor[playerid] = 0;
format(string, sizeof(string), " %s estб desligando o veiculo.", PlayerName(playerid));
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPL E,COLOR_PURPLE);
SendClientMessage(playerid, 0xFFFFFFAA, "Veiculo {E31919}Desligado!");
}
}
}

Reply
#2

pawn Код:
if (strcmp("/motor", cmdtext, true, 10) == 0)
{
    new mot, lu, alar, por, cap, porma, ob, carro = GetPlayerVehicleID(playerid);
    if(carro != INVALID_VEHICLE_ID)
    {
        if(motor[playerid] == 0)
        {
            GetVehicleParamsEx(carro, mot, lu, alar, por, cap, porma, ob);
            SetVehicleParamsEx(carro, VEHICLE_PARAMS_ON, lu, alar, por, cap, porma, ob);
            motor[playerid] = 1;
            format(string, sizeof(string), " %s estб ligando o veiculo.", PlayerName(playerid));
            ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPL E,COLOR_PURPLE);
            SendClientMessage(playerid, 0xFFFFFFAA, "Veiculo {2F991A}Ligado!");
            return 1;
        }
        if(motor[playerid] == 1)
        {
            GetVehicleParamsEx(carro, mot, lu, alar, por, cap, porma, ob);
            SetVehicleParamsEx(carro, VEHICLE_PARAMS_OFF, lu, alar, por, cap, porma, ob);
            motor[playerid] = 0;
            format(string, sizeof(string), " %s estб desligando o veiculo.", PlayerName(playerid));
            ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPL E,COLOR_PURPLE);
            SendClientMessage(playerid, 0xFFFFFFAA, "Veiculo {E31919}Desligado!");
        }
    }
    return 1;
}
simples
Reply
#3

Valeu funcionou!
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)