[Ajuda] Respawn
#5

pawn Код:
COMMAND:respawncarros(playerid, params[])
{
SendAdminText(playerid, "/respawncarros", params);
if (APlayerData[playerid][PlayerLevel] < 3) return 0;
ResetarVeiculos();
new Msg[126], Name[24];
GetPlayerName(playerid, Name, sizeof(Name));
format(Msg, 126, "{FFFFFF}O Adminstrador {FFFFFF}%s {FFFFFF}resetou todos os veiculos desocupados.",Name);
SendClientMessageToAll(0xFF99AADD, Msg);
return true;
}

stock ResetarVeiculos()
{
    static bool:TrailerEmUso[MAX_VEHICLES];
    new Ciclo = 1;
    for(new x = 1; x <= MAX_VEHICLES; x++)
    {
        switch(Ciclo)
        {
            case 1:
            {
                if(IsTrailerAttachedToVehicle(x))
                {
                    TrailerEmUso[GetVehicleTrailer(x) - 1] = true;
                }
            }
            case 2:
            {
                new bool:Ocupado;
                for(new y = 0, z = GetMaxPlayers(); y != z; y++)
                {
                    if(IsPlayerInVehicle(y, x))
                    {
                        Ocupado = true;
                    }
                }
                if(!Ocupado && !TrailerEmUso[x - 1])
                {
                    SetVehicleToRespawn(x);
                }
            }
            case 3:
            {
                TrailerEmUso[x - 1] = false;
            }
        }
        if(x == MAX_VEHICLES && Ciclo < 3)
        {
            x = 0;
            Ciclo++;
        }
    }
    return true;
}
Crйditos RJJJ
Reply


Messages In This Thread
Respawn - by GHLEMES - 20.06.2014, 17:49
Re: Respawn - by CrazyHelp - 20.06.2014, 18:05
Re: Respawn - by GHLEMES - 20.06.2014, 20:11
Re: Respawn - by GHLEMES - 21.06.2014, 02:14
Re: Respawn - by lHesoyaml - 21.06.2014, 10:59
Re: Respawn - by GHLEMES - 21.06.2014, 19:25
Re: Respawn - by lHesoyaml - 22.06.2014, 18:44

Forum Jump:


Users browsing this thread: 1 Guest(s)