[Ajuda] Sistema de ligar e desligar veiculos nao funfa
#1

Tipo eu digito o comando e sу fala Veiculo ligado com sucesso ele nao desliga
pawn Код:
if (strcmp("/motor", cmdtext, true, 10) == 0)
{
    new carro = GetPlayerVehicleID(playerid);
    if(carro != INVALID_VEHICLE_ID)
    {
        if(Engine[playerid] == 0)
        {
            new Vehicle = GetPlayerVehicleID(playerid), engine, lights, alarm, doors, bonnet, boot, objective;
            GetVehicleParamsEx(Vehicle, engine, lights, alarm, doors, bonnet, boot, objective);
            Engine[Vehicle] = 1, SetVehicleParamsEx(Vehicle, 1, lights, alarm, doors, bonnet, boot, objective);
            SendClientMessage(playerid, COLOR_GREEN, "Veiculo ligado com sucesso.");
           }
        else if(Engine[playerid] == 1)
          {
            new Vehicle = GetPlayerVehicleID(playerid), engine, lights, alarm, doors, bonnet, boot, objective;
            GetVehicleParamsEx(Vehicle, engine, lights, alarm, doors, bonnet, boot, objective);
            SendClientMessage(playerid, COLOR_GREEN, "Motor desligado com sucesso.");
            Engine[Vehicle] = 0, SetVehicleParamsEx(Vehicle, 0, lights, alarm, doors, bonnet, boot, objective);
        }
    }
}
Reply
#2

pawn Код:
if (strcmp("/motor", cmdtext, true, 10) == 0)
{
    new vehicleid = GetPlayerVehicleID(playerid);
    if(vehicleid)
    {
        if(Engine[playerid] == 0)
        {
            vehicleid = GetPlayerVehicleID(playerid), engine, lights, alarm, doors, bonnet, boot, objective;
            GetVehicleParamsEx(Vehicle, engine, lights, alarm, doors, bonnet, boot, objective);
            Engine[Vehicle] = 1, SetVehicleParamsEx(Vehicle, 1, lights, alarm, doors, bonnet, boot, objective);
            SendClientMessage(playerid, COLOR_GREEN, "Veiculo ligado com sucesso.");
        }
        else if(Engine[playerid] == 1)
        {
            vehicleid = GetPlayerVehicleID(playerid), engine, lights, alarm, doors, bonnet, boot, objective;
            GetVehicleParamsEx(Vehicle, engine, lights, alarm, doors, bonnet, boot, objective);
            SendClientMessage(playerid, COLOR_GREEN, "Motor desligado com sucesso.");
            Engine[Vehicle] = 0, SetVehicleParamsEx(Vehicle, 0, lights, alarm, doors, bonnet, boot, objective);
        }
    }
}
Reply
#3

Quote:
Originally Posted by chelsao
Посмотреть сообщение
pawn Код:
if (strcmp("/motor", cmdtext, true, 10) == 0)
{
    new vehicleid = GetPlayerVehicleID(playerid);
    if(vehicleid)
    {
        if(Engine[playerid] == 0)
        {
            vehicleid = GetPlayerVehicleID(playerid), engine, lights, alarm, doors, bonnet, boot, objective;
            GetVehicleParamsEx(Vehicle, engine, lights, alarm, doors, bonnet, boot, objective);
            Engine[Vehicle] = 1, SetVehicleParamsEx(Vehicle, 1, lights, alarm, doors, bonnet, boot, objective);
            SendClientMessage(playerid, COLOR_GREEN, "Veiculo ligado com sucesso.");
        }
        else if(Engine[playerid] == 1)
        {
            vehicleid = GetPlayerVehicleID(playerid), engine, lights, alarm, doors, bonnet, boot, objective;
            GetVehicleParamsEx(Vehicle, engine, lights, alarm, doors, bonnet, boot, objective);
            SendClientMessage(playerid, COLOR_GREEN, "Motor desligado com sucesso.");
            Engine[Vehicle] = 0, SetVehicleParamsEx(Vehicle, 0, lights, alarm, doors, bonnet, boot, objective);
        }
    }
}

muita gente nгo sabe mais eu repasso

pawn Код:
if (strcmp("/motor", cmdtext, true, 6 ) == 0) //quantos caracteres tem entre "" ? ae no caso sao 6 entгose coloca 6 aprendi isso usando dcmd
Reply
#4

Tentei das duas maneiras e nгo funcionou
Reply
#5

Deu esses erros
pawn Код:
(18114) : error 017: undefined symbol "engine"
(18114) : warning 215: expression has no effect
(18115) : error 017: undefined symbol "Vehicle"
(18116) : error 017: undefined symbol "Vehicle"
(18121) : error 017: undefined symbol "engine"
(18121) : warning 215: expression has no effect
(18122) : error 017: undefined symbol "Vehicle"
(18124) : error 017: undefined symbol "Vehicle"
Linhas
pawn Код:
vehicleid = GetPlayerVehicleID(playerid), engine, lights, alarm, doors, bonnet, boot, objective;
            GetVehicleParamsEx(Vehicle, engine, lights, alarm, doors, bonnet, boot, objective);
            Engine[Vehicle] = 1, SetVehicleParamsEx(Vehicle, 1, lights, alarm, doors, bonnet, boot, objective);
            vehicleid = GetPlayerVehicleID(playerid), engine, lights, alarm, doors, bonnet, boot, objective;
            GetVehicleParamsEx(Vehicle, engine, lights, alarm, doors, bonnet, boot, objective);
            Engine[Vehicle] = 0, SetVehicleParamsEx(Vehicle, 0, lights, alarm, doors, bonnet, boot, objective);
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)