/flash bugs someone know how to fix?
#1

Hello,

I made a flash command that the light starts flicking and that the Police Light comes one the roof, so you can drive in Code2.

But only the lights start flicking and the police lights don't come on the roof.
Anyone can look at it and give me a solution?

pawn Код:
command(flash, playerid, params[])
{
    new vehicleid,panels,doors,lights,tires;
    if(Groups[Player[playerid][Group]][CommandTypes] == 1)
    if (GetPlayerState(playerid) != PLAYER_STATE_DRIVER)
    {
    return SendClientMessage(playerid, -1, "* You are not the driver!");
    }
    new pveh = GetPlayerVehicleID(playerid);
    if (!GetVehicleModel(pveh)) return SendClientMessage(playerid, -1, "* You are not in a vehicle!");
    switch (GetVehicleModel(pveh))
    {
    case 596:
    {
        obj[pveh] = CreateObject(18646, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
        obj2[pveh] = CreateObject(18646, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
        AttachObjectToVehicle(obj[pveh], pveh, 0.599999,-0.375000,0.899999,0.000000,0.000000,0.000000);
        AttachObjectToVehicle(obj2[pveh], pveh, -0.599999,-0.375000,0.899999,0.000000,0.000000,0.000000);
        vehicleid = GetPlayerVehicleID(playerid);
        GetVehicleDamageStatus(vehicleid,panels,doors,lights,tires);
        Flasher[vehicleid] = 1;
    }
    case 597:
    {
        obj[pveh] = CreateObject(18646, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
        obj2[pveh] = CreateObject(18646, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
        AttachObjectToVehicle(obj[pveh], pveh, 0.599999,-0.375000,0.899999,0.000000,0.000000,0.000000);
        AttachObjectToVehicle(obj2[pveh], pveh, -0.599999,-0.375000,0.899999,0.000000,0.000000,0.000000);
        vehicleid = GetPlayerVehicleID(playerid);
        GetVehicleDamageStatus(vehicleid,panels,doors,lights,tires);
        Flasher[vehicleid] = 1;
    }
    case 598:
    {
        obj[pveh] = CreateObject(18646, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
        obj2[pveh] = CreateObject(18646, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
        AttachObjectToVehicle(obj[pveh], pveh, 0.524999, -0.300000, 0.899999, 0.000000, 0.000000, 0.000000);
        AttachObjectToVehicle(obj2[pveh], pveh, -0.524999, -0.300000, 0.899999, 0.000000, 0.000000, 0.000000);
        vehicleid = GetPlayerVehicleID(playerid);
        GetVehicleDamageStatus(vehicleid,panels,doors,lights,tires);
        Flasher[vehicleid] = 1;
    }
    case 599:
    {
        obj[pveh] = CreateObject(18646, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
        obj2[pveh] = CreateObject(18646, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
        AttachObjectToVehicle(obj[pveh], pveh, 0.524999,0.000000,1.125000,0.000000,0.000000,0.000000);
        AttachObjectToVehicle(obj2[pveh], pveh, -0.524999,0.000000,1.125000,0.000000,0.000000,0.000000);
        vehicleid = GetPlayerVehicleID(playerid);
        GetVehicleDamageStatus(vehicleid,panels,doors,lights,tires);
        Flasher[vehicleid] = 1;
    }
    case 541://bullet
    {
        obj[pveh] = CreateObject(18646, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
        AttachObjectToVehicle(obj[pveh], pveh, 0.375000,0.524999,0.375000,0.000000,0.000000,0.000000);
        vehicleid = GetPlayerVehicleID(playerid);
        GetVehicleDamageStatus(vehicleid,panels,doors,lights,tires);
        Flasher[vehicleid] = 1;
    }
    case 426://premier
    {
        obj[pveh] = CreateObject(18646, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
        AttachObjectToVehicle(obj[pveh], pveh, 0.524999,0.749999,0.375000,0.000000,0.000000,0.000000);
        vehicleid = GetPlayerVehicleID(playerid);
        GetVehicleDamageStatus(vehicleid,panels,doors,lights,tires);
        Flasher[vehicleid] = 1;
    }
    case 427://enforcer
    {
        vehicleid = GetPlayerVehicleID(playerid);
        GetVehicleDamageStatus(vehicleid,panels,doors,lights,tires);
        Flasher[vehicleid] = 1;
    }
    case 560://sultan
    {
        obj[pveh] = CreateObject(18646, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
        AttachObjectToVehicle(obj[pveh], pveh, 0.225000,0.750000,0.449999,0.000000,0.000000,0.000000);
        vehicleid = GetPlayerVehicleID(playerid);
        GetVehicleDamageStatus(vehicleid,panels,doors,lights,tires);
        Flasher[vehicleid] = 1;
    }
    case 490://FBI
    {
        obj[pveh] = CreateObject(18646, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
        AttachObjectToVehicle(obj[pveh], pveh, 0.000000,1.125000,0.599999,0.000000,0.000000,0.000000);
        vehicleid = GetPlayerVehicleID(playerid);
        GetVehicleDamageStatus(vehicleid,panels,doors,lights,tires);
        Flasher[vehicleid] = 1;
    }
    default:
    {
        return SendClientMessage(playerid, -1, "You are not in a CODE 2 compatible police vehicle!");
        }
    }
    return SendClientMessage(playerid, -1, "Lights on, you are now in a CODE 2 run!");
}
Reply
#2

Just dicovered, for some players it work for some not,
Even if I'm in LSPD, it only puts on the flash lights but not the police lights (strobes)
And for other LSPD members it works....
Reply
#3

Anyone?
Reply
#4

Isnt Case 1 Case 2 Case 3 Right?
Reply
#5

Case 598: is for the LVPD car etc. or is there a better way to do that?
Reply
#6

Anyone common??
Reply
#7

pawn Код:
case 1:
 if (GetPlayerVehicleId(playerid) == 596)
    {
        obj[pveh] = CreateObject(18646, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
        obj2[pveh] = CreateObject(18646, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
        AttachObjectToVehicle(obj[pveh], pveh, 0.599999,-0.375000,0.899999,0.000000,0.000000,0.000000);
        AttachObjectToVehicle(obj2[pveh], pveh, -0.599999,-0.375000,0.899999,0.000000,0.000000,0.000000);
        vehicleid = GetPlayerVehicleID(playerid);
        GetVehicleDamageStatus(vehicleid,panels,doors,lights,tires);
        Flasher[vehicleid] = 1;
    }
Not sure but i think should be like that....Im not pro Im newbie too

Or
pawn Код:
if (GetPlayerVehicleId(playerid) == 596)
    {
        obj[pveh] = CreateObject(18646, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
        obj2[pveh] = CreateObject(18646, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
        AttachObjectToVehicle(obj[pveh], pveh, 0.599999,-0.375000,0.899999,0.000000,0.000000,0.000000);
        AttachObjectToVehicle(obj2[pveh], pveh, -0.599999,-0.375000,0.899999,0.000000,0.000000,0.000000);
        vehicleid = GetPlayerVehicleID(playerid);
        GetVehicleDamageStatus(vehicleid,panels,doors,lights,tires);
        Flasher[vehicleid] = 1;
    }
else if (GetPlayerVehicleId(playerid) == 555)
bla bla
Reply
#8

Lets hope it will work :P

pawn Код:
command(flash, playerid, params[])
{
    new vehicleid,panels,doors,lights,tires;
    if(Groups[Player[playerid][Group]][CommandTypes] == 1)
    if (GetPlayerState(playerid) != PLAYER_STATE_DRIVER)
    {
    return SendClientMessage(playerid, -1, "* You are not the driver!");
    }
    new pveh = GetPlayerVehicleID(playerid);
    if (!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, -1, "* You are not in a vehicle!");
    if(GetVehicleModel(pveh) == 596)
    {
        obj[pveh] = CreateObject(18646, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
        obj2[pveh] = CreateObject(18646, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
        AttachObjectToVehicle(obj[pveh], pveh, 0.599999,-0.375000,0.899999,0.000000,0.000000,0.000000);
        AttachObjectToVehicle(obj2[pveh], pveh, -0.599999,-0.375000,0.899999,0.000000,0.000000,0.000000);
        vehicleid = GetPlayerVehicleID(playerid);
        GetVehicleDamageStatus(vehicleid,panels,doors,lights,tires);
        Flasher[vehicleid] = 1;
        SCM(playerid, WHITE, "You are in a CODE 2");
    }
    else if(GetVehicleModel(pveh) == 597)
    {
        obj[pveh] = CreateObject(18646, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
        obj2[pveh] = CreateObject(18646, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
        AttachObjectToVehicle(obj[pveh], pveh, 0.599999,-0.375000,0.899999,0.000000,0.000000,0.000000);
        AttachObjectToVehicle(obj2[pveh], pveh, -0.599999,-0.375000,0.899999,0.000000,0.000000,0.000000);
        vehicleid = GetPlayerVehicleID(playerid);
        GetVehicleDamageStatus(vehicleid,panels,doors,lights,tires);
        Flasher[vehicleid] = 1;
        SCM(playerid, WHITE, "You are in a CODE 2");
    }
    else if(GetVehicleModel(pveh) == 598)
    {
        obj[pveh] = CreateObject(18646, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
        obj2[pveh] = CreateObject(18646, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
        AttachObjectToVehicle(obj[pveh], pveh, 0.524999, -0.300000, 0.899999, 0.000000, 0.000000, 0.000000);
        AttachObjectToVehicle(obj2[pveh], pveh, -0.524999, -0.300000, 0.899999, 0.000000, 0.000000, 0.000000);
        vehicleid = GetPlayerVehicleID(playerid);
        GetVehicleDamageStatus(vehicleid,panels,doors,lights,tires);
        Flasher[vehicleid] = 1;
        SCM(playerid, WHITE, "You are in a CODE 2");
    }
    else if(GetVehicleModel(pveh) == 599)
    {
        obj[pveh] = CreateObject(18646, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
        obj2[pveh] = CreateObject(18646, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
        AttachObjectToVehicle(obj[pveh], pveh, 0.524999,0.000000,1.125000,0.000000,0.000000,0.000000);
        AttachObjectToVehicle(obj2[pveh], pveh, -0.524999,0.000000,1.125000,0.000000,0.000000,0.000000);
        vehicleid = GetPlayerVehicleID(playerid);
        GetVehicleDamageStatus(vehicleid,panels,doors,lights,tires);
        Flasher[vehicleid] = 1;
        SCM(playerid, WHITE, "You are in a CODE 2");
    }
    else if(GetVehicleModel(pveh) == 541)
    {
        obj[pveh] = CreateObject(18646, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
        AttachObjectToVehicle(obj[pveh], pveh, 0.375000,0.524999,0.375000,0.000000,0.000000,0.000000);
        vehicleid = GetPlayerVehicleID(playerid);
        GetVehicleDamageStatus(vehicleid,panels,doors,lights,tires);
        Flasher[vehicleid] = 1;
        SCM(playerid, WHITE, "You are in a CODE 2");
    }
    else if(GetVehicleModel(pveh) == 426)
    {
        obj[pveh] = CreateObject(18646, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
        AttachObjectToVehicle(obj[pveh], pveh, 0.524999,0.749999,0.375000,0.000000,0.000000,0.000000);
        vehicleid = GetPlayerVehicleID(playerid);
        GetVehicleDamageStatus(vehicleid,panels,doors,lights,tires);
        Flasher[vehicleid] = 1;
        SCM(playerid, WHITE, "You are in a CODE 2");
    }
    else if(GetVehicleModel(pveh) == 427)
    {
        vehicleid = GetPlayerVehicleID(playerid);
        GetVehicleDamageStatus(vehicleid,panels,doors,lights,tires);
        Flasher[vehicleid] = 1;
        SCM(playerid, WHITE, "You are in a CODE 2");
    }
    else if(GetVehicleModel(pveh) == 560)
    {
        obj[pveh] = CreateObject(18646, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
        AttachObjectToVehicle(obj[pveh], pveh, 0.225000,0.750000,0.449999,0.000000,0.000000,0.000000);
        vehicleid = GetPlayerVehicleID(playerid);
        GetVehicleDamageStatus(vehicleid,panels,doors,lights,tires);
        Flasher[vehicleid] = 1;
        SCM(playerid, WHITE, "You are in a CODE 2");
    }
    else if(GetVehicleModel(pveh) == 490)
    {
        obj[pveh] = CreateObject(18646, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
        AttachObjectToVehicle(obj[pveh], pveh, 0.000000,1.125000,0.599999,0.000000,0.000000,0.000000);
        vehicleid = GetPlayerVehicleID(playerid);
        GetVehicleDamageStatus(vehicleid,panels,doors,lights,tires);
        Flasher[vehicleid] = 1;
        SCM(playerid, WHITE, "You are in a CODE 2");
    }
    else
    {
        SendClientMessage(playerid, -1, "You are not in a CODE 2 compatible police vehicle!");
    }
    return 1;
}
Reply
#9

Again not, oke here comes the whole code with all the things:

pawn Код:
new obj[MAX_VEHICLES] = { INVALID_OBJECT_ID, ... };
new obj2[MAX_VEHICLES] = { INVALID_OBJECT_ID, ... };
pawn Код:
public OnGameModeExit()
{

    for (new i = 0; i < MAX_VEHICLES; i++)
    {
        DestroyObject(obj[i]);
        DestroyObject(obj2[i]);
    }

    return 1;
}
pawn Код:
public OnVehicleSpawn(vehicleid)
{
    printf("[DEBUG] Vehicle %d has spawned!", vehicleid);
    DestroyObject(obj[vehicleid]);
    DestroyObject(obj2[vehicleid]);
    return 1;
}

public OnVehicleDeath(vehicleid, killerid)
{
    DestroyObject(obj[vehicleid]);
    DestroyObject(obj2[vehicleid]);
    return 1;
}
pawn Код:
command(flash, playerid, params[])
{
    new vehicleid,panels,doors,lights,tires;
    if(Groups[Player[playerid][Group]][CommandTypes] == 1)
    if (GetPlayerState(playerid) != PLAYER_STATE_DRIVER)
    {
    return SendClientMessage(playerid, -1, "* You are not the driver!");
    }
    new pveh = GetPlayerVehicleID(playerid);
    if (!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, -1, "* You are not in a vehicle!");
    if(GetVehicleModel(pveh) == 596)
    {
        obj[pveh] = CreateObject(18646, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
        obj2[pveh] = CreateObject(18646, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
        AttachObjectToVehicle(obj[pveh], pveh, 0.599999,-0.375000,0.899999,0.000000,0.000000,0.000000);
        AttachObjectToVehicle(obj2[pveh], pveh, -0.599999,-0.375000,0.899999,0.000000,0.000000,0.000000);
        vehicleid = GetPlayerVehicleID(playerid);
        GetVehicleDamageStatus(vehicleid,panels,doors,lights,tires);
        Flasher[vehicleid] = 1;
        SCM(playerid, WHITE, "You are in a CODE 2");
    }
    else if(GetVehicleModel(pveh) == 597)
    {
        obj[pveh] = CreateObject(18646, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
        obj2[pveh] = CreateObject(18646, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
        AttachObjectToVehicle(obj[pveh], pveh, 0.599999,-0.375000,0.899999,0.000000,0.000000,0.000000);
        AttachObjectToVehicle(obj2[pveh], pveh, -0.599999,-0.375000,0.899999,0.000000,0.000000,0.000000);
        vehicleid = GetPlayerVehicleID(playerid);
        GetVehicleDamageStatus(vehicleid,panels,doors,lights,tires);
        Flasher[vehicleid] = 1;
        SCM(playerid, WHITE, "You are in a CODE 2");
    }
    else if(GetVehicleModel(pveh) == 598)
    {
        obj[pveh] = CreateObject(18646, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
        obj2[pveh] = CreateObject(18646, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
        AttachObjectToVehicle(obj[pveh], pveh, 0.524999, -0.300000, 0.899999, 0.000000, 0.000000, 0.000000);
        AttachObjectToVehicle(obj2[pveh], pveh, -0.524999, -0.300000, 0.899999, 0.000000, 0.000000, 0.000000);
        vehicleid = GetPlayerVehicleID(playerid);
        GetVehicleDamageStatus(vehicleid,panels,doors,lights,tires);
        Flasher[vehicleid] = 1;
        SCM(playerid, WHITE, "You are in a CODE 2");
    }
    else if(GetVehicleModel(pveh) == 599)
    {
        obj[pveh] = CreateObject(18646, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
        obj2[pveh] = CreateObject(18646, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
        AttachObjectToVehicle(obj[pveh], pveh, 0.524999,0.000000,1.125000,0.000000,0.000000,0.000000);
        AttachObjectToVehicle(obj2[pveh], pveh, -0.524999,0.000000,1.125000,0.000000,0.000000,0.000000);
        vehicleid = GetPlayerVehicleID(playerid);
        GetVehicleDamageStatus(vehicleid,panels,doors,lights,tires);
        Flasher[vehicleid] = 1;
        SCM(playerid, WHITE, "You are in a CODE 2");
    }
    else if(GetVehicleModel(pveh) == 541)
    {
        obj[pveh] = CreateObject(18646, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
        AttachObjectToVehicle(obj[pveh], pveh, 0.375000,0.524999,0.375000,0.000000,0.000000,0.000000);
        vehicleid = GetPlayerVehicleID(playerid);
        GetVehicleDamageStatus(vehicleid,panels,doors,lights,tires);
        Flasher[vehicleid] = 1;
        SCM(playerid, WHITE, "You are in a CODE 2");
    }
    else if(GetVehicleModel(pveh) == 426)
    {
        obj[pveh] = CreateObject(18646, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
        AttachObjectToVehicle(obj[pveh], pveh, 0.524999,0.749999,0.375000,0.000000,0.000000,0.000000);
        vehicleid = GetPlayerVehicleID(playerid);
        GetVehicleDamageStatus(vehicleid,panels,doors,lights,tires);
        Flasher[vehicleid] = 1;
        SCM(playerid, WHITE, "You are in a CODE 2");
    }
    else if(GetVehicleModel(pveh) == 427)
    {
        vehicleid = GetPlayerVehicleID(playerid);
        GetVehicleDamageStatus(vehicleid,panels,doors,lights,tires);
        Flasher[vehicleid] = 1;
        SCM(playerid, WHITE, "You are in a CODE 2");
    }
    else if(GetVehicleModel(pveh) == 560)
    {
        obj[pveh] = CreateObject(18646, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
        AttachObjectToVehicle(obj[pveh], pveh, 0.225000,0.750000,0.449999,0.000000,0.000000,0.000000);
        vehicleid = GetPlayerVehicleID(playerid);
        GetVehicleDamageStatus(vehicleid,panels,doors,lights,tires);
        Flasher[vehicleid] = 1;
        SCM(playerid, WHITE, "You are in a CODE 2");
    }
    else if(GetVehicleModel(pveh) == 490)
    {
        obj[pveh] = CreateObject(18646, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
        AttachObjectToVehicle(obj[pveh], pveh, 0.000000,1.125000,0.599999,0.000000,0.000000,0.000000);
        vehicleid = GetPlayerVehicleID(playerid);
        GetVehicleDamageStatus(vehicleid,panels,doors,lights,tires);
        Flasher[vehicleid] = 1;
        SCM(playerid, WHITE, "You are in a CODE 2");
    }
    else
    {
        SendClientMessage(playerid, -1, "You are not in a CODE 2 compatible police vehicle!");
    }
    return 1;
}

command(flashoff, playerid, params[])
{
    new vehicleid,panels,doors,lights,tires;
    new pveh = GetPlayerVehicleID(playerid);
    if(Groups[Player[playerid][Group]][CommandTypes] == 1)
    {
        if (IsValidObject(obj[pveh]) || IsValidObject(obj2[pveh]))
        SendClientMessage(playerid, -1, "You switched off the lights."), DestroyObject(obj[pveh]), DestroyObject(obj2[pveh]);
        vehicleid = GetPlayerVehicleID(playerid);
        GetVehicleDamageStatus(vehicleid,panels,doors,lights,tires);
        if(LightPwr[vehicleid] == 1)
            UpdateVehicleDamageStatus(vehicleid, panels, doors, 0, tires);
            else
            UpdateVehicleDamageStatus(vehicleid, panels, doors, 5, tires);
        Flasher[vehicleid] = 0;
    }
    return 1;
}
Don't watch about the "flasher" because thats working.
Reply
#10

Anyone?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)