SA-MP Forums Archive
De-attach a vehicle object. - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: De-attach a vehicle object. (/showthread.php?tid=478858)



De-attach a vehicle object. - Johny32 - 01.12.2013

I want to make a command which will remove two vehicle objects, i only know how attach the objects.
I don't have a problem with this command:
Код:
if (strcmp(cmdtext, "/plsultan", true) == 0){
new sultan1 = CreateObject( 18646,0,0,0,0,0,0,80 ); // Sultan
AttachObjectToVehicle( sultan1, GetPlayerVehicleID(playerid), 0.500000, 0.299999, 0.800000, 0.000000, 0.000000, 0.000000 ); 
new sultan2 = CreateObject( 18646,0,0,0,0,0,0,80 ); // Sultan
AttachObjectToVehicle( sultan2, GetPlayerVehicleID(playerid), -0.500000, -0.799999, 0.800000, 0.000000, 0.000000, 0.000000 ); 
return 1;
}
But as i said i cant make a de-attach command to de-attach them.


Re: De-attach a vehicle object. - SilentSoul - 01.12.2013

pawn Код:
if (strcmp(cmdtext, "/plsultan", true) == 0){
SetPVarInt(playerid, "sultan1", CreateObject( 18646,0,0,0,0,0,0,80)); // Sultan
AttachObjectToVehicle( sultan1, GetPlayerVehicleID(playerid), 0.500000, 0.299999, 0.800000, 0.000000, 0.000000, 0.000000 );
SetPVarInt(playerid, "sultan2",CreateObject( 18646,0,0,0,0,0,0,80)); // Sultan
AttachObjectToVehicle(GetPVarInt(playerid, "sultan2"), GetPlayerVehicleID(playerid), -0.500000, -0.799999, 0.800000, 0.000000, 0.000000, 0.000000 );
return 1;
}
And create command to remove the objects
pawn Код:
if (strcmp(cmdtext, "/remove", true) == 0)
{
DestroyObject(GetPVarInt(playerid, "sultan1"));
DestroyObject(GetPVarInt(playerid, "sultan2"));
return 1;
}



Re: De-attach a vehicle object. - Johny32 - 01.12.2013

I had an error but Ι fixed it, thanks for the help