Car deleting/despawning ?? - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Car deleting/despawning ?? (
/showthread.php?tid=262664)
Car deleting/despawning ?? -
lawonama - 18.06.2011
Hello all, i have this code:
PHP код:
new veh;
if(IsPlayerInAnyVehicle(playerid))
{
SendClientMessage(playerid, 0xFFFFFFFF, "You are already in a vehicle, leave your car to spawn a new one.");
}
else
veh = CreateVehicle(415, 2135.12, -2552.65, 13.55, 90, 0, 0, 100000000000000000000000000);
PutPlayerInVehicle(playerid,veh,0);
SetCameraBehindPlayer(playerid);
And i have:
PHP код:
public OnPlayerExitVehicle(playerid, vehicleid)
{
new vehicleid2 = GetPlayerVehicleID(playerid);
DestroyVehicle(vehicleid2);
return 1;
}
But i want, when he exits the vehicle, the car mustn't spawn again. It must despawn/go away completely. But it just re-spawns when he exits.
Re: Car deleting/despawning ?? -
sleepysnowflake - 18.06.2011
FOR THE LOVE OF GOD, LEARN TO CONSULT THE WIKIPEDIA FIRST AND TRY EXPERIMENT A BIT!
Re: Car deleting/despawning ?? -
lawonama - 18.06.2011
Berlovan... FOR THE LOVE OF GOD, READ MY PROBLEM!
DestroyVehicle(vehicleid2);
I ALREADY TRIED but dont work -.-
Re: Car deleting/despawning ?? -
lawonama - 18.06.2011
Nevermind i already fixed it on my own.
Re: Car deleting/despawning ?? -
sleepysnowflake - 18.06.2011
pawn Код:
new UsualCar; // Top of script
UsualCar = CreateVehicle(415, 2135.12, -2552.65, 13.55, 90, 0, 0, 100000000000000000000000000); //OnGameModeInit
/////////////////////////////////// [ Your Code ] ////////////////////////////////////////////////////
if(IsPlayerInAnyVehicle(playerid))
{
SendClientMessage(playerid, 0xFFFFFFFF, "You are already in a vehicle, leave your car to spawn a new one.");
}
else
PutPlayerInVehicle(playerid,UsualCar,0);
SetCameraBehindPlayer(playerid);
////////////////////////////////////////////////// [ Sum Code ] //////////////////////////////////////////////////
public OnPlayerExitVehicle(playerid, vehicleid)
{
if(vehicleid == UsualCar)
{
DestroyVehicle(UsualCar);
}
return 1;
}
Try this.
Re: Car deleting/despawning ?? -
lawonama - 18.06.2011
I already fixed that one. But got a problem with this one:
PHP код:
public OnVehicleDeath(vehicleid, killerid)
{
new vehicleid3 = GetPlayerVehicleID(killerid);
DestroyVehicle(vehicleid3);
return 1;
}
It wont destroy.
Re: Car deleting/despawning ?? -
sleepysnowflake - 18.06.2011
Try mine.
Re: Car deleting/despawning ?? -
Madsen - 18.06.2011
Quote:
Originally Posted by Berlovan
pawn Код:
new UsualCar; // Top of script
UsualCar = CreateVehicle(415, 2135.12, -2552.65, 13.55, 90, 0, 0, 100000000000000000000000000); //OnGameModeInit
/////////////////////////////////// [ Your Code ] ////////////////////////////////////////////////////
if(IsPlayerInAnyVehicle(playerid)) { SendClientMessage(playerid, 0xFFFFFFFF, "You are already in a vehicle, leave your car to spawn a new one."); } else PutPlayerInVehicle(playerid,UsualCar,0); SetCameraBehindPlayer(playerid); ////////////////////////////////////////////////// [ Sum Code ] //////////////////////////////////////////////////
public OnPlayerExitVehicle(playerid, vehicleid) { if(vehicleid == UsualCar) { DestroyVehicle(UsualCar); } return 1; }
Try this.
|
so with this code you can destroy all vehicles with the variable usualcar or is it only 1?
Re: Car deleting/despawning ?? -
lawonama - 19.06.2011
But Berlovan, in my script you can spawn that car with a menu. If someone destroys it all will get destroyed. And there are also 4-5 cars more, is there something like if no one drives the car, it will get destroyed?