All cars respawn
#1

Hey, i need all cars in server respawn command.
Reply
#2

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.
Reply
#3

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
Reply
#4

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.
Reply
#5

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...
Reply
#6

How would i go about putting this in command form.
Reply
#7

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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)