SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 22/12/2018, 09:55 AM   #1
Heress
Huge Clucker
 
Heress's Avatar
 
Join Date: Mar 2018
Location: Lithuania
Posts: 262
Reputation: 7
Post attach

new vehid1 = NVTransportas[0] = CreateVehicle(583, -3779.2019, -1880.6560, 5.2844, 90.0000, -1, -1, 100);
new vehid2 = NVTransportas[1] = CreateVehicle(583, -3778.9314, -1884.0042, 5.2844, 90.0000, -1, -1, 100);
new vehid3 = NVTransportas[2] = CreateVehicle(583, -3778.3508, -1887.5313, 5.2844, 90.0000, -1, -1, 100);
new vehid4 = NVTransportas[3] = CreateVehicle(583, -3777.9119, -1890.9458, 5.2844, 90.0000, -1, -1, 100);
//--------------------------------------------------------------------------------------------------------//
new utilitytrailer1 = CreateVehicle(611, -3775.2961, -1880.6464, 5.4584, 90.0000, -1, -1, 100);
new utilitytrailer2 = CreateVehicle(611, -3775.0056, -1884.0587, 5.4584, 90.0000, -1, -1, 100);
new utilitytrailer3 = CreateVehicle(611, -3774.0906, -1890.9784, 5.4584, 90.0000, -1, -1, 100);
new utilitytrailer4 = CreateVehicle(611, -3774.3333, -1887.6206, 5.4584, 90.0000, -1, -1, 100);
//--------------------------------------------------------------------------------------------------------//

AttachTrailerToVehicle(utilitytrailer1, vehid1);
AttachTrailerToVehicle(utilitytrailer2, vehid2);
AttachTrailerToVehicle(utilitytrailer3, vehid3);
AttachTrailerToVehicle(utilitytrailer4, vehid4);

Why attach is not working?
__________________
==============
Sorry for my bad English









Respect: Kalcor, ******. Thank you for this great game!
Heress is offline   Reply With Quote
Old 22/12/2018, 02:58 PM   #2
InsaneBR
Big Clucker
 
InsaneBR's Avatar
 
Join Date: Feb 2018
Posts: 104
Reputation: 8
Default Re: attach

try
PHP Code:
new NVTransportas[4],
    
utilitytrailer[4]
;
//out of callbacks

//OnGameModeInit
NVTransportas[0] = CreateVehicle(583, -3779.2019, -1880.65605.284490.0000, -1, -1100);
NVTransportas[1] = CreateVehicle(583, -3778.9314, -1884.00425.284490.0000, -1, -1100);
NVTransportas[2] = CreateVehicle(583, -3778.3508, -1887.53135.284490.0000, -1, -1100);
NVTransportas[3] = CreateVehicle(583, -3777.9119, -1890.94585.284490.0000, -1, -1100);

utilitytrailer[0] = CreateVehicle(611, -3775.2961, -1880.64645.458490.0000, -1, -1100);
utilitytrailer[1] = CreateVehicle(611, -3775.0056, -1884.05875.458490.0000, -1, -1100);
utilitytrailer[2] = CreateVehicle(611, -3774.0906, -1890.97845.458490.0000, -1, -1100);
utilitytrailer[3] = CreateVehicle(611, -3774.3333, -1887.62065.458490.0000, -1, -1100);
    
for(new 
x4x++) AttachTrailerToVehicle(utilitytrailer[x], NVTransportas[x]); 
InsaneBR is offline   Reply With Quote
Old 23/12/2018, 05:42 PM   #3
Heress
Huge Clucker
 
Heress's Avatar
 
Join Date: Mar 2018
Location: Lithuania
Posts: 262
Reputation: 7
Default Re: attach

Quote:
Originally Posted by InsaneBR View Post
try
PHP Code:
new NVTransportas[4],
    
utilitytrailer[4]
;
//out of callbacks

//OnGameModeInit
NVTransportas[0] = CreateVehicle(583, -3779.2019, -1880.65605.284490.0000, -1, -1100);
NVTransportas[1] = CreateVehicle(583, -3778.9314, -1884.00425.284490.0000, -1, -1100);
NVTransportas[2] = CreateVehicle(583, -3778.3508, -1887.53135.284490.0000, -1, -1100);
NVTransportas[3] = CreateVehicle(583, -3777.9119, -1890.94585.284490.0000, -1, -1100);

utilitytrailer[0] = CreateVehicle(611, -3775.2961, -1880.64645.458490.0000, -1, -1100);
utilitytrailer[1] = CreateVehicle(611, -3775.0056, -1884.05875.458490.0000, -1, -1100);
utilitytrailer[2] = CreateVehicle(611, -3774.0906, -1890.97845.458490.0000, -1, -1100);
utilitytrailer[3] = CreateVehicle(611, -3774.3333, -1887.62065.458490.0000, -1, -1100);
    
for(new 
x4x++) AttachTrailerToVehicle(utilitytrailer[x], NVTransportas[x]); 
No it don't work. Trailer is not attaching OnGameModeInit...
https://imgur.com/a/NwCDkoX
__________________
==============
Sorry for my bad English









Respect: Kalcor, ******. Thank you for this great game!
Heress is offline   Reply With Quote
Old 23/12/2018, 05:45 PM   #4
Deken
Big Clucker
 
Join Date: Nov 2017
Posts: 52
Reputation: 0
Default Re: attach

try making a timer and when timer end then try to attach trailer in public timerend?
Deken is offline   Reply With Quote
Old 23/12/2018, 05:57 PM   #5
Heress
Huge Clucker
 
Heress's Avatar
 
Join Date: Mar 2018
Location: Lithuania
Posts: 262
Reputation: 7
Default Re: attach

Quote:
Originally Posted by Deken View Post
try making a timer and when timer end then try to attach trailer in public timerend?
Nope

Quote:
forward OnTrailerAttached();

public OnTrailerAttached()
{
for(new x; x < 4; x++) AttachTrailerToVehicle(utilitytrailer[x], NVTransportas[x]);
}

new NVTransportas[4];
new utilitytrailer[4];

OnGameModeInit()
{
NVTransportas[0] = CreateVehicle(583, -3779.2019, -1880.6560, 5.2844, 90.0000, -1, -1, 100);
NVTransportas[1] = CreateVehicle(583, -3778.9314, -1884.0042, 5.2844, 90.0000, -1, -1, 100);
NVTransportas[2] = CreateVehicle(583, -3778.3508, -1887.5313, 5.2844, 90.0000, -1, -1, 100);
NVTransportas[3] = CreateVehicle(583, -3777.9119, -1890.9458, 5.2844, 90.0000, -1, -1, 100);

utilitytrailer[0] = CreateVehicle(611, -3775.2961, -1880.6464, 5.4584, 90.0000, -1, -1, 100);
utilitytrailer[1] = CreateVehicle(611, -3775.0056, -1884.0587, 5.4584, 90.0000, -1, -1, 100);
utilitytrailer[2] = CreateVehicle(611, -3774.0906, -1890.9784, 5.4584, 90.0000, -1, -1, 100);
utilitytrailer[3] = CreateVehicle(611, -3774.3333, -1887.6206, 5.4584, 90.0000, -1, -1, 100);

SetTimer("OnTrailerAttached", 5000, false);
}
__________________
==============
Sorry for my bad English









Respect: Kalcor, ******. Thank you for this great game!
Heress is offline   Reply With Quote
Old 23/12/2018, 06:01 PM   #6
Deken
Big Clucker
 
Join Date: Nov 2017
Posts: 52
Reputation: 0
Default Re: attach

i made it like this make it like in your code AttachTrailerToVehicle(newTrailer[playerid], vehicleid);
Deken is offline   Reply With Quote
Old 23/12/2018, 09:00 PM   #7
Heress
Huge Clucker
 
Heress's Avatar
 
Join Date: Mar 2018
Location: Lithuania
Posts: 262
Reputation: 7
Default Re: attach

Quote:
Originally Posted by Deken View Post
i made it like this make it like in your code AttachTrailerToVehicle(newTrailer[playerid], vehicleid);
"i made it like this make it like in your code" sorry but i dont understand this sentence.... :/
__________________
==============
Sorry for my bad English









Respect: Kalcor, ******. Thank you for this great game!
Heress is offline   Reply With Quote
Old 23/12/2018, 10:48 PM   #8
AlfaSufaIndo
Big Clucker
 
Join Date: Oct 2016
Location: Jombang, East Java, Indonesia
Posts: 120
Reputation: 0
Default Re: attach

Quote:
Originally Posted by Heress View Post
"i made it like this make it like in your code" sorry but i dont understand this sentence.... :/
PHP Code:
new utilitytrailer1[MAX_PLAYERS];
new 
utilitytrailer2[MAX_PLAYERS];
new 
utilitytrailer3[MAX_PLAYERS];
new 
utilitytrailer4[MAX_PLAYERS];

new 
vehid1 NVTransportas[0] = CreateVehicle(583, -3779.2019, -1880.65605.284490.0000, -1, -1100);
new 
vehid2 NVTransportas[1] = CreateVehicle(583, -3778.9314, -1884.00425.284490.0000, -1, -1100);
new 
vehid3 NVTransportas[2] = CreateVehicle(583, -3778.3508, -1887.53135.284490.0000, -1, -1100);
new 
vehid4 NVTransportas[3] = CreateVehicle(583, -3777.9119, -1890.94585.284490.0000, -1, -1100);
//--------------------------------------------------------------------------------------------------------//
utilitytrailer1[playerid] = CreateVehicle(611, -3775.2961, -1880.64645.458490.0000, -1, -1100);
utilitytrailer2[playerid] = CreateVehicle(611, -3775.0056, -1884.05875.458490.0000, -1, -1100);
utilitytrailer3[playerid] = CreateVehicle(611, -3774.0906, -1890.97845.458490.0000, -1, -1100);
utilitytrailer4[playerid] = CreateVehicle(611, -3774.3333, -1887.62065.458490.0000, -1, -1100);
//--------------------------------------------------------------------------------------------------------//

AttachTrailerToVehicle(utilitytrailer1[playerid], vehid1);
AttachTrailerToVehicle(utilitytrailer2[playerid], vehid2);
AttachTrailerToVehicle(utilitytrailer3[playerid], vehid3);
AttachTrailerToVehicle(utilitytrailer4[playerid], vehid4); 
As Deken said
AlfaSufaIndo is offline   Reply With Quote
Old 23/12/2018, 10:55 PM   #9
AlfaSufaIndo
Big Clucker
 
Join Date: Oct 2016
Location: Jombang, East Java, Indonesia
Posts: 120
Reputation: 0
Default Re: attach

Wait, why don't you just use this?

PHP Code:
new NVTransportas[4];

NVTransportas[0] = CreateVehicle(583, -3779.2019, -1880.65605.284490.0000, -1, -1100); 
NVTransportas[1] = CreateVehicle(583, -3778.9314, -1884.00425.284490.0000, -1, -1100); 
NVTransportas[2] = CreateVehicle(583, -3778.3508, -1887.53135.284490.0000, -1, -1100); 
NVTransportas[3] = CreateVehicle(583, -3777.9119, -1890.94585.284490.0000, -1, -1100); 
AlfaSufaIndo is offline   Reply With Quote
Old 27/12/2018, 01:00 PM   #10
Heress
Huge Clucker
 
Heress's Avatar
 
Join Date: Mar 2018
Location: Lithuania
Posts: 262
Reputation: 7
Default Re: attach

Quote:
Originally Posted by AlfaSufaIndo View Post
PHP Code:
new utilitytrailer1[MAX_PLAYERS];
new 
utilitytrailer2[MAX_PLAYERS];
new 
utilitytrailer3[MAX_PLAYERS];
new 
utilitytrailer4[MAX_PLAYERS];

new 
vehid1 NVTransportas[0] = CreateVehicle(583, -3779.2019, -1880.65605.284490.0000, -1, -1100);
new 
vehid2 NVTransportas[1] = CreateVehicle(583, -3778.9314, -1884.00425.284490.0000, -1, -1100);
new 
vehid3 NVTransportas[2] = CreateVehicle(583, -3778.3508, -1887.53135.284490.0000, -1, -1100);
new 
vehid4 NVTransportas[3] = CreateVehicle(583, -3777.9119, -1890.94585.284490.0000, -1, -1100);
//--------------------------------------------------------------------------------------------------------//
utilitytrailer1[playerid] = CreateVehicle(611, -3775.2961, -1880.64645.458490.0000, -1, -1100);
utilitytrailer2[playerid] = CreateVehicle(611, -3775.0056, -1884.05875.458490.0000, -1, -1100);
utilitytrailer3[playerid] = CreateVehicle(611, -3774.0906, -1890.97845.458490.0000, -1, -1100);
utilitytrailer4[playerid] = CreateVehicle(611, -3774.3333, -1887.62065.458490.0000, -1, -1100);
//--------------------------------------------------------------------------------------------------------//

AttachTrailerToVehicle(utilitytrailer1[playerid], vehid1);
AttachTrailerToVehicle(utilitytrailer2[playerid], vehid2);
AttachTrailerToVehicle(utilitytrailer3[playerid], vehid3);
AttachTrailerToVehicle(utilitytrailer4[playerid], vehid4); 
As Deken said
OnGameModeInit dont have playerid...
__________________
==============
Sorry for my bad English









Respect: Kalcor, ******. Thank you for this great game!
Heress is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Need Help In attach Driver546465 Scripting Help 1 28/03/2015 01:41 AM
Attach obj Ananisiki Scripting Help 3 10/05/2014 12:31 AM
Need help for attach gekas Server Support 0 05/03/2014 10:37 AM
Attach help Er@x3r Scripting Help 4 16/01/2013 04:27 PM
/attach sorfa Help Archive 2 26/12/2009 05:08 PM


All times are GMT. The time now is 03:39 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.