Krystian5
Wiek: 36 Na forum: 5230 dni Posty: 185
Piwa : 1
Witam.Posiadam skrypt kierunkowskazy lecz dzia?aj? one na klawisze numeryczne 4 i 6.Chcia?bym Was prosi? o przerobienie ich aby dzia?a?y na Q i E.
Oto ten skrypt.
Kod: #include <a_samp>
#include <zcmd>
#include <sscanf>
#define Max_Indicators 144
enum IndicatorsInfo
{
VID, //ID Modelu Pojazdu
Float:PXLP, //Lewy Przod X
Float:PYLP, //Lewy Przod Y
Float:PZLP,//Lewy Przod Z
Float:PXLT, //Lewy Ty? X
Float:PYLT, //Lewy Ty? Y
Float:PZLT,//Lewy Ty? Z
Float:PXPP, //Prawy Przod X
Float:PYPP, //Prawy Przod Y
Float:PZPP,//Prawy Przod Z
Float:PXPT, //Prawy Ty? X
Float:PYPT, //Prawy Ty? Y
Float:PZPT //Prawy Ty? Z
};
new IndicatorsObject[MAX_VEHICLES][6]; //Obiekty kierunkowskaz?w
new bool:IndiRightOn[MAX_VEHICLES]; //Kierunkowskaz prawy w??czony false/true
new bool:IndiLeftOn[MAX_VEHICLES]; //Kierunkowskaz lewy w??czony false/true
new bool:IndiEmerOn[MAX_VEHICLES]; //Awaryjne ?wiat?a w??czone false/true
new Indicators[Max_Indicators][IndicatorsInfo] =
{
{422, -0.8, 2.2, -0.3, -0.9, -2.499999, -0.2, 0.8, 2.2, -0.3, 0.9, -2.499999, -0.2},
{482,-0.9,2.399999,-0.3,-0.799999,-2.599999,0.0,0.9,2.399999,-0.3,0.799999,-2.599999,0.0},
};
CMD:awaryjne(playerid,params[])
{
new vehicleid = GetPlayerVehicleID(playerid);
if(IsPlayerInAnyVehicle(playerid) && GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
//----------------------?wiat?a Awaryjne
for(new i = 0; i < Max_Indicators; i++)
{
if(Indicators[i][VID] == GetVehicleModel(vehicleid))//Por?wnanie Modelu pojazdu z modelem w tablicy
{
if(IndiRightOn[vehicleid] == true || IndiLeftOn[vehicleid] == true) return 0;
if(IndiEmerOn[vehicleid] == false)
{
IndiEmerOn[vehicleid] = true;
//Kierunkowskaz Prawy Przedni
IndicatorsObject[vehicleid][0] = CreateObject( 19294,0,0,0,0,0,0,80 );
AttachObjectToVehicle(IndicatorsObject[vehicleid][0], vehicleid, Indicators[i][PXPP], Indicators[i][PYPP], Indicators[i][PZPP], 0, 0, 0);
//Kierunkowskaz Prawy Tylny
IndicatorsObject[vehicleid][1] = CreateObject( 19294,0,0,0,0,0,0,80 );
AttachObjectToVehicle(IndicatorsObject[vehicleid][1], vehicleid, Indicators[i][PXPT], Indicators[i][PYPT], Indicators[i][PZPT], 0, 0, 0);
//Kierunkowskaz Lewy Przedni
IndicatorsObject[vehicleid][2] = CreateObject( 19294,0,0,0,0,0,0,80 );
AttachObjectToVehicle(IndicatorsObject[vehicleid][2], vehicleid, Indicators[i][PXLP], Indicators[i][PYLP], Indicators[i][PZLP], 0, 0, 0);
//Kierunkowskaz Lewy Tylny
IndicatorsObject[vehicleid][3] = CreateObject( 19294,0,0,0,0,0,0,80 );
AttachObjectToVehicle(IndicatorsObject[vehicleid][3], vehicleid, Indicators[i][PXLT], Indicators[i][PYLT], Indicators[i][PZLT], 0, 0, 0);
}else
{
IndiEmerOn[vehicleid] = false;
DestroyObject(IndicatorsObject[vehicleid][0]);
DestroyObject(IndicatorsObject[vehicleid][1]);
DestroyObject(IndicatorsObject[vehicleid][2]);
DestroyObject(IndicatorsObject[vehicleid][3]);
}
}
}
}
return 1;
}
public OnVehicleDeath(vehicleid)
{
IndiEmerOn[vehicleid] = false;
IndiRightOn[vehicleid] = false;
IndiLeftOn[vehicleid] = false;
DestroyObject(IndicatorsObject[vehicleid][0]);
DestroyObject(IndicatorsObject[vehicleid][1]);
DestroyObject(IndicatorsObject[vehicleid][2]);
DestroyObject(IndicatorsObject[vehicleid][3]);
DestroyObject(IndicatorsObject[vehicleid][4]);
return 1;
}
public OnVehicleSpawn(vehicleid)
{
IndiEmerOn[vehicleid] = false;
IndiRightOn[vehicleid] = false;
IndiLeftOn[vehicleid] = false;
DestroyObject(IndicatorsObject[vehicleid][0]);
DestroyObject(IndicatorsObject[vehicleid][1]);
DestroyObject(IndicatorsObject[vehicleid][2]);
DestroyObject(IndicatorsObject[vehicleid][3]);
DestroyObject(IndicatorsObject[vehicleid][4]);
return 1;
}
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if(IsPlayerInAnyVehicle(playerid) && GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
new vehicleid = GetPlayerVehicleID(playerid);
new trailerid = GetVehicleTrailer(GetPlayerVehicleID(playerid));
//----------------------Kierunkowskaz Lewy
if(newkeys == 8192)
{
if(IsTrailerAttachedToVehicle(vehicleid))
{
if(IndiLeftOn[trailerid] == true) return 0;
for(new t = 0; t < Max_Indicators; t++)
{
if(Indicators[t][VID] == GetVehicleModel(GetVehicleTrailer(vehicleid)))
{
if(IndiLeftOn[trailerid] == false)
{
IndiLeftOn[trailerid] = true;
IndicatorsObject[trailerid][4] = CreateObject( 19294,0,0,0,0,0,0,80 );
AttachObjectToVehicle(IndicatorsObject[trailerid][4], trailerid, Indicators[t][PXLT], Indicators[t][PYLT], Indicators[t][PZLT], 0, 0, 0);
}else
{
IndiLeftOn[trailerid] = false;
DestroyObject(IndicatorsObject[trailerid][4]);
}
}
}
}
for(new i = 0; i < Max_Indicators; i++)
{
if(Indicators[i][VID] == GetVehicleModel(vehicleid))//Por?wnanie Modelu pojazdu z modelem w tablicy
{
if(IndiEmerOn[vehicleid] == true || IndiRightOn[vehicleid] == true) return 0;
if(IndiLeftOn[vehicleid] == false)
{
IndiLeftOn[vehicleid] = true;
//Kierunkowskaz Lewy Przedni
IndicatorsObject[vehicleid][0] = CreateObject( 19294,0,0,0,0,0,0,80 );
AttachObjectToVehicle(IndicatorsObject[vehicleid][0], vehicleid, Indicators[i][PXLP], Indicators[i][PYLP], Indicators[i][PZLP], 0, 0, 0);
//Kierunkowskaz Lewy Tylny
IndicatorsObject[vehicleid][1] = CreateObject( 19294,0,0,0,0,0,0,80 );
AttachObjectToVehicle(IndicatorsObject[vehicleid][1], vehicleid, Indicators[i][PXLT], Indicators[i][PYLT], Indicators[i][PZLT], 0, 0, 0);
}else
{
IndiLeftOn[vehicleid] = false;
DestroyObject(IndicatorsObject[vehicleid][0]);
DestroyObject(IndicatorsObject[vehicleid][1]);
}
}
}
}
//----------------------Kierunkowskaz Prawy
if(newkeys == 16384)
{
if(IsTrailerAttachedToVehicle(vehicleid))
{
if(IndiLeftOn[trailerid] == true) return 0;
for(new t = 0; t < Max_Indicators; t++)
{
if(Indicators[t][VID] == GetVehicleModel(GetVehicleTrailer(vehicleid)))
{
if(IndiRightOn[trailerid] == false)
{
IndiRightOn[trailerid] = true;
IndicatorsObject[trailerid][4] = CreateObject( 19294,0,0,0,0,0,0,80 );
AttachObjectToVehicle(IndicatorsObject[trailerid][4], trailerid, Indicators[t][PXPT], Indicators[t][PYPT], Indicators[t][PZPT], 0, 0, 0);
}else
{
IndiRightOn[trailerid] = false;
DestroyObject(IndicatorsObject[trailerid][4]);
}
}
}
}
for(new i = 0; i < Max_Indicators; i++)
{
if(Indicators[i][VID] == GetVehicleModel(vehicleid))//Por?wnanie Modelu pojazdu z modelem w tablicy
{
if(IndiEmerOn[vehicleid] == true || IndiLeftOn[vehicleid] == true) return 0;
if(IndiRightOn[vehicleid] == false)
{
IndiRightOn[vehicleid] = true;
//Kierunkowskaz Prawy Przedni
IndicatorsObject[vehicleid][0] = CreateObject( 19294,0,0,0,0,0,0,80 );
AttachObjectToVehicle(IndicatorsObject[vehicleid][0], vehicleid, Indicators[i][PXPP], Indicators[i][PYPP], Indicators[i][PZPP], 0, 0, 0);
//Kierunkowskaz Prawy Tylny
IndicatorsObject[vehicleid][1] = CreateObject( 19294,0,0,0,0,0,0,80 );
AttachObjectToVehicle(IndicatorsObject[vehicleid][1], vehicleid, Indicators[i][PXPT], Indicators[i][PYPT], Indicators[i][PZPT], 0, 0, 0);
}else
{
IndiRightOn[vehicleid] = false;
DestroyObject(IndicatorsObject[vehicleid][0]);
DestroyObject(IndicatorsObject[vehicleid][1]);
}
}
}
}
}
return 1;
}
public OnGameModeInit()
{
SetWeather(2);
return 1;
}
Za pomoc daje