SA-MP Forums Archive
Help Respawn all cars automatically - 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 Respawn all cars automatically (/showthread.php?tid=379301)



Help Respawn all cars automatically - razerch0 - 21.09.2012

Hi guys, I want to ask you for a code to respawn all cars automatically after a specified time. I'm Bulgarian and don't speak english perfectly.


Re: Help Respawn all cars automatically - doreto - 21.09.2012

After how long you wont cars to be restore

* sled kolko vreme da se restorant ?


Re: Help Respawn all cars automatically - [HK]Ryder[AN] - 21.09.2012

Use this code
pawn Код:
forward respawncars();
//Under OnPlayerConnect
SetTimer("respawnallcars", 1000/*change the 1000 to the time you want in milliseconds*/, false);
//NOT under OnPlayerConnect..OUTSIDE ANY callback
public respawnallcars()
{
for(new i = 1; i <= MAX_VEHICLES; i++)
{
    SetVehicleToRespawn(i);
}
return 1;
}



Re: Help Respawn all cars automatically - razerch0 - 21.09.2012

Quote:
Originally Posted by doreto
Посмотреть сообщение
After how long you wont cars to be restore

* sled kolko vreme da se restorant ?
60 seconds


Re: Help Respawn all cars automatically - razerch0 - 21.09.2012

Quote:
Originally Posted by [HK]Ryder[AN]
Посмотреть сообщение
Use this code
pawn Код:
forward respawncars();
//Under OnPlayerConnect
SetTimer("respawnallcars", 1000/*change the 1000 to the time you want in milliseconds*/, false);
//NOT under OnPlayerConnect..OUTSIDE ANY callback
public respawnallcars()
{
for(new i = 1; i <= MAX_VEHICLES; i++)
{
    SetVehicleToRespawn(i);
}
return 1;
}
This code don't work

pawn Код:
C:\Desktop\server samp\Gang-GTA\Se7 Server\Se7 Server\gamemodes\se7.pwn(1102) : error 029: invalid expression, assumed zero
C:\Desktop\server samp\Gang-GTA\Se7 Server\Se7 Server\gamemodes\se7.pwn(1102) : error 017: undefined symbol "respawncars"
C:\Desktop\server samp\Gang-GTA\Se7 Server\Se7 Server\gamemodes\se7.pwn(1106) : error 029: invalid expression, assumed zero
C:\Desktop\server samp\Gang-GTA\Se7 Server\Se7 Server\gamemodes\se7.pwn(1106) : error 017: undefined symbol "respawnallcars"
C:\Desktop\server samp\Gang-GTA\Se7 Server\Se7 Server\gamemodes\se7.pwn(1115) : warning 225: unreachable code
Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


4 Errors.



Re: Help Respawn all cars automatically - [HK]Ryder[AN] - 21.09.2012

Do you want the cars respawning after every 60 seconds?
If not(only once after the server starts) you can use the code i posted above and change 1000 to 60000


Re: Help Respawn all cars automatically - razerch0 - 21.09.2012

Quote:
Originally Posted by [HK]Ryder[AN]
Посмотреть сообщение
Do you want the cars respawning after every 60 seconds?
If not(only once after the server starts) you can use the code i posted above and change 1000 to 60000
Your pawn code don't work and have 4 errors



pawn Код:
C:\Desktop\server samp\Gang-GTA\Se7 Server\Se7 Server\gamemodes\se7.pwn(1102) : error 029: invalid expression, assumed zero
C:\Desktop\server samp\Gang-GTA\Se7 Server\Se7 Server\gamemodes\se7.pwn(1102) : error 017: undefined symbol "respawncars"
C:\Desktop\server samp\Gang-GTA\Se7 Server\Se7 Server\gamemodes\se7.pwn(1106) : error 029: invalid expression, assumed zero
C:\Desktop\server samp\Gang-GTA\Se7 Server\Se7 Server\gamemodes\se7.pwn(1106) : error 017: undefined symbol "respawnallcars"
C:\Desktop\server samp\Gang-GTA\Se7 Server\Se7 Server\gamemodes\se7.pwn(1115) : warning 225: unreachable code
Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


4 Errors.



Re: Help Respawn all cars automatically - [HK]Ryder[AN] - 21.09.2012

Srry..My Bad..use this
pawn Код:
forward respawnallcars();
//Under OnPlayerConnect
SetTimer("respawnallcars", 1000/*change the 1000 to the time you want in milliseconds*/, false);
//NOT under OnPlayerConnect..OUTSIDE ANY callback
public respawnallcars()
{
for(new i = 1; i <= MAX_VEHICLES; i++)
{
    SetVehicleToRespawn(i);
}
return 1;
}
Sorry..Silly Mistake :P


Re: Help Respawn all cars automatically - razerch0 - 21.09.2012

Quote:
Originally Posted by [HK]Ryder[AN]
Посмотреть сообщение
Srry..My Bad..use this
pawn Код:
forward respawnallcars();
//Under OnPlayerConnect
SetTimer("respawnallcars", 1000/*change the 1000 to the time you want in milliseconds*/, false);
//NOT under OnPlayerConnect..OUTSIDE ANY callback
public respawnallcars()
{
for(new i = 1; i <= MAX_VEHICLES; i++)
{
    SetVehicleToRespawn(i);
}
return 1;
}
Sorry..Silly Mistake :P
pawn Код:
C:\Desktop\server samp\Gang-GTA\Se7 Server\Se7 Server\gamemodes\se7.pwn(1089) : error 017: undefined symbol "c"
C:\Desktop\server samp\Gang-GTA\Se7 Server\Se7 Server\gamemodes\se7.pwn(1102) : error 029: invalid expression, assumed zero
C:\Desktop\server samp\Gang-GTA\Se7 Server\Se7 Server\gamemodes\se7.pwn(1102) : error 017: undefined symbol "respawnallcars"
C:\Desktop\server samp\Gang-GTA\Se7 Server\Se7 Server\gamemodes\se7.pwn(1106) : error 029: invalid expression, assumed zero
C:\Desktop\server samp\Gang-GTA\Se7 Server\Se7 Server\gamemodes\se7.pwn(1106) : error 017: undefined symbol "respawnallcars"
C:\Desktop\server samp\Gang-GTA\Se7 Server\Se7 Server\gamemodes\se7.pwn(1114) : warning 225: unreachable code
Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


5 Errors.
:S


Re: Help Respawn all cars automatically - [HK]Ryder[AN] - 21.09.2012

That should't be there..
Did you read the comments i have written. Are you sure you put the code in the correct place?