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



Respawn all cars - SydonaiCZ - 13.07.2011

Hi can someone send me plugin for respawn all cars ? like this

if(strcmp(cmd, "/respawnallcars", true) == 0 || strcmp(cmd, "/rac", true) == 0)
{

if(PlayerInfo[playerid][pAdmin] <= 2000)
{
SendClientMessage(playerid, COLOR_GRAD1, "Vous n'кtes pas autorisez a utilisй cette commande!");
return 1;
}
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "[BC] Tous les vйhicules inutilisй ont йtй respawn par %s.", sendername);
SendClientMessageToAll(COLOR_WHITE,string);
new bool:unwanted[CAR_AMOUNT];
for(new player=0; player<MAX_PLAYERS; player++)
{
if(IsPlayerInAnyVehicle(player))
{ unwanted[GetPlayerVehicleID(player)]=true; }
}
for(new car = 1; car <= MAX_VEHICULES; car++)
{
if(!unwanted[car]){SetVehicleToRespawn(car);}
}
return 1;
}


Re: Respawn all cars - LetsOWN[PL] - 13.07.2011

@Up,
why do you need new one, if you currectly have already?

BTW. I do not think, that there is any plugin, which will allow You to respawn vehicles.
You need code, like this that you've posted:

pawn Код:
if(strcmp(cmd, "/respawnallcars", true) == 0 || strcmp(cmd, "/rac", true) == 0)
{

if(PlayerInfo[playerid][pAdmin] <= 2000)
{
SendClientMessage(playerid, COLOR_GRAD1, "Vous n'кtes pas autorisez a utilisй cette commande!");
return 1;
}
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "[BC] Tous les vйhicules inutilisй ont йtй respawn par %s.", sendername);
SendClientMessageToAll(COLOR_WHITE,string);
new bool:unwanted[CAR_AMOUNT];
for(new player=0; player<MAX_PLAYERS; player++)
{
if(IsPlayerInAnyVehicle(player))
{ unwanted[GetPlayerVehicleID(player)]=true; }
}
for(new car = 1; car <= MAX_VEHICULES; car++)
{
if(!unwanted[car]){SetVehicleToRespawn(car);}
}
return 1;
}
// Edit.

I am wondering about this
pawn Код:
car <= MAX_VEHICULES
If you've not defined MAX_VEHICLUES, place instead
pawn Код:
MAX_VEHICLES
.

Everything should be OK with this.


Re: Respawn all cars - [MG]Dimi - 13.07.2011

I said sent you in PM use this one:
PHP код:
#include <a_samp> 

public OnPlayerCommandText(playerid,cmdtext[]) 

    if(
strcmp("/respawncars",cmdtext,true) == 0
    { 
        if(
IsPlayerAdmin(playerid)) 
        { 
            for(new 
iPlayer;iPlayer<MAX_PLAYERS;iPlayer++) 
            if(
IsPlayerInAnyVehicle(iPlayer) == 1
            { 
                
RemovePlayerFromVehicle(iPlayer); 
                for(new 
i;i<MAX_VEHICLES;i++) 
                
SetVehicleToRespawn(i); 
                return 
1
            } 
            for(new 
iPlayer;iPlayer<MAX_PLAYERS;iPlayer++) 
            if(
IsPlayerInAnyVehicle(iPlayer) == 0
            { 
                for(new 
i;i<MAX_VEHICLES;i++) 
                
SetVehicleToRespawn(i); 
                return 
0
            } 
            return 
1
        } 
        return 
1
    } 
    return 
0