SA-MP Forums Archive
[AJUDA]Funзao! - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: Non-English (https://sampforum.blast.hk/forumdisplay.php?fid=9)
+--- Forum: Languages (https://sampforum.blast.hk/forumdisplay.php?fid=33)
+---- Forum: Português/Portuguese (https://sampforum.blast.hk/forumdisplay.php?fid=34)
+---- Thread: [AJUDA]Funзao! (/showthread.php?tid=258310)



[AJUDA]Funзao! - ReDKiiL - 30.05.2011

Bom Gente Queria Perguntar As Vocкs Qual a Funзao De Dar Respawn Em Todos Carros Que Estгo Sem Motorista Obrigado!


Re: [AJUDA]Funзao! - Falcon. - 30.05.2011

Olб ReDKiiL.

pawn Код:
new bool:VeiculoOcupado[MAX_VEHICLES];
stock IsVehicleEmpty(vehicleid)
{
    if(VeiculoOcupado[vehicleid])return 0;
    else return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
    if(!strcmp(cmdtext, "/respawncarros", true) || !strcmp(cmdtext, "/rc", true))
    {
        if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, 0xFFFFFF, "Comando de uso exclusivo de administradores");
        static nome[MAX_PLAYER_NAME];
        static string[72];
        GetPlayerName(playerid, nome, sizeof nome);
        format(string, sizeof string, "Os Veнculos foram respawnados pelo administrador: %s", nome);
        SendClientMessageToAll(0xFFFFFF, string);
        for(new v = 0; v < MAX_VEHICLES; ++v)
        {
            if(VeiculoOcupado[v] == false)
            {
                SetVehicleToRespawn(v);
            }
        }
        return 1;
    }
}

public OnPlayerExitVehicle(playerid, vehicleid)
{
    VeiculoOcupado[vehicleid] = false;
    return 1;
}

public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if(newstate == 2) VeiculoOcupado[GetPlayerVehicleID(playerid)] = true;
    return 1;
}
Atenciosamente,
Falcon.