Destroy Object help - 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: Destroy Object help (
/showthread.php?tid=325685)
Destroy Object help -
Gooday - 14.03.2012
pawn Код:
//Lightbar Lighting CMD
CMD:lightflashonwe(playerid,params[]){// admin
if(GetPVarInt(playerid,"Lights")>0)
{
SetPVarInt(playerid,"Lights",0);
if(IsValidObject(GetPVarInt(playerid,"Siren1")))
{
DestroyObject(GetPVarInt(playerid,"Siren1"));
SendClientMessage(playerid, COLOR_LIGHTBLUE,"[INFO]Lightbar lighting deactivated");
}
if(IsValidObject(GetPVarInt(playerid,"Siren2")))
{
DestroyObject(GetPVarInt(playerid,"Siren2"));
}
}
else
{
SetPVarInt(playerid,"Lights",1);
SetPVarInt(playerid,"OB1",CreateObject(18646,0,0,0,0,0,0,200));
SetPVarInt(playerid,"OB2",CreateObject(18646,0,0,0,0,0,0,200));
AttachObjectToVehicle(GetPVarInt(playerid,"OB1"),GetPlayerVehicleID(playerid),-0.4000,-0.2000,0.8500,0.0000,0.0000,0.0000);
AttachObjectToVehicle(GetPVarInt(playerid,"OB2"),GetPlayerVehicleID(playerid),00.4000,-0.2000,0.8500,0.0000,0.0000,0.0000);
}
return 1;
}
All works fine but when i exit a vehicle the objets got removed, how i can let them remain until I re type /Lightflashon +REP
Re: Destroy Object help -
Tanush123 - 14.03.2012
The reason is because you did
Try to make the vehicles in a variable then try to see
Re: Destroy Object help -
Gooday - 14.03.2012
Sorry coulf you post a example?
Re: Destroy Object help -
Tanush123 - 14.03.2012
Well something like this in your script
pawn Код:
new mycar[MAX_PLAYERS];
mycar[playerid] = GetPlayerVehicleID(playerid);
AttachObjectToVehicle(GetPVarInt(playerid,"OB1"),mycar[playerid],-0.4000,-0.2000,0.8500,0.0000,0.0000,0.0000);
AttachObjectToVehicle(GetPVarInt(playerid,"OB2"),mycar[playerid],00.4000,-0.2000,0.8500,0.0000,0.0000,0.0000);
i think maybe this will work or not
Re: Destroy Object help -
Gooday - 14.03.2012
Not work