Wysłany: 2012-12-30, 18:07
AQQ!
Wiek: 35 Na forum: 5083 dni Posty: 32
Nick w MP: Clive
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;
}
Wysłany: 2012-12-30, 18:11
NET366
;7
Wiek: 29 Na forum: 5755 dni Posty: 100
Nick w MP: NET366
Piwa : 1505
To zrob warunek blakujacy mozliwosc wlaczenia kierunku jesli dzialaja aktualnie awaryjne i tez jesli dziala lewy/prawy to nie mozna wlaczyc awaryjnych itd.
Wysłany: 2012-12-30, 18:16
AQQ!
Wiek: 35 Na forum: 5083 dni Posty: 32
Nick w MP: Clive
No niby jest, nie wiem co tam jest nie tak
if(IndiRightOn[trailerid] == true || IndiLeftOn[trailerid] == true) return 0;
Wysłany: 2012-12-30, 21:28
krzyzan
Wiek: 30 Na forum: 5669 dni Posty: 387
Piwa : 2132
Trzymaj ju? poprawia?em to ale nie wiem czy wyda?em
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 t = 0 ; t < Max_Indicators ; t ++)
{
if( Indicators [ t ][ VID ] == GetVehicleModel ( GetVehicleTrailer ( vehicleid )))
{
if( IndiLeftOn [ trailerid ] == false )
{
IndiLeftOn [ trailerid ] = true ;
IndicatorsObject [ trailerid ][ 5 ] = CreateObject ( 19294 , 0 , 0 , 0 , 0 , 0 , 0 , 80 );
AttachObjectToVehicle ( IndicatorsObject [ trailerid ][ 5 ], trailerid , Indicators [ t ][ PXLT ], Indicators [ t ][ PYLT ], Indicators [ t ][ PZLT ], 0 , 0 , 0 );
}
else
{
IndiLeftOn [ trailerid ] = false ;
DestroyObject ( IndicatorsObject [ trailerid ][ 5 ]);
}
}
}
}
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 ][ 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
{
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 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 ]);
}
}
}
}
}
Ten kod poprawia?em dla siebie wi?c dzia?a
Tagi: kierunkowskazy.
Anonymous
Na forum: 245 dni
Posty: 1
Anonymous Koniecznie zajrzyj na: