De-attach a vehicle object.
#1

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.
Reply
#2

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;
}
Reply
#3

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


Forum Jump:


Users browsing this thread: 1 Guest(s)