Reset cars
#1

Hi guys, i need code like this that reset cars witch don't uses and it will reset after every 1 hour thanks

Quote:

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;
}

Reply
#2

pawn Код:
public OnGameModeInit()
{
    SetTimer("respawncars", 3600000, true);
    return 1;
}

forward respawncars();
public respawncars()
{
    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);
        }
    }
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)