11.03.2011, 10:43
i solved some problem
until now always attach new police light...now i solved
bot now i don't know why didn't destroy the police light
here is the code
until now always attach new police light...now i solved
bot now i don't know why didn't destroy the police light
here is the code
pawn Код:
if (newkeys == KEY_CROUCH)
{
if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
new pdlight1;
new pdlight2;
new pdlight3;
new pdlight4;
new checkcar = GetPlayerVehicleID(playerid);
if(pdlighton1 == 0 && checkcar == buffpd1 || pdlighton2 == 0 && checkcar == buffpd2 || pdlighton3 == 0 && checkcar == buffpd3 || pdlighton4 == 0 && checkcar == buffpd4)
{
if(checkcar == buffpd1)
{
pdlight1 = CreateObject(18646,0,0,0,0,0,0);
AttachObjectToVehicle(pdlight1, buffpd1, 0, -0.0, 0, 2.0, 2.0, 3.0);
pdlighton1 = 1;
}
if(checkcar == buffpd2)
{
pdlight2 = CreateObject(18646,0,0,0,0,0,0);
AttachObjectToVehicle(pdlight2, buffpd2, 0, -0.0, 0, 2.0, 2.0, 3.0);
pdlighton2 = 1;
}
if(checkcar == buffpd3)
{
pdlight3 = CreateObject(18646,0,0,0,0,0,0);
AttachObjectToVehicle(pdlight3, buffpd3, 0, -0.0, 0, 2.0, 2.0, 3.0);
pdlighton3 = 1;
}
if(checkcar == buffpd4)
{
pdlight4 = CreateObject(18646,0,0,0,0,0,0);
AttachObjectToVehicle(pdlight4, buffpd4, 0, -0.0, 0, 2.0, 2.0, 3.0);
pdlighton4 = 1;
}
}
else
{
if(checkcar == buffpd1)
{
DestroyObject(pdlight1);
}
if(checkcar == buffpd2)
{
DestroyObject(pdlight2);
}
if(checkcar == buffpd3)
{
DestroyObject(pdlight3);
}
if(checkcar == buffpd4)
{
DestroyObject(pdlight4);
}
}
}
}