PDA

View Full Version : Object being attached to vehicle but don't deattach.


DJGama101
05/04/2012, 08:11 PM
Hello i have problem. Object attach to vehicle but when i press "H" again it attach again. It should remove these two objects on pressing again "H". Code


if (GetVehicleModel(GetPlayerVehicleID(playerid)) == 525)
{
siren1 = CreateObject(19294,2001.195679, 1547.113892, 14.283400, 0.0, 0.0, 96.0, 250.0);
siren2 = CreateObject(19294,2001.195679, 1547.113892, 14.283400, 0.0, 0.0, 96.0, 250.0);
if (holowanie[playerid]==0) {
new vehicleid = GetPlayerVehicleID(playerid);
AttachObjectToVehicle(siren1, vehicleid, -0.6, -0.4, 1.5, 0.0, 0.0, 0.0);
AttachObjectToVehicle(siren2, vehicleid, 0.6, -0.4, 1.5, 0.0, 0.0, 0.0);
holowanie[playerid]=1;
SendClientMessage(playerid, JasnyNiebieski, "ttt");
return 1;
}
if (holowanie[playerid]==1) {
AttachObjectToVehicle(siren1, 99999, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0);
AttachObjectToVehicle(siren2, 99999, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0);
holowanie[playerid]=0;
SendClientMessage(playerid, JasnyNiebieski, "zzz");
return 1;
}
}

TzAkS.
05/04/2012, 08:22 PM
Try this


if (GetVehicleModel(GetPlayerVehicleID(playerid)) == 525)
{
siren1 = CreateObject(19294,2001.195679, 1547.113892, 14.283400, 0.0, 0.0, 96.0, 250.0);
siren2 = CreateObject(19294,2001.195679, 1547.113892, 14.283400, 0.0, 0.0, 96.0, 250.0);
if (holowanie[playerid]==0) {
new vehicleid = GetPlayerVehicleID(playerid);
AttachObjectToVehicle(siren1, vehicleid, -0.6, -0.4, 1.5, 0.0, 0.0, 0.0);
AttachObjectToVehicle(siren2, vehicleid, 0.6, -0.4, 1.5, 0.0, 0.0, 0.0);
holowanie[playerid]=1;
SendClientMessage(playerid, JasnyNiebieski, "ttt");
return 1;
}
if (holowanie[playerid]==1)
{
DestroyObject(siren1);
DestroyObject(siren2);
holowanie[playerid]=0;
SendClientMessage(playerid, JasnyNiebieski, "zzz");
return 1;
}
}