[Ajuda] Sirenes ao iniciar o GM
#1

Olб pessoal,gostaria de saber como posso fazer para que as sirenes (objetos) apareзam nos veiculos assim que o server for iniciado (retirando assim a necessidade de usar um comando para adicionar as sirenes nos carros),eu tentei colocar iso no OnGameModeInit mais falhou:

pawn Код:
new sirenteste = CreateObject( 11701,0,0,0,0,0,0,80 ); // sirene
    AttachObjectToVehicle(sirenteste, 169, 0.000000, 0.000000, 0.829999, 0.000000, 0.000000, 0.000000);
    AttachObjectToVehicle(sirenteste, 163,  0.000000, -0.519999, 0.556999, 0.000000, 0.000000, 0.000000);
    AttachObjectToVehicle(sirenteste, 164,  0.000000, -0.519999, 0.556999, 0.000000, 0.000000, 0.000000);
    AttachObjectToVehicle(sirenteste, 165,  0.000000, -0.519999, 0.556999, 0.000000, 0.000000, 0.000000);
    AttachObjectToVehicle( sirenteste, 166, 0.010000, -0.060000, 0.689999, 0.000000, 0.000000, 0.000000 ); // <1>
    AttachObjectToVehicle( sirenteste, 167, 0.010000, -0.060000, 0.689999, 0.000000, 0.000000, 0.000000 ); // <1>
    AttachObjectToVehicle( sirenteste, 168, 0.010000, -0.060000, 0.689999, 0.000000, 0.000000, 0.000000 ); // <1>
os ids 169,163,164,165,166,16,168 sгo os carros que eu quero que as sirenes sejam adicionadas:
pawn Код:
CopCarros[159] = AddStaticVehicleEx(425,1285.7000000,-789.0000000,97.3000000,0.0000000,2,2,RESPAWN_TIME);
CopCarros[160] = AddStaticVehicleEx(520,1297.9000000,-787.9000200,97.4000000,0.0000000,2,2,RESPAWN_TIME);
CopCarros[161] = AddStaticVehicleEx(432,1233.0000000,-810.0999800,88.7000000,272.0000000,2,2,RESPAWN_TIME);
CopCarros[162] = AddStaticVehicleEx(432,1220.8000000,-810.2999900,88.4000000,272.0000000,2,2,RESPAWN_TIME);
CopCarros[163] = AddStaticVehicleEx(451,1293.0000000,-829.7999900,82.9000000,0.0000000,2,2,RESPAWN_TIME);
CopCarros[164] = AddStaticVehicleEx(451,1289.5000000,-829.9000200,82.9000000,0.0000000,2,2,RESPAWN_TIME);
CopCarros[165] = AddStaticVehicleEx(451,1285.9000000,-829.7999900,82.9000000,0.0000000,2,2,RESPAWN_TIME);
CopCarros[166] = AddStaticVehicleEx(411,1282.6000000,-829.9000200,82.9000000,0.0000000,2,2,RESPAWN_TIME);
CopCarros[167] = AddStaticVehicleEx(411,1279.0000000,-829.9000200,82.9000000,0.0000000,2,2,RESPAWN_TIME);
CopCarros[168] = AddStaticVehicleEx(411,1275.6000000,-829.9000200,82.9000000,0.0000000,2,2,RESPAWN_TIME);
CopCarros[169] = AddStaticVehicleEx(560,1271.7000000,-829.9000200,82.9000000,0.0000000,2,2,RESPAWN_TIME);
CopCarros[170] = AddStaticVehicleEx(522,1254.3000000,-804.5000000,83.8000000,172.0000000,2,2,RESPAWN_TIME);
CopCarros[171] = AddStaticVehicleEx(522,1253.1000000,-804.4000200,83.8000000,171.9960000,2,2,RESPAWN_TIME);
CopCarros[172] = AddStaticVehicleEx(522,1251.7000000,-804.2999900,83.8000000,171.9960000,2,2,RESPAWN_TIME);
CopCarros[173] = AddStaticVehicleEx(497,1265.5000000,-778.0999800,96.2000000,0.0000000,2,2,RESPAWN_TIME);
CopCarros[174] = AddStaticVehicleEx(493,911.7999900,-1906.5000000,0.1000000,180.0000000,2,2,RESPAWN_TIME);
CopCarros[175] = AddStaticVehicleEx(493,903.5999800,-1906.8000000,0.0000000,180.0000000,2,2,RESPAWN_TIME);
CopCarros[177] = AddStaticVehicleEx(493,895.7999900,-1906.2000000,0.0000000,180.0000000,2,2,RESPAWN_TIME);
e tbm quero que as sirenes sejam readicionadas quando o veiculo der respawn

(OBS JA ADICIONEI ISSO PARA DESTRUIR AS SIRENES CASO O CARRO EXPLODA)
pawn Код:
public OnVehicleDeath(vehicleid, killerid)
{
        DestroyObject(siren[vehicleid]);
        return 1;
}
Como posso fazer com que as sirenes sejam adicionadas a esses veiculos quando o servidor for iniciado e quando os veiculos derem respawn?
Reply
#2

https://sampwiki.blast.hk/wiki/AttachObjectToVehicle

PHP код:
new sirenteste CreateObject11701,0,0,0,0,0,0,80 ); // sirene 
PHP код:
AttachObjectToVehicle(sirentesteID DO VEICULO0.0000000.0000000.8299990.0000000.0000000.000000); 
=

PHP код:
AttachObjectToVehicle(sirentesteCopCarros[159], 0.0000000.0000000.8299990.0000000.0000000.000000); 
OnVehicleDeath
PHP код:
DestroyDynamicObjectCopCarros[159], sirenteste ); 
Terб que criar uma sirene para cada carro.
Exemplo:
PHP код:
new sirenes10 
PHP код:
new sirenes] = CreateObject11701,0,0,0,0,0,0,80 ); // sirene 1
new sirenes] = CreateObject11701,0,0,0,0,0,0,80 ); // sirene 2
new sirenes] = CreateObject11701,0,0,0,0,0,0,80 ); // sirene 3 etc.. 
PHP код:
AttachObjectToVehicle(sirenes], CopCarros[159], 0.0000000.0000000.8299990.0000000.0000000.000000);  
AttachObjectToVehicle(sirenes], CopCarros[160], 0.0000000.0000000.8299990.0000000.0000000.000000);  
AttachObjectToVehicle(sirenes], CopCarros[161], 0.0000000.0000000.8299990.0000000.0000000.000000);  // Etc... 
OnVehicleDeath
PHP код:
DestroyDynamicObjectCopCarros[159], sirenes] );
DestroyDynamicObjectCopCarros[160], sirenes] );
DestroyDynamicObjectCopCarros[161], sirenes] ); 
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)