SA-MP Forums Archive
Reset 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: Reset Cars (/showthread.php?tid=236124)



Reset Cars - Sepelin - 06.03.2011

Could someone help me with this?

I want to make so those cars people are driving wont reset
heres the code i use.

PHP код:
if(strcmp(cmd"/resetcars"true) == 0)
    {
        if(
IsPlayerConnected(playerid))
        {
            if(
PlayerInfo[playerid][pAdmin] >= 4)
            {
                
format(stringsizeof(string), "All cars have been respawned by admin");
                for(new 
ii<MAX_PLAYERSi++)
                {
                    if(
IsPlayerConnected(i) == 1)
                    {
                        
SendClientMessage(iCOLOR_LIGHTBLUEstring);
                    }
                }
                for(new 
car 1car <= 1850car++)
                {
                    
SetVehicleToRespawn(car);
                }
            }
            else
            {
                
SendClientMessage(playeridCOLOR_GRAD2" You are not authorized to use this command.");
                return 
1;
            }
        }
        return 
1;
    } 



Re: Reset Cars - Hashski - 07.03.2011

pawn Код:
if(strcmp(cmd, "/resetcars", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            if(PlayerInfo[playerid][pAdmin] >= 4)
            {
                format(string, sizeof(string), "INFO: All unused vehicles have been respawned.");
                for(new i; i<MAX_PLAYERS; i++)
                {
                    if(IsPlayerConnected(i) == 1)
                    {
                        SendClientMessage(i, COLOR_LIGHTBLUE, string);
                    }
                }
new bool:unwanted[CAR_AMOUNT];
            foreach (Player,player)
            {
                if(IsPlayerInAnyVehicle(player)) { unwanted[GetPlayerVehicleID(player)]=true; }
            }
            for(new car = 0; car < MAX_VEHICLES; car++)
            {
                if(!unwanted[car])
                {
                    RespawnAllCars(car);
                }
            }
                new bool:unwanted[MAX_VEHICLES];
                for(new c =0; c < MAX_VEHICLES ;c++)
                {
                    if(!unwanted[c])
                    {
                        SetVehicleToRespawn(c);
                    }
                }
            }
            else
            {
                SendClientMessage(playerid, COLOR_GRAD2, "WARNING: You do not have access to this command");
                return 1;
            }
        }
        return 1;
    }
Suggest you move to ZCMD.


Re: Reset Cars - Sepelin - 07.03.2011

its still reseting all cars


Re: Reset Cars - Davz*|*Criss - 07.03.2011

atleast try ur self making.


Re: Reset Cars - Hashski - 07.03.2011

Saw my mistake was tired last nighte HERE, get foreach.
pawn Код:
if(strcmp(cmd, "/resetcars", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            if(PlayerInfo[playerid][pAdmin] >= 4)
            {
                format(string, sizeof(string), "INFO: All unused vehicles have been respawned.");
                for(new i; i<MAX_PLAYERS; i++)
                {
                    if(IsPlayerConnected(i) == 1)
                    {
                        SendClientMessage(i, COLOR_LIGHTBLUE, string);
                    }
                }
                new bool:unwanted[CAR_AMOUNT];
                foreach (Player,player)
                {
                    if(IsPlayerInAnyVehicle(player)) { unwanted[GetPlayerVehicleID(player)]=true; }
                }
                for(new car = 0; car < MAX_VEHICLES; car++)
                {
                    if(!unwanted[car])
                    {
                        RespawnAllCars(car);
                    }
                }
            }
            else
            {
                SendClientMessage(playerid, COLOR_GRAD2, "WARNING: You do not have access to this command");
                return 1;
            }
        }
        return 1;
    }



Re: Reset Cars - Sepelin - 07.03.2011

Quote:
Originally Posted by Hashski
Посмотреть сообщение
Saw my mistake was tired last nighte HERE, get foreach.
pawn Код:
if(strcmp(cmd, "/resetcars", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            if(PlayerInfo[playerid][pAdmin] >= 4)
            {
                format(string, sizeof(string), "INFO: All unused vehicles have been respawned.");
                for(new i; i<MAX_PLAYERS; i++)
                {
                    if(IsPlayerConnected(i) == 1)
                    {
                        SendClientMessage(i, COLOR_LIGHTBLUE, string);
                    }
                }
                new bool:unwanted[CAR_AMOUNT];
                foreach (Player,player)
                {
                    if(IsPlayerInAnyVehicle(player)) { unwanted[GetPlayerVehicleID(player)]=true; }
                }
                for(new car = 0; car < MAX_VEHICLES; car++)
                {
                    if(!unwanted[car])
                    {
                        RespawnAllCars(car);
                    }
                }
            }
            else
            {
                SendClientMessage(playerid, COLOR_GRAD2, "WARNING: You do not have access to this command");
                return 1;
            }
        }
        return 1;
    }
Thanks it works