Prevent the vehicle from respawning !
#1

PHP Code:
CrearAuto(playeridmodelid)
{
new 
AutoFloatXFloatYFloatZFloatAngulo;
if(
GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
Auto GetPlayerVehicleID(playerid);
GetVehiclePos(AutoXYZ);
GetVehicleZAngle(AutoAngulo);
DestroyVehicle(Auto);
}
else
{
GetPlayerPos(playeridXYZ);
GetPlayerFacingAngle(playeridAngulo);
}
if(
Car[playerid] != 0DestroyVehicle(Car[playerid]);
Car[playerid] = CreateVehicle(modelidXYZAngulo, -1,-1, -1,-1);
PutPlayerInVehicle(playeridCar[playerid], 0);
LinkVehicleToInterior(AutoGetPlayerInterior(playerid));
SetVehicleVirtualWorld(AutoGetPlayerVirtualWorld(playerid));
return 
1;

t's the code he used.

The second last parameter of this function is assumed when it is -1 to prevent it from respawning, but it does not work.

PHP Code:
CreateVehicle(modelidXYZAngulo, -1,-1, -1,-1); 
How do I prevent it from respawning the vehicle?
Reply
#2

The respawn param is set to -1, so that's disabled.

CrearAuto is only recreating the vehicle they were in.

https://sampwiki.blast.hk/wiki/SetVehicleToRespawn check for this anywhere in your script.


What's the script doing currently, and is there anything else in the script that has DestroyVehicle, or SetVehicleToRespawn?
Reply
#3

Quote:
Originally Posted by Sew_Sumi
View Post
The respawn param is set to -1, so that's disabled.

CrearAuto is only recreating the vehicle they were in.

https://sampwiki.blast.hk/wiki/SetVehicleToRespawn check for this anywhere in your script.


What's the script doing currently, and is there anything else in the script that has DestroyVehicle, or SetVehicleToRespawn?
I do not use SetVehicleToRespawn
Reply
#4

Help me !!
Reply
#5

Check forum rules, 24 hour bumps only.

Code:
if(Car[playerid] != 0) DestroyVehicle(Car[playerid]); 
Car[playerid] = CreateVehicle(modelid, X, Y, Z, Angulo, -1,-1, -1,-1);
If anything, comment out those lines, and it may stop, but by the idea of it, it'll cause you more trouble by just removing those lines, as there's a reason that code is made the way it is.


Explain more what your issue is, as the script you have, has a system, and you, wanting to remove part of that system, will likely break it in other areas.
Reply
#6

Quote:
Originally Posted by Sew_Sumi
View Post
Check forum rules, 24 hour bumps only.

Code:
if(Car[playerid] != 0) DestroyVehicle(Car[playerid]); 
Car[playerid] = CreateVehicle(modelid, X, Y, Z, Angulo, -1,-1, -1,-1);
If anything, comment out those lines, and it may stop, but by the idea of it, it'll cause you more trouble by just removing those lines, as there's a reason that code is made the way it is.


Explain more what your issue is, as the script you have, has a system, and you, wanting to remove part of that system, will likely break it in other areas.
The problem is that when he generated a car and when he destroyed himself, he should not respawning, which he does
Reply
#7

Quote:
Originally Posted by Daynox12
View Post
The problem is that when he generated a car and when he destroyed himself, he should not respawning, which he does
If the script was made to do that, then that's what it's supposed to do. As I said, if this, being part of a system, gets changed, and then the rest of the system isn't looked at, there will be problems.

It's also not respawning, the script is recreating it, if crearcar is anything to go by.


The script, is doing this, and whoever made this, or where-ever you got it from, that topic should have some support offered in some sense, either by people that know and use the script, or by the author themselves.

You could easily comment out those 2 lines I showed, and see how that works out, but I'm very sure there'll be an issue in another area. Because even though the commenting may work, and it'll function, 'as you want it', it'll impact other areas of the script, and could lead to other issues when the players car is attempted to be found by the script elsewhere.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)