Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #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 == 256)
- {
- 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 == 64)
- {
- 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;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement