[HELP] How to stop spawned car from respawing - 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: [HELP] How to stop spawned car from respawing (
/showthread.php?tid=359784)
[HELP] How to stop spawned car from respawing -
detter - 15.07.2012
Title says it...
I tryed to make it but i just cant grasp it!
my spawn car cmd...
Код:
CMD:carspawn(playerid ,params[])
{
new string[128];
new carID ,color1 ,color2;
new Float:x,Float:y,Float:z;
if ( pInfo[playerid][admin] >= 5 )
{
if (!sscanf(params ,"iii" ,carID ,color1 ,color2) )
{
if ( carID >= 400 && carID <= 611 )
{
GetPlayerPos(playerid ,x ,y,z);
CreateVehicle(carID ,x - 1,y - 2,z ,90,color1 ,color2 ,-1);
spawned_car_count++;
format(string ,sizeof(string) ,"You spawned vehicle with ID %i" ,carID);
SCM(playerid ,COLOR_LIME ,string);
}
else return SCM(playerid ,COLOR_ORANGE ,"There isn't vehicle with that ID! (400 - 611)");
}
else return SCM(playerid ,COLOR_WHITE ,"USE: /spawnCar [vehicle ID] [color 1] [color 2]");
}
else return SCM(playerid ,COLOR_ORANGE ,"You are not an admin!");
return 1;
}
Re: [HELP] How to stop spawned car from respawing -
Dan. - 15.07.2012
It should work.. because -1 respawn time should mean it will never respawn. But try this:
On top of your script:
pawn Код:
new cSpawned[MAX_VEHICLES];
Your new CMD:
pawn Код:
CMD:carspawn(playerid ,params[])
{
new string[128];
new carID ,color1 ,color2;
new Float:x,Float:y,Float:z;
if ( pInfo[playerid][admin] >= 5 )
{
if (!sscanf(params ,"iii" ,carID ,color1 ,color2) )
{
if ( carID >= 400 && carID <= 611 )
{
new id;
GetPlayerPos(playerid ,x ,y,z);
new car = CreateVehicle(carID ,x - 1,y - 2,z ,90,color1 ,color2 ,-1);
PutPlayerInVehicle(playerid, car, 0);
id = GetPlayerVehicleID(playerid);
cSpawned[id] = 1;
spawned_car_count++;
format(string ,sizeof(string) ,"You spawned vehicle with ID %i" ,carID);
SCM(playerid ,COLOR_LIME ,string);
}
else return SCM(playerid ,COLOR_ORANGE ,"There isn't vehicle with that ID! (400 - 611)");
}
else return SCM(playerid ,COLOR_WHITE ,"USE: /spawnCar [vehicle ID] [color 1] [color 2]");
}
else return SCM(playerid ,COLOR_ORANGE ,"You are not an admin!");
return 1;
}
And put this into your code:
pawn Код:
public OnVehicleSpawn(vehicleid)
{
if(cSpawned[vehicleid] = 1)
{
DestroyVehicle(vehicleid);
}
return 1;
}
Re: [HELP] How to stop spawned car from respawing -
detter - 15.07.2012
it seems to be working , thanks mate!