SA-MP Forums Archive
[FilterScript] Sistema de hospital - 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)
+----- Forum: Lançamentos/Releases (https://sampforum.blast.hk/forumdisplay.php?fid=56)
+----- Thread: [FilterScript] Sistema de hospital (/showthread.php?tid=390248)



Sistema de hospital - Rodney Francalim - 05.11.2012

Rodney Francalim

FilterScripts
••••••••••••••••••••••••••••••••••••••••••••••••••

1: Descriзгo
- Mais uma vez, tнtulo auto-explicativo. Й um simples sistema de hospital onde, assim que o jogador morre, ele serб teleportado para um interior de hospital (jб com os objetos no FS), e lб o mesmo serб recuperado gradativamente (pode-se notar a barra de HP quando ele estб na maca) e apуs a recuperaзгo o jogador serб teleportado para a sala de espera no prуprio hospital, onde este se localiza em Los Santos, Market (acho). E tambйm tem um pronto-socorro em que o jogador pode usar o /curarme, e recuperar seu HP, mas o jogador precisa ter menos da metade + 1 do mбximo de HP, ou seja, de 50 pra baixo, e o HP nгo serб recuperado totalmente, serб o valor atual do HP mais o valor atual do HP dividido por um nъmero aleatуrio de 1 a 5. Exemplo: Se o jogador tem 30 de HP, quando ele digitar /curarme, serб 30 + 30/x, em que, quanto menor o x, maior serб a recuperaзгo, em que x й diferente de 0.

- Lista de comandos:
• /entrar
• /sair
• /curarme

2: Do que precisaremos?
- ZCMD
- sscanf2

3: Imagens
- Quando o jogador morre

'-> NOTA:: Se vocк quer mais imagens do hospital, clique neste link

4: Cуdigo
pawn Код:
#include <a_samp>
#include <zcmd>
#include <sscanf2>

new bool:CuraRapida[MAX_PLAYERS] = true;
new bool:Morreu[MAX_PLAYERS] = false;

new TempoRecuperandoSe;

new TempoHospital[MAX_PLAYERS] = 0;

new Float:MacaAposMorrer[6][4] = {
            {1159.7764, -1305.0938, 9281.3076, 95.8811},
            {1161.3806, -1305.1771, 9281.3076, 88.9876},
            {1163.3702, -1305.0962, 9281.3076, 91.7352},
            {1165.2333, -1305.1454, 9281.3076, 91.2044},
            {1166.9817, -1305.3794, 9281.3076, 90.8186},
            {1168.7142, -1305.3842, 9281.3076, 90.1919}
};

public OnFilterScriptInit()
{
    print("\n\n\n          Sistema de hispital");
    print("                     Por: Rodney Francalim\n\n\n");

    TempoRecuperandoSe = SetTimer("RecuperouSe", 1000, true);

    // Hospital - Interior
    CreateObject(14595,1175.05078125,-1328.92089844,9283.52246094,0.00000000,0.00000000,0.00000000); //object(paperchase02) (1)
    CreateObject(5020,1178.11718750,-1340.39355469,9281.22070312,0.00000000,0.00000000,0.00000000); //object(mul_las) (1)
    CreateObject(5020,1178.11621094,-1340.39746094,9282.38867188,0.00000000,0.00000000,0.00000000); //object(mul_las) (2)
    CreateObject(14598,1175.03491211,-1328.92651367,9283.51562500,0.00000000,0.00000000,0.00000000); //object(paperchase_glass) (1)
    CreateObject(1523,1174.26074219,-1315.62304688,9279.56933594,0.00000000,0.00000000,0.00000000); //object(gen_doorext10) (1)
    CreateObject(1704,1170.88537598,-1333.26599121,9279.56933594,0.00000000,0.00000000,180.00000000); //object(kb_chair03) (1)
    CreateObject(1704,1167.13879395,-1325.55065918,9279.56933594,0.00000000,0.00000000,59.99938965); //object(kb_chair03) (2)
    CreateObject(1726,1169.29589844,-1324.67285156,9279.56933594,0.00000000,0.00000000,0.00000000); //object(mrk_seating2) (1)
    CreateObject(2293,1170.42285156,-1331.69628906,9279.49316406,0.00000000,0.00000000,0.00000000); //object(swk_1_fstool) (1)
    CreateObject(3383,1170.69042969,-1305.55371094,9279.56933594,0.00000000,0.00000000,270.00000000); //object(a51_labtable1_) (1)
    CreateObject(1671,1180.88574219,-1332.81640625,9280.02929688,0.00000000,0.00000000,159.99938965); //object(swivelchair_a) (1)
    CreateObject(1705,1182.30761719,-1329.62500000,9279.56933594,0.00000000,0.00000000,319.49890137); //object(kb_chair04) (1)
    CreateObject(2008,1180.47851562,-1331.94335938,9279.56933594,0.00000000,0.00000000,0.00000000); //object(officedesk1) (1)
    CreateObject(1705,1179.29589844,-1330.18066406,9279.56933594,0.00000000,0.00000000,50.74584961); //object(kb_chair04) (2)
    CreateObject(1808,1183.95117188,-1324.01953125,9279.56933594,0.00000000,0.00000000,319.99877930); //object(cj_watercooler2) (1)
    CreateObject(1808,1177.81542969,-1334.52636719,9279.54980469,0.00000000,0.00000000,265.99548340); //object(cj_watercooler2) (2)
    CreateObject(630,1179.38964844,-1324.77050781,9280.59472656,0.00000000,0.00000000,0.00000000); //object(veg_palmkb8) (1)
    CreateObject(632,1165.56054688,-1325.03710938,9280.01855469,0.00000000,0.00000000,0.00000000); //object(veg_palmkb7) (1)
    CreateObject(2245,1169.67956543,-1326.65368652,9280.30957031,0.00000000,0.00000000,0.00000000); //object(plant_pot_11) (1)
    CreateObject(2251,1167.75500488,-1331.84020996,9280.84375000,0.00000000,0.00000000,0.00000000); //object(plant_pot_20) (1)
    CreateObject(8659,1158.04785156,-1329.11425781,9280.56933594,0.00000000,0.00000000,90.00000000); //object(shbbyhswall11_lvs) (1)
    CreateObject(8659,1158.03710938,-1329.11816406,9282.56542969,0.00000000,0.00000000,90.00000000); //object(shbbyhswall11_lvs) (2)
    CreateObject(1997,1159.63012695,-1304.87231445,9279.56933594,0.00000000,0.00000000,0.00000000); //object(hos_trolley) (1)
    CreateObject(1997,1161.32995605,-1304.96093750,9279.56933594,0.00000000,0.00000000,0.00000000); //object(hos_trolley) (2)
    CreateObject(1997,1163.31799316,-1304.97705078,9279.56933594,0.00000000,0.00000000,0.00000000); //object(hos_trolley) (3)
    CreateObject(1997,1165.15136719,-1304.99511719,9279.56933594,0.00000000,0.00000000,0.00000000); //object(hos_trolley) (4)
    CreateObject(1997,1166.90063477,-1305.08386230,9279.56933594,0.00000000,0.00000000,0.00000000); //object(hos_trolley) (5)
    CreateObject(1997,1168.62402344,-1305.17089844,9279.56933594,0.00000000,0.00000000,0.00000000); //object(hos_trolley) (6)
    CreateObject(1663,1161.26855469,-1340.80761719,9280.03613281,0.00000000,0.00000000,129.99572754); //object(swivelchair_b) (1)
    CreateObject(2009,1161.20410156,-1339.68261719,9279.56933594,0.00000000,0.00000000,270.00000000); //object(officedesk2l) (1)
    CreateObject(2182,1160.41992188,-1342.13964844,9279.76660156,0.00000000,0.00000000,90.00000000); //object(med_office5_desk_1) (1)
    CreateObject(1727,1164.51782227,-1340.79711914,9279.57617188,0.00000000,0.00000000,239.99818420); //object(mrk_seating2b) (1)
    CreateObject(1727,1163.76611328,-1338.29174805,9279.56933594,0.00000000,0.00000000,309.99572754); //object(mrk_seating2b) (2)
    CreateObject(1808,1162.06445312,-1342.57324219,9279.54980469,0.00000000,0.00000000,185.99304199); //object(cj_watercooler2) (3)
    CreateObject(2921,1177.98413086,-1345.60217285,9282.83789062,0.00000000,0.00000000,330.00000000); //object(kmb_cam) (1)
    CreateObject(2921,1158.33374023,-1324.11962891,9282.86621094,0.00000000,0.00000000,189.99633789); //object(kmb_cam) (2)
    CreateObject(2921,1158.86291504,-1342.73022461,9282.51660156,0.00000000,0.00000000,259.99206543); //object(kmb_cam) (3)
    CreateObject(2921,1183.56713867,-1323.83264160,9282.76855469,0.00000000,0.00000000,89.99145508); //object(kmb_cam) (4)
    CreateObject(2921,1171.99426270,-1316.56140137,9282.96093750,0.00000000,0.00000000,139.98901367); //object(kmb_cam) (5)
    CreateObject(3391,1175.07373047,-1305.24548340,9279.56933594,0.00000000,0.00000000,0.00000000); //object(a51_sdsk_ncol2_) (1)
    CreateObject(3390,1175.03552246,-1308.79077148,9279.56933594,0.00000000,0.00000000,0.00000000); //object(a51_sdsk_ncol1_) (1)
    CreateObject(3395,1173.14868164,-1304.05212402,9279.56933594,0.00000000,0.00000000,90.00000000); //object(a51_sdsk_3_) (1)
    CreateObject(1726,1165.95532227,-1333.03588867,9279.56933594,0.00000000,0.00000000,90.00000000); //object(mrk_seating2) (3)
    CreateObject(2370,1167.54455566,-1332.17419434,9279.16308594,0.00000000,0.00000000,0.00000000); //object(shop_set_1_table) (1)
    CreateObject(2370,1169.28820801,-1327.00036621,9279.18847656,0.00000000,0.00000000,0.00000000); //object(shop_set_1_table) (2)
    CreateObject(2855,1168.29309082,-1331.32019043,9280.00976562,0.00000000,0.00000000,0.00000000); //object(gb_bedmags05) (1)
    CreateObject(2852,1170.00463867,-1326.30114746,9280.03515625,0.00000000,0.00000000,0.00000000); //object(gb_bedmags02) (1)
    CreateObject(1997,1160.23461914,-1335.54052734,9279.56933594,0.00000000,0.00000000,90.00000000); //object(hos_trolley) (6)
    CreateObject(1240,1174.99108887,-1315.88146973,9282.52148438,0.00000000,0.00000000,0.00000000); //object(health) (1)
    CreateObject(1241,1164.36645508,-1333.81457520,9282.55859375,0.00000000,0.00000000,0.00000000); //object(adrenaline) (1)

    AddStaticPickup(1318, 1, 1172.5526, -1323.2614, 15.4028, -1);                                                  // ENTRAR NO HOSPITAL

    Create3DTextLabel("Hospital de Los Santos\n/entrar", 0x008080FF, 1172.5526, -1323.2614, 15.4028, 20.0, 0, 0);   // ENTRAR NO HOSPITAL
    Create3DTextLabel("Los Santos\n/sair", 0x008080FF, 1177.3695, -1340.4095, 9280.5693, 20.0, 0, 0);               // SAIR DO HOSPITAL
    Create3DTextLabel("Cura rбpida\n/curarme", 0x008080FF, 1163.2344, -1340.1019, 9280.5693, 20.0, 0, 0);           // CURA RБPIDA
    return 1;
}

public OnPlayerConnect(playerid)
{
    SendClientMessage(playerid, 0x008080FF, "Este servidor usa o sistema de hospital, por: Rodney Francalim");
    return 1;
}

public OnPlayerSpawn(playerid)
{
    SendClientMessage(playerid, 0x008080FF, "Este servidor usa o sistema de hospital, por: Rodney Francalim");
    if(Morreu[playerid])
    {
        SetPlayerHealth(playerid, 5.0);
        new randmaca = random(sizeof(MacaAposMorrer));
        SetPlayerPos(playerid, MacaAposMorrer[randmaca][0], MacaAposMorrer[randmaca][1], MacaAposMorrer[randmaca][2]);
        SetPlayerFacingAngle(playerid, MacaAposMorrer[randmaca][3]);
        SetPlayerInterior(playerid, 1);
        ClearAnimations(playerid);
        ApplyAnimation(playerid, "CRACK", "crckdeth2", 4.0, 1, 0, 0, 0, 0);
        SetPlayerCameraPos(playerid, 1159.3287, -1314.6178, 9282.0693);
        SetPlayerCameraLookAt(playerid, 1164.3419, -1305.1895, 9280.5693);
        GameTextForPlayer(playerid, "~r~Voce sera recuperado em alguns segundos~n~Aguarde", 60000, 4);
        return 1;
    }
    return 1;
}

CMD:entrar(playerid)
{
    if(IsPlayerInRangeOfPoint(playerid, 1.0, 1172.5526, -1323.2614, 15.4028))
    {
        SetPlayerInterior(playerid, 1);
        SetPlayerPos(playerid, 1177.3695, -1340.4095, 9280.5693);
        GameTextForPlayer(playerid, "~r~Hospital", 5000, 1);
        SetPlayerFacingAngle(playerid, 90);
        SetCameraBehindPlayer(playerid);
    }
    else SendClientMessage(playerid, 0xA9C4E4AA, "{FF0000}(ERRO){A9C4E4}: Vocк nгo estб em nenhuma porta.");
    return 1;
}

CMD:sair(playerid)
{
    if(IsPlayerInRangeOfPoint(playerid, 1.0, 1177.3695, -1340.4095, 9280.5693))
    {
        SetPlayerInterior(playerid, 0);
        SetPlayerPos(playerid, 1172.5526, -1323.2614, 15.4028);
        GameTextForPlayer(playerid, "~w~Los Santos", 5000, 1);
        SetPlayerFacingAngle(playerid, 270);
        SetCameraBehindPlayer(playerid);
    }
    else SendClientMessage(playerid, 0xA9C4E4AA, "{FF0000}(ERRO){A9C4E4}: Vocк nгo estб em nenhuma porta.");
    return 1;
}

CMD:curarme(playerid)
{
    new Float:vida;
    GetPlayerHealth(playerid, vida);
    if(!IsPlayerInRangeOfPoint(playerid, 2.0, 1163.2344, -1340.1019, 9280.5693)) return SendClientMessage(playerid, 0xA9C4E4AA, "{FF0000}(ERRO){A9C4E4}: Vocк precisa estar no pronto-socorro para curar-se.");
    if(!CuraRapida[playerid]) return SendClientMessage(playerid, 0xA9C4E4AA, "{FF0000}(ERRO){A9C4E4}: Vocк jб se curou hб menos de 5 minutos. Volte mais tarde.");
    if(vida > 50) return SendClientMessage(playerid, 0xA9C4E4AA, "{FF0000}(ERRO){A9C4E4}: Vocк nгo estб ferido o suficiente para curar-se.");
    else
    {
        new denominador = random(4);
        SetPlayerHealth(playerid, vida + vida/denominador+1);
        SetTimer("BlockCurarMe", 300000, false);
        CuraRapida[playerid] = false;
    }
    return 1;
}

public OnPlayerDeath(playerid, killerid, reason)
{
    Morreu[playerid] = true;
    return 1;
}

forward BlockCurarMe(playerid);
public BlockCurarMe(playerid) return CuraRapida[playerid] = true, 1;

forward RecuperouSe();
public RecuperouSe()
{
    for(new p = 0; p < MAX_PLAYERS; p++)
    {
        if(Morreu[p])
        {
            TempoHospital[p]++;
            new Float:vida;
            GetPlayerHealth(p, vida);
            ApplyAnimation(p, "CRACK", "crckdeth2", 4.0, 1, 0, 0, 0, 0);
            switch(TempoHospital[p])
            {
                case 1 .. 59:
                {
                    SetPlayerHealth(p, vida+1);
                }
                case 60:
                {
                    Morreu[p] = false;
                    SendClientMessage(p, 0xA9C4E4AA, "");
                    SendClientMessage(p, 0xA9C4E4AA, "{DD2222}Mйdico{FFFFFF} diz: Vocк foi recuperado. Seja mais cuidado a partir de agora.");
                    ClearAnimations(p);
                    SetPlayerPos(p, 1175.0963, -1318.3589, 9280.5693);
                    SetCameraBehindPlayer(p);
                    SetPlayerFacingAngle(p, 177.8791);
                    SetPlayerInterior(p, 1);
                    TempoHospital[p] = 0;
                }
            }
        }
    }
    return 1;
}

public OnFilterScriptExit()
{
    KillTimer(TempoRecuperandoSe);
    return 1;
}
5: Consideraзхes finais
- Este й o primeiro FilterScript que posto aqui, espero que seja ъtil.
- Pode ter alguns bugs, como 2 jogadores estarem em uma mesma maca, ou nгo executar a animaзгo corretamente.

6: Agradecimento e crйditos
- Quero agradecer ao ****** pela criaзгo do sscanf2 ter criado o tutorial de como usб-lo.
- Tambйm ao Zeex pela criaзгo do ZCMD
- E ao alexcordeiro por ter dado a ideia.

••••••••••••••••••••••••••••••••••••••••••••••••••


Re: Sistema de hospital - vitere - 05.11.2012

te legalzin gostei simples mais ta bom 8/10 vlw.


Re: Sistema de hospital - Kon_BR - 05.11.2012

Muito bom. Cуdigo parece estar bem bonitinho igualmente com a descriзгo.


Re: Sistema de hospital - jpeg - 05.11.2012

уtimo fs. *_*


Re: Sistema de hospital - Rodney Francalim - 05.11.2012

Quote:
Originally Posted by vitere
Посмотреть сообщение
te legalzin gostei simples mais ta bom 8/10 vlw.
Obrigado.


Quote:
Originally Posted by Kon_BR
Посмотреть сообщение
Muito bom. Cуdigo parece estar bem bonitinho igualmente com a descriзгo.
Valeu.


Re: Sistema de hospital - ForT - 05.11.2012

Muito bom cara, gostei muito. rep++ =D

@Edit

Nгo to conseguindo te dar +rep =/


Re: Sistema de hospital - Rodney Francalim - 05.11.2012

Quote:
Originally Posted by jpeg
Посмотреть сообщение
уtimo fs. *_*
Valeu.


Quote:
Originally Posted by ForT
Посмотреть сообщение
Muito bom cara, gostei muito. rep++ =D

@Edit

Nгo to conseguindo te dar +rep =/
Af! e_e


Re: Sistema de hospital - mau.tito - 05.11.2012

Nгo esta ruin mas pode melhorar bastante!


Re: Sistema de hospital - Rodney Francalim - 05.11.2012

Quote:
Originally Posted by mau.tito
Посмотреть сообщение
Nгo esta ruin mas pode melhorar bastante!
OK, eu tava com umas ideias legais em mente. Acho que atualizo na prуxima versгo.


Re: Sistema de hospital - @Riichard - 05.11.2012

Estб bem legal.

Apesar de existir varios FilterScript's desses, achei o seu mais "completo".

Parabйns.