PARTNERI:

* Marketing

-UPOZORENJE-

Samo registrovani članovi mogu da vide/koriste forum u celini.
Prijavite se ili registrujte nalog na Balkan SA-MP forumu.


Autor Tema: [Pitanje/Savet] Zanima me kako da napravim Label na vozilima  (Pročitano 193 puta)

0 članova i 1 gost pregledaju ovu temu.

Van mreže // xunder

Odg: Zanima me kako da napravim Label na vozilima
« Odgovor #15 poslato: Januar 12, 2019, 22:31:00 posle podne »
Funkcija CreateVehicle ti vraca (returna) id vozila koje kreira.
Zamisli da imas 500 vozila i ako ukucas
new const vehicleid = CreateVehicle(...); // Ovo ce biti vozilo id 501
// Sada mozes jednostavno attachat 3d text label za vehicleid
CreateDynamic3DTextLabel("Rent vozilo", -1, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 10.0, .attachedvehicle = vehicleid);

Ne znam kako bolje da ti objasnim ovo.
 

Van mreže AdzoXx

Odg: Zanima me kako da napravim Label na vozilima
« Odgovor #16 poslato: Januar 12, 2019, 22:56:16 posle podne »
Al cekaj daj mi kodove, i gdje ide to, jel u CreateVehicle ovo?
Pawno Code: [Izaberi]
forward Nodze_CreateVehicle( scriptid, tip, orga, posao, modelid, Float:x, Float:y, Float:z, Float:angle, color1, color2, respawn_delay );
public Nodze_CreateVehicle( scriptid, tip, orga, posao, modelid, Float:x, Float:y, Float:z, Float:angle, color1, color2, respawn_delay ) {
if( ServerInfo[ BrojKreiranihVozila ] <= MaxBrojKreiranih ) {
ServerInfo[ BrojKreiranihVozila ]++;
new idKreiranog = CreateVehicle( modelid, Float:x, Float:y, Float:z, Float:angle, color1, color2, respawn_delay );
ScriptIDVozila[ idKreiranog ] = scriptid;
TipVozila[ idKreiranog ] = tip;
OrgaVozila[ idKreiranog ] = orga;
PosaoVozila[ idKreiranog ] = posao;
RealVehiclePositions[ idKreiranog ][ 0 ] = x;
RealVehiclePositions[ idKreiranog ][ 1 ] = y;
RealVehiclePositions[ idKreiranog ][ 2 ] = z;
BusyVehicle[ idKreiranog ] = -1;
garbagemanVehicles[ idKreiranog ][ gPlayerID ] = -1;
return idKreiranog;
} else return -1;
}
forward Nodze_DestroyVehicle( vehicleid );
public Nodze_DestroyVehicle( vehicleid ) {

if( vehicleid != -1 ) {
    if( Neon[ vehicleid ] == 1 ) {
Neon[ vehicleid ] = 0;
  DestroyDynamicObject( NeonObject1[ vehicleid ] );
    DestroyDynamicObject( NeonObject2[ vehicleid ] );
}
RealVehiclePositions[ vehicleid ][ 0 ] = 0.0;
RealVehiclePositions[ vehicleid ][ 1 ] = 0.0;
RealVehiclePositions[ vehicleid ][ 2 ] = 0.0;
ScriptIDVozila[ vehicleid ] = -1;
TipVozila[ vehicleid ] = -1;
OrgaVozila[ vehicleid ] = -1;
PosaoVozila[ vehicleid ] = -1;
}

if( DestroyVehicle( vehicleid ) ) {
    ServerInfo[ BrojKreiranihVozila ]--;
return 1;
}
else return -1;
}
Znaci vozila cuva u Folderu scriptfile (Vozila), Sad ne znam kako da izvedem da na svakom vozilu pise od cega je npr od Organizacije, La Cosa Nostra, i da na autu pise [ LCN ]
Probaj ovako:
Pawno Code: [Izaberi]
forward Nodze_CreateVehicle( scriptid, tip, orga, posao, modelid, Float:x, Float:y, Float:z, Float:angle, color1, color2, respawn_delay );
public Nodze_CreateVehicle( scriptid, tip, orga, posao, modelid, Float:x, Float:y, Float:z, Float:angle, color1, color2, respawn_delay ) {
if( ServerInfo[ BrojKreiranihVozila ] <= MaxBrojKreiranih ) {
ServerInfo[ BrojKreiranihVozila ]++;
new idKreiranog = CreateVehicle( modelid, Float:x, Float:y, Float:z, Float:angle, color1, color2, respawn_delay );
ScriptIDVozila[ idKreiranog ] = scriptid;
TipVozila[ idKreiranog ] = tip;
OrgaVozila[ idKreiranog ] = orga;
PosaoVozila[ idKreiranog ] = posao;
RealVehiclePositions[ idKreiranog ][ 0 ] = x;
RealVehiclePositions[ idKreiranog ][ 1 ] = y;
RealVehiclePositions[ idKreiranog ][ 2 ] = z;
rvehl[playerid] = Create3DTextLabel("[RENT]", 0xFFFFFFAA, 0.0, 0.0, 0.0, 20, 0, 1);
Attach3DTextLabelToVehicle(rvehl[playerid], ID Vozila, 0.0, 0.0, 0.0);
BusyVehicle[ idKreiranog ] = -1;
garbagemanVehicles[ idKreiranog ][ gPlayerID ] = -1;
return idKreiranog;
} else return -1;
}
P.S. Na vrhu skripte dodaj
Pawno Code: [Izaberi]
new Text3D: rvehl[MAX_PLAYERS];
 

Van mreže Nodze

Odg: Zanima me kako da napravim Label na vozilima
« Odgovor #17 poslato: Januar 13, 2019, 10:30:11 pre podne »
Funkcija CreateVehicle ti vraca (returna) id vozila koje kreira.
Zamisli da imas 500 vozila i ako ukucas
new const vehicleid = CreateVehicle(...); // Ovo ce biti vozilo id 501
// Sada mozes jednostavno attachat 3d text label za vehicleid
CreateDynamic3DTextLabel("Rent vozilo", -1, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 10.0, .attachedvehicle = vehicleid);

Ne znam kako bolje da ti objasnim ovo.
brate napravio sam ovako, sad nece da prikazuje na vozilima, a nema erora nit warninga :D :D
Pawno Code: [Izaberi]
stock SetVehicleLabels( i ) {

if( !VehicleInfo[ i ][ Validv3DText ] ) {

    if( VehicleInfo[ i ][ vUsage ] == ADMIN_VOZILO ) {

    VehicleInfo[ i ][ Validv3DText ] = true;
VehicleInfo[ i ][ v3DText ] = Create3DTextLabel( "[ ADMIN ]", 0x000000FF, 0.0, 0.0, 0.0, 50.0, 0, 1 );
Attach3DTextLabelToVehicle( VehicleInfo[ i ][ v3DText ], VehicleInfo[ i ][ vID ], 0.0, 0.0, 0.0);
}
else if( VehicleInfo[ i ][ vUsage ] == RENTANO_VOZILO ) {

    VehicleInfo[ i ][ Validv3DText ] = true;
VehicleInfo[ i ][ v3DText ] = Create3DTextLabel( "[ RENT ]", 0x33CCFFAA, 0.0, 0.0, 0.0, 50.0, 0, 1 );
Attach3DTextLabelToVehicle( VehicleInfo[ i ][ v3DText ], VehicleInfo[ i ][ vID ], 0.0, 0.0, 0.0);
}
/* else if( VehicleInfo[ i ][ vUsage ] == PROMOTER_VOZILO ) {

    VehicleInfo[ i ][ Validv3DText ] = true;
VehicleInfo[ i ][ v3DText ] = Create3DTextLabel( "[ PROMOTER ]", 0x33CCFFAA, 0.0, 0.0, 0.0, 50.0, 0, 1 );
Attach3DTextLabelToVehicle( VehicleInfo[ i ][ v3DText ], VehicleInfo[ i ][ vID ], 0.0, 0.0, 0.0);
}*/

else if( VehicleInfo[ i ][ vUsage ] == VIP_VOZILO ) {

    VehicleInfo[ i ][ Validv3DText ] = true;
VehicleInfo[ i ][ v3DText ] = Create3DTextLabel( "[ VIP ]", 0x33CCFFAA, 0.0, 0.0, 0.0, 50.0, 0, 1 );
Attach3DTextLabelToVehicle( VehicleInfo[ i ][ v3DText ], VehicleInfo[ i ][ vID ], 0.0, 0.0, 0.0);
}
/* else if( VehicleInfo[ i ][ vUsage ] == Supporter_VOZILO ) {

    VehicleInfo[ i ][ Validv3DText ] = true;
VehicleInfo[ i ][ v3DText ] = Create3DTextLabel( "[ Supporter ]", 0xDABB3EAA, 0.0, 0.0, 0.0, 50.0, 0, 1 );
Attach3DTextLabelToVehicle( VehicleInfo[ i ][ v3DText ], VehicleInfo[ i ][ vID ], 0.0, 0.0, 0.0);
}*/

else if( VehicleInfo[ i ][ vUsage ] == ORGANIZACIJSKO_VOZILO ) {

if( OI[ VehicleInfo[ i ][ vOrganization ] ][ oTip ] == ORG_TIP_PD ) {

    new stringce[ 20 ];
    format( stringce, sizeof( stringce ), "[ %s ]", OI[ VehicleInfo[ i ][ vOrganization ] ][ oPreFix ] );

    VehicleInfo[ i ][ Validv3DText ] = true;
VehicleInfo[ i ][ v3DText ] = Create3DTextLabel( stringce, 0x33CCFFAA, 0.0, 0.0, 0.0, 50.0, 0, 1 );
Attach3DTextLabelToVehicle( VehicleInfo[ i ][ v3DText ], VehicleInfo[ i ][ vID ], 0.0, 0.0, 0.0);
// }
// }
/* else if( VehicleInfo[ i ][ vUsage ] == PUMPA_VOZILO ) {

if( VehicleInfo[ i ][ vModel ] == 584 ) {

new fstationID = VehicleInfo[ i ][ vFuelProperty ];

    new stringce[ 256 ];
                format( stringce, sizeof stringce, "{0F87FF}[ "col_white"CISTERNA {0F87FF}]\n{0F87FF}Dizel: {FFFFFF}%d/300 litara\n{0F87FF}Benzin: {FFFFFF}%d/300 litara\n{0F87FF}Gas: {FFFFFF}%d/300 litara\n{0F87FF}Gasno Ulje: {FFFFFF}%d/300 litara\n\n{0F87FF}[ {FFFFFF}%s {0F87FF}]", CisternFuel[ VehicleInfo[ i ][ vID ] ][ 0 ], CisternFuel[ VehicleInfo[ i ][ vID ] ][ 1 ], CisternFuel[ VehicleInfo[ i ][ vID ] ][ 3 ], CisternFuel[ VehicleInfo[ i ][ vID ] ][ 2 ], FuelStation[ fstationID ][ fsName ] );

    VehicleInfo[ i ][ Validv3DText ] = true;
VehicleInfo[ i ][ v3DText ] = Create3DTextLabel( stringce, 0x33CCFFAA, 0.0, 0.0, 0.0, 30.0, 0, 1 );
Attach3DTextLabelToVehicle( VehicleInfo[ i ][ v3DText ], VehicleInfo[ i ][ vID ], 0.0, 0.0, 0.0);
}
}
}
else if( VehicleInfo[ i ][ Validv3DText ] ) {

    if( VehicleInfo[ i ][ vUsage ] == PUMPA_VOZILO ) {

if( VehicleInfo[ i ][ vModel ] == 584 ) {

new fstationID = VehicleInfo[ i ][ vFuelProperty ];

                Delete3DTextLabel( VehicleInfo[ i ][ v3DText ] );

    new stringce[ 256 ];
                format( stringce, sizeof stringce, "{0F87FF}[ "col_white"CISTERNA {0F87FF}]\n{0F87FF}Dizel: {FFFFFF}%d/300 litara\n{0F87FF}Benzin: {FFFFFF}%d/300 litara\n{0F87FF}Gas: {FFFFFF}%d/300 litara\n{0F87FF}Gasno Ulje: {FFFFFF}%d/300 litara\n\n{0F87FF}[ {FFFFFF}%s {0F87FF}]", CisternFuel[ VehicleInfo[ i ][ vID ] ][ 0 ], CisternFuel[ VehicleInfo[ i ][ vID ] ][ 1 ], CisternFuel[ VehicleInfo[ i ][ vID ] ][ 3 ], CisternFuel[ VehicleInfo[ i ][ vID ] ][ 2 ], FuelStation[ fstationID ][ fsName ] );

    VehicleInfo[ i ][ Validv3DText ] = true;
    VehicleInfo[ i ][ v3DText ] = Create3DTextLabel( stringce, 0x33CCFFAA, 0.0, 0.0, 0.0, 30.0, 0, 1 );
Attach3DTextLabelToVehicle( VehicleInfo[ i ][ v3DText ], VehicleInfo[ i ][ vID ], 0.0, 0.0, 0.0);*/

}
}
}
}