SA-MP Forums Archive
All cars respawn - 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: All cars respawn (/showthread.php?tid=147059)



All cars respawn - Bleach1 - 10.05.2010

Hey, i need all cars in server respawn command.


Re: All cars respawn - Mike Garber - 10.05.2010

pawn Код:
// TOP OF YOUR SCRIPT
#define TOTAL_VEHICLES  700 // Define how many cars you have


// INSIDE THE COMMAND
for(new i = 1; i < TOTAL_VEHICLES; i ++)
{
SetVehicleToRespawn(i);
}
You can customize the command how you want.
I might have made a mistake, I'm kinda busy and not at home right now.


Re: All cars respawn - Norck - 10.05.2010

Quote:
Originally Posted by mavtias
I might have made a mistake, I'm kinda busy and not at home right now.
Yes, there is a mistake lol, it should be:
pawn Код:
for(new i = 1; i <= TOTAL_VEHICLES; i ++)// '<=' not just '<'
{
SetVehicleToRespawn(i);
}
Otherwise, last vehicle will not be respawned


Re: All cars respawn - westre - 10.05.2010

pawn Код:
for(new i = 0; i < TOTAL_VEHICLES; i ++)
{
SetVehicleToRespawn(i);
}
Counting starts from vehicle ID 0, so vehicle ID 0 to ID 699 is in total 700, thus respawning all the vehicles.


Re: All cars respawn - Norck - 10.05.2010

Quote:
Originally Posted by WESTre
pawn Код:
for(new i = 0; i < TOTAL_VEHICLES; i ++)
{
SetVehicleToRespawn(i);
}
Counting starts from vehicle ID 0, so vehicle ID 0 to ID 699 is in total 700, thus respawning all the vehicles.
No, counting starts from vehicle ID 1...


Re: All cars respawn - Infinitas - 29.10.2010

How would i go about putting this in command form.


Re: All cars respawn - Toni - 29.10.2010

pawn Код:
if(!strcmp(cmdtext, "/respawnallcars", true))
{
    for(new v = 0; v <= MAX_VEHICLES; v++)
    {
        SetVehicleToRespawn(v);
    }
    return 1;
}
I don't think you need to use another macro just for vehicles. Just use MAX_VEHICLES.

Edit,

It does start from 0.

I tested it under OnGmInit, so when I loaded it, I got 2000 numbers.

Код:
----------
Loaded log file: "server_log.txt".
----------

SA-MP Dedicated Server
----------------------
v0.3b R2, ©2005-2010 SA-MP Team

[19:15:06] filterscripts = ""  (string)
[19:15:06] 
[19:15:06] Server Plugins
[19:15:06] --------------
[19:15:06]  Loading plugin: Streamer
[19:15:06] 

*** Streamer Plugin v2.5 by Incognito loaded ***

[19:15:06]   Loaded.
[19:15:06]  Loading plugin: mysql
[19:15:06]  SA:MP MySQL Plugin v2.0 Loaded.
[19:15:06]   Loaded.
[19:15:06] [MySQL] Thread running. Threadsafe: Yes.
[19:15:06]  Loading plugin: sscanf
[19:15:06] 

[19:15:06]  ===============================

[19:15:06]       sscanf plugin loaded.     

[19:15:06]    © 2009 Alex "******" Cole

[19:15:06]  ===============================

[19:15:06]   Loaded.
[19:15:06]  Loaded 3 plugins.

[19:15:06] 
[19:15:06] Filter Scripts
[19:15:06] ---------------
[19:15:06]   Loaded 0 filter scripts.

[19:15:06] [MySQL] Connected (0) to root @ localhost via TCP/IP.
[19:15:06] [MySQL] Version 5.1.41.
[19:15:06] 0
[19:15:06]....
[19:15:06]2000
Didn't want to post the entire 2000 lines.