AttachObjectToVehicle
#1

Hello every one

i want attach object to vehicle and i make


PHP код:
public OnPlayerSpawn(playerid)
{
SetTimer("CarParts",5000,0);
return 
1;
}
forward CarParts(playerid);
public 
CarParts(playerid)
{
new 
Spo;
    new 
id;
    new 
Float:xFloat:yFloat:z;
    
Spo CreateObject(1001,0,0,0,0,0,0,0);
    
id GetPlayerVehicleID(playerid);
    
AttachObjectToVehicle(Spo,id,x,y,z,0,0,0);

and its Show no error but not show in the game or the object does't show in the game except if i make it command it work but if i make it when playerspawn cuz when playerspawn he spawn in car.
Reply
#2

You need to use SetTimerEx, which will allow you to pass on more parameters. (ex: playerid and all..)

SetTimerEx("CarParts", 5000, false, "i", playerid);

And don't use x,y,z Position coords on AttachObjectToVehicle. It's "offset", not position.

AttachObjectToVehicle(Spo,id,0,0,1,0,0,0);
Reply
#3

Thanks Fixed But is there are easy way to know exactly the pos for attach the object i mean for example
AttachObjectToVehicle(spo,id,How can i know the x,and y ,and z ,0,0,0)

and i see FS but i don't want use them they make my server lag and ect.
and can i make it using SAMP Map Editor ?
Reply
#4

There is a filterscript(tool) I made, Using this, you can attach something to your vehicle then Export it to /scriptfiles/
This will create AttachObjectToVehicle Lines in a .pwn file, you'll be able to copy this to your script to use them according to your wish.

You can get my tool here: https://sampforum.blast.hk/showthread.php?tid=282883
Reply
#5

Thanks Dude this is Useful and Not make my server Lagged
+rep
Reply
#6

iPLEOMAX when i save the Object or attach object can i copy the Code or the x,y,z, ect
and put it in my gm ?

if i can then how :O ?
+Found bug
when y edit something and y exit veh Game will crash
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)