Zaloguj się by uzyskać pełen dostęp. Nie masz jeszcze konta? Założ je już teraz w kilka sekund.

Wysłany: 2012-12-30, 18:07


AQQ!







Wiek: 35
Na forum: 5083 dni
Posty: 32
Nick w MP: Clive



Respekt: 50

Witam.
W tych kierunkowskazach s? dorobione te do naczepy.
Ale jest pewnien problem z nimi, gdy sie w??czy awaryjne i od razu te w prawo albo w lewo to sie nak?adaj? na siebie.


Kod:

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));
//----------------------awaryjne
if(newkeys == KEY_YES){
if(IsTrailerAttachedToVehicle(vehicleid)){
for(new t = 0; t < Max_Indicators; t++){
if(Indicators[t][VID] == GetVehicleModel(GetVehicleTrailer(vehicleid))){
if(IndiRightOn[trailerid] == true || IndiLeftOn[trailerid] == true) return 0;
if(IndiEmerOn[trailerid] == false){
IndiEmerOn[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);
//
IndicatorsObject[trailerid][5] = CreateObject( 19294,0,0,0,0,0,0,80 );
AttachObjectToVehicle(IndicatorsObject[trailerid][5], trailerid, Indicators[t][PXPT], Indicators[t][PYPT], Indicators[t][PZPT], 0, 0, 0);
}
else{
IndiEmerOn[trailerid] = false;
DestroyObject(IndicatorsObject[trailerid][4]);
DestroyObject(IndicatorsObject[trailerid][5]);
}
}
}
}
for(new i = 0; i < Max_Indicators; i++){
if(Indicators[i][VID] == GetVehicleModel(vehicleid)){
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]);
DestroyObject(IndicatorsObject[trailerid][4]);
DestroyObject(IndicatorsObject[trailerid][5]);
}
}
}
}
if(newkeys == KEY_LOOK_LEFT){
if(IsTrailerAttachedToVehicle(vehicleid)){
if(IndiEmerOn[trailerid] == true || IndiRightOn[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)){
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 == KEY_LOOK_RIGHT){
if(IsTrailerAttachedToVehicle(vehicleid)){
if(IndiEmerOn[trailerid] == true || 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][5] = CreateObject( 19294,0,0,0,0,0,0,80 );
AttachObjectToVehicle(IndicatorsObject[trailerid][5], trailerid, Indicators[t][PXPT], Indicators[t][PYPT], Indicators[t][PZPT], 0, 0, 0);
}
else{
IndiRightOn[trailerid] = false;
DestroyObject(IndicatorsObject[trailerid][5]);
}
}
}
}
for(new i = 0; i < Max_Indicators; i++){
if(Indicators[i][VID] == GetVehicleModel(vehicleid)){
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;
}


Postaw piwo autorowi tego posta
 

 
Wysłany: 2012-12-30, 18:11


NET366

;7






Wiek: 29
Na forum: 5755 dni
Posty: 100
Nick w MP: NET366

Piwa: 1505

Respekt: 75

To zrob warunek blakujacy mozliwosc wlaczenia kierunku jesli dzialaja aktualnie awaryjne i tez jesli dziala lewy/prawy to nie mozna wlaczyc awaryjnych itd.

Podpis
Koniec i tak nastąpi...
Postaw piwo autorowi tego posta
 

 
Wysłany: 2012-12-30, 18:16


AQQ!







Wiek: 35
Na forum: 5083 dni
Posty: 32
Nick w MP: Clive



Respekt: 50

No niby jest, nie wiem co tam jest nie tak ;x
if(IndiRightOn[trailerid] == true || IndiLeftOn[trailerid] == true) return 0;

Postaw piwo autorowi tego posta
 

 
Wysłany: 2012-12-30, 21:28


krzyzan







Wiek: 30
Na forum: 5669 dni
Posty: 387

Piwa: 2132

Respekt: 135
Respekt: 135

Trzymaj ju? poprawia?em to ale nie wiem czy wyda?em :P

Pawn

    if(IsPlayerInAnyVehicle(playerid) && GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
    {
        new vehicleid GetPlayerVehicleID(playerid);
        new trailerid GetVehicleTrailer(GetPlayerVehicleID(playerid));

                //----------------------Kierunkowskaz Lewy
        if(newkeys == KEY_LOOK_LEFT)
        {

            if(IsTrailerAttachedToVehicle(vehicleid))
            {
                if(IndiRightOn[trailerid] == true) return 0;
                for(new 0Max_Indicatorst++)
                {
                    if(Indicators[t][VID] == GetVehicleModel(GetVehicleTrailer(vehicleid)))
                    {
                        if(IndiLeftOn[trailerid] == false)
                        {
                            IndiLeftOn[trailerid] = true;
                            IndicatorsObject[trailerid][5] = CreateObject19294,0,0,0,0,0,0,80 );
                            AttachObjectToVehicle(IndicatorsObject[trailerid][5], traileridIndicators[t][PXLT], Indicators[t][PYLT], Indicators[t][PZLT], 000);
                        }
                        else
                        {
                            IndiLeftOn[trailerid] = false;
                            DestroyObject(IndicatorsObject[trailerid][5]);
                        }
                    }
                }
            }

            for(new 0Max_Indicatorsi++)
            {
                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][2] = CreateObject19294,0,0,0,0,0,0,80 );
                        AttachObjectToVehicle(IndicatorsObject[vehicleid][2], vehicleidIndicators[i][PXLP], Indicators[i][PYLP], Indicators[i][PZLP], 000);
                        //Kierunkowskaz Lewy Tylny
                        IndicatorsObject[vehicleid][3] = CreateObject19294,0,0,0,0,0,0,80 );
                        AttachObjectToVehicle(IndicatorsObject[vehicleid][3], vehicleidIndicators[i][PXLT], Indicators[i][PYLT], Indicators[i][PZLT], 000);

                    }
                    else
                    {
                        IndiLeftOn[vehicleid] = false;
                        DestroyObject(IndicatorsObject[vehicleid][2]);
                        DestroyObject(IndicatorsObject[vehicleid][3]);

                     }
                }
            }
        }
                //----------------------Kierunkowskaz Prawy
        if(newkeys == KEY_LOOK_RIGHT)
        {

            if(IsTrailerAttachedToVehicle(vehicleid))
            {
                if(IndiLeftOn[trailerid] == true) return 0;
                for(new 0Max_Indicatorst++)
                {
                    if(Indicators[t][VID] == GetVehicleModel(GetVehicleTrailer(vehicleid)))
                    {
                        if(IndiRightOn[trailerid] == false)
                        {
                            IndiRightOn[trailerid] = true;
                            IndicatorsObject[trailerid][4] = CreateObject19294,0,0,0,0,0,0,80 );
                            AttachObjectToVehicle(IndicatorsObject[trailerid][4], traileridIndicators[t][PXPT], Indicators[t][PYPT], Indicators[t][PZPT], 000);
                        }else
                        {
                            IndiRightOn[trailerid] = false;
                            DestroyObject(IndicatorsObject[trailerid][4]);
                        }
                    }
                }
            }

            for(new 0Max_Indicatorsi++)
            {
                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] = CreateObject19294,0,0,0,0,0,0,80 );
                        AttachObjectToVehicle(IndicatorsObject[vehicleid][0], vehicleidIndicators[i][PXPP], Indicators[i][PYPP], Indicators[i][PZPP], 000);
                        //Kierunkowskaz Prawy Tylny
                        IndicatorsObject[vehicleid][1] = CreateObject19294,0,0,0,0,0,0,80 );
                        AttachObjectToVehicle(IndicatorsObject[vehicleid][1], vehicleidIndicators[i][PXPT], Indicators[i][PYPT], Indicators[i][PZPT], 000);
                    }else
                    {
                        IndiRightOn[vehicleid] = false;
                        DestroyObject(IndicatorsObject[vehicleid][0]);
                        DestroyObject(IndicatorsObject[vehicleid][1]);
                    }
                }
            }
        }
    }


Ten kod poprawia?em dla siebie wi?c dzia?a :D

Postaw piwo autorowi tego posta
 

 
Tagi: kierunkowskazy.
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






Skocz do:  
Wyświetl posty z ostatnich:   
GTAONLINE.PL » JĘZYKI PROGRAMOWANIA » PAWN » [INNE] Kierunkowskazy. Ten temat jest zablokowany bez możliwości zmiany postów lub pisania odpowiedzi

Nie możesz pisać nowych tematów
Nie możesz odpowiadać w tematach
Nie możesz zmieniać swoich postów
Nie możesz usuwać swoich postów
Nie możesz głosować w ankietach
Dodaj temat do Ulubionych
Wersja do druku