[Error] Funciуn ManualVehicleEngineAndLights
#7

pawn Код:
new bool:MotorAuto[MAX_VEHICLES];
static bool:param[MAX_VEHICLES][7];
/*
    param[vehicleid][0] = enginem
    param[vehicleid][1] = lights
    param[vehicleid][2] = alarm
    param[vehicleid][3] = doors
    param[vehicleid][4] = bonnet
    param[vehicleid][5] = boot
    param[vehicleid][6] = objective
*/

new MatarTimer[MAX_PLAYERS][2];

public OnGamemodeInit() {
    ManualVehicleEngineAndLights();
    return true;
}
public OnPlayerStateChange(playerid, newstate, oldstate) {
    new vehicleid = GetPlayerVehicleID(playerid);
    switch(GetPlayerState(playerid)) {
        case PLAYER_STATE_DRIVER: {
            switch(MotorAuto[vehicleid]) {
                case false: {
                    SendClientMessage(playerid,-1,"VEHICULO: El motor se encuentra apagado");
                }
                case true: {
                    SendClientMessage(playerid,-1,"VEHICULO: El motor se encuentra encendido");
                }
            }
        }
        case PLAYER_STATE_ONFOOT, PLAYER_STATE_PASSENGER: {
            KillTimer(MatarTimer[playerid][0]);
            KillTimer(MatarTimer[playerid][1]);
        }
    }
    return true;
}
public OnVehicleSpawn(vehicleid) {
    param[vehicleid][0] = false;
    GetVehicleParamsEx(vehicleid,param[vehicleid][0], param[vehicleid][1], param[vehicleid][2], param[vehicleid][3], param[vehicleid][4], param[vehicleid][5], param[vehicleid][6]);
    SetVehicleParamsEx(vehicleid,param[vehicleid][0], param[vehicleid][1], param[vehicleid][2], param[vehicleid][3], param[vehicleid][4], param[vehicleid][5], param[vehicleid][6]);
    MotorAuto[vehicleid] = false;
    return true;
}
public OnVehicleDeath(vehicleid, killerid) {
    param[vehicleid][0] = false;
    GetVehicleParamsEx(vehicleid,param[vehicleid][0], param[vehicleid][1], param[vehicleid][2], param[vehicleid][3], param[vehicleid][4], param[vehicleid][5], param[vehicleid][6]);
    SetVehicleParamsEx(vehicleid,param[vehicleid][0], param[vehicleid][1], param[vehicleid][2], param[vehicleid][3], param[vehicleid][4], param[vehicleid][5], param[vehicleid][6]);
    MotorAuto[vehicleid] = false;
    KillTimer(MatarTimer[killerid][0]);
    KillTimer(MatarTimer[killerid][1]);
    return true;
}
forward EncendidoDelMotor(playerid, vehicleid);
public EncendidoDelMotor(playerid, vehicleid) {
    if(IsPlayerConnected(playerid) && IsPlayerInAnyVehicle(playerid)) {
        param[vehicleid][0] = true;
        GetVehicleParamsEx(vehicleid,param[vehicleid][0], param[vehicleid][1], param[vehicleid][2], param[vehicleid][3], param[vehicleid][4], param[vehicleid][5], param[vehicleid][6]);
        SetVehicleParamsEx(vehicleid,param[vehicleid][0], param[vehicleid][1], param[vehicleid][2], param[vehicleid][3], param[vehicleid][4], param[vehicleid][5], param[vehicleid][6]);
        MotorAuto[vehicleid] = true;
        GameTextForPlayer(playerid, "~w~Motor ~g~Encendido",1000,3);
        KillTimer(MatarTimer[playerid][0]);
    }
    return true;
}
forward ApagadoDelMotor(playerid, vehicleid);
public ApagadoDelMotor(playerid, vehicleid) {
    if(IsPlayerConnected(playerid) && IsPlayerInAnyVehicle(playerid)) {
        param[vehicleid][0] = false;
        GetVehicleParamsEx(vehicleid,param[vehicleid][0], param[vehicleid][1], param[vehicleid][2], param[vehicleid][3], param[vehicleid][4], param[vehicleid][5], param[vehicleid][6]);
        SetVehicleParamsEx(vehicleid,param[vehicleid][0], param[vehicleid][1], param[vehicleid][2], param[vehicleid][3], param[vehicleid][4], param[vehicleid][5], param[vehicleid][6]);
        MotorAuto[vehicleid] = false;
        GameTextForPlayer(playerid, "~w~Motor ~r~Apagado",1000,3);
        KillTimer(MatarTimer[playerid][1]);
    }
    return true;
}
COMMAND:crearcoche(playerid, params[]) {
    new Float:pos[3], string[128], vehiculoid;
    if(JugadorInfo[playerid][jAdmin] >= 1) return SendClientMessage(playerid, -1, "No Eres administrador");
    if(sscanf(params, "d", params[0])) return SendClientMessage(playerid, -1, "USO: /crearcoche [ID]");
    if(params[0] < 400 || params[0] > 611) return SendClientMessage(playerid, -1, "Las IDS son entre 400 y 611.");
    if(CarCount < MAX_VEHICLES) return SendClientMessage(playerid, -1, "Despawnea los actuales spawneados antes de crear otro.");
    GetPlayerPos(playerid, pos[0], pos[1], pos[2]);
    vehiculoid = CreateVehicle(params[0], pos[0], pos[1], pos[2], 90, -1, -1, -1);
    format(string, sizeof(string), "Has spawneado un auto id %d. Si quieres guardarlo usa: /guardarcoche.", params[0]);
    SendClientMessage(playerid, -1, string);
    AdminSpawned[SpawnedVehicles] = vehiculoid;
    SpawnedVehicles++;
    LinkVehicleToInterior(vehiculoid, GetPlayerInterior(playerid));
    SetVehicleVirtualWorld(vehiculoid, GetPlayerVirtualWorld(playerid));
    return true;
}

/*
MatarTimer[playerid][0] = SetTimerEx("EncendidoDelMotor", 1000, true, "ii", playerid, vehicleid);
MatarTimer[playerid][1] = SetTimerEx("ApagadoDelMotor", 1000, true, "ii", playerid, vehicleid);
*/
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 2 Guest(s)