SA-MP Forums Archive
Recebendo itens quando chegar no checkpoint - 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: Recebendo itens quando chegar no checkpoint (/showthread.php?tid=270750)



Recebendo itens quando chegar no checkpoint - Felipe_Wesker - 21.07.2011

O nome ja diz.. assim olha:

Queria fazer que quando o player vб no checkpoint ele receba 1 iten de cada (small medice kit, medium medice kit e large medice kit - para quando ele abrir o inventбrio puder usar)

* Quando ele ta no checkpoint, ele ja vai recebendo vida.. mas eu quero por o script para ele ganhar esses 3 itens ae.. vou postar o define dos itens e o script.. nao sei onde incluir isto.

pawn Код:
if(IsPlayerInCheckpoint(playerid) && EstaEnRef[playerid] == 0)
        {
            //if(IsPlayerNPC(playerid)) return print("-----El NPC Price entro al CP!!");
            if(PlayerInfo[playerid][EsHumano] == 1)
            {
                if(EstaL[playerid] == 0) return 1;
                if(EstaActivado[playerid] == 0)
                {
                    printf("Jugador ID %d entro al CP y activo un contador.",playerid);
                    TCR[playerid] = SetTimerEx("ChauRefugio",1000,1,"d",playerid);//RandomEx(60000,70000)
                    EstaActivado[playerid] = 1;
                }
                EstaEnRef[playerid] = 1;
                format(string, sizeof(string), "* %s recibe municion extra y asistencia medica del campamento.", NombreEx(playerid));
                MensajeCercaDe(20.0, playerid, string, 0xFFA200FF,0xFFA200FF,0xFFA200FF,0xFFA200FF,0xFFA200FF);
                if(PlayerInfo[playerid][EsPremiun] >= 1)
                {
                    format(string, sizeof(string), "* %s recibe un nuevo chaleco blindado del campamento.", NombreEx(playerid));
                    MensajeCercaDe(20.0, playerid, string, 0xFFA200FF,0xFFA200FF,0xFFA200FF,0xFFA200FF,0xFFA200FF);
                    SetPlayerArmour(playerid,100);
                }
                if(ConHabilidadH[playerid] == 4)
                {
                    GivePlayerWeapon(playerid,18,1);
                }
                GetPlayerWeaponData(playerid,1,Armas[1][playerid],Balas[1][playerid]);
                GetPlayerWeaponData(playerid,2,Armas[2][playerid],Balas[2][playerid]);
                GetPlayerWeaponData(playerid,3,Armas[3][playerid],Balas[3][playerid]);
                GetPlayerWeaponData(playerid,4,Armas[4][playerid],Balas[4][playerid]);
                GetPlayerWeaponData(playerid,5,Armas[5][playerid],Balas[5][playerid]);
                GetPlayerWeaponData(playerid,6,Armas[6][playerid],Balas[6][playerid]);
                GetPlayerWeaponData(playerid,7,Armas[7][playerid],Balas[7][playerid]);
                GetPlayerWeaponData(playerid,8,Armas[8][playerid],Balas[8][playerid]);
                GetPlayerWeaponData(playerid,9,Armas[9][playerid],Balas[9][playerid]);
                GetPlayerWeaponData(playerid,10,Armas[10][playerid],Balas[10][playerid]);
                GetPlayerWeaponData(playerid,11,Armas[11][playerid],Balas[11][playerid]);
                GetPlayerWeaponData(playerid,12,Armas[12][playerid],Balas[12][playerid]);
                TVRefugio[playerid] = SetTimerEx("VRefugio", 1000, 1, "d", playerid);
                GivePlayerWeapon(playerid,Armas[1][playerid],Balas[1][playerid]+80);
                GivePlayerWeapon(playerid,Armas[2][playerid],Balas[2][playerid]+80);
                if(PlayerInfo[playerid][Level] >= 5)
                {
                    GivePlayerWeapon(playerid,Armas[3][playerid],Balas[3][playerid]+80);
                }
                GivePlayerWeapon(playerid,Armas[4][playerid],Balas[4][playerid]+100);
                GivePlayerWeapon(playerid,Armas[5][playerid],Balas[5][playerid]+100);
                GivePlayerWeapon(playerid,Armas[6][playerid],Balas[6][playerid]+100);
                GivePlayerWeapon(playerid,Armas[7][playerid],Balas[7][playerid]+100);
                GivePlayerWeapon(playerid,Armas[8][playerid],Balas[8][playerid]+1);
                GivePlayerWeapon(playerid,Armas[9][playerid],Balas[9][playerid]+100);
                GivePlayerWeapon(playerid,Armas[10][playerid],Balas[10][playerid]+100);
                GivePlayerWeapon(playerid,Armas[11][playerid],Balas[11][playerid]+100);
                GivePlayerWeapon(playerid,Armas[12][playerid],Balas[12][playerid]+100);
                return 1;
            }
        }
    }
    return 1;
}

forward DarExp();
public DarExp()
{
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(EstaL[i] == 1)
        {
            if(EstaEnRef[i] == 1)
            {
                new ExpRandom[MAX_PLAYERS];
                if(PlayerInfo[i][EsPremiun] == 0) ExpRandom[i] = RandomEx(4,6);
                if(PlayerInfo[i][EsPremiun] == 1) ExpRandom[i] = RandomEx(7,10);
                FlashSubeEX(i,ExpRandom[i]);
                PlayerInfo[i][ExpA] += ExpRandom[i];
                printf("ID %d recibio %d de Experiencia Human",i,ExpRandom[i]);
                PlayerInfo[i][CPS] ++;
            }
        }
    }
    return 1;
}

forward ChauRefugio(playerid);
public ChauRefugio(playerid)
{
    if(PlayerInfo[playerid][EsHumano] == 1 || Equipo[playerid] == 1)
    {
        if(IsPlayerInCheckpoint(playerid))
        {
            SegundoSeVaCP ++;
            printf("Segundos %d",SegundoSeVaCP);
            if(SegundoSeVaCP >= MAX_SEGS)
            {
                DarExp();
                TerminoRefugio();
                KillTimer(TCR[playerid]);
            }
        }
    }
    return 1;
}

stock TerminoRefugio()
{
    new string[256];
    EstaActivadoCP = 0;
    SegundoSeVaCP = 0;
    NCPActivado = 0;
    CPTotales ++;
    printf("Termino el CP %d",CPTotales);
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        DisablePlayerCheckpoint(i);
        format(string,sizeof(string),"~g~El refugio termino!");
        GameTextForPlayer(i,string,4500,3);
        EstaEnRef[i] = 0;
        KillTimer(TCR[i]);
        EstaActivado[i] = 0;
        SendClientMessage(i,0xFF0000FF,"El Campamento se levanto...");
    }
    if(CPTotales >= CPParaGanar)
    {
        Ganador = 1;
        ActivarTFinRonda();
        return 1;
    }
    new TiempoCP = RandomEx(240000,300000);
    SetTimer("ActivarCPRef",TiempoCP,0);
    return 1;
}

forward VRefugio(playerid);
public VRefugio(playerid)
{
    if(IsPlayerInCheckpoint(playerid))
    {
        if(PlayerInfo[playerid][EsHumano] == 1 || Equipo[playerid] == 1)
        {
            new Float:Vida;
            GetPlayerHealth(playerid,Vida);
            PlayerInfo[playerid][EstaInfectado] = 0;
            if(Vida > 100)
            {
                SetPlayerHealth(playerid,100);
            }
            else
            {
                SetPlayerHealth(playerid,Vida+2.5);
                return 1;
            }
        }
    }
    return 1;
}
Aqui o nome dos itens:

pawn Код:
MedK
Pil
Bengalas
Espero que tenham entendido