SA-MP Forums Archive
[Pedido] Ao morrer sequestrado ser preso - 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: [Pedido] Ao morrer sequestrado ser preso (/showthread.php?tid=463216)



Ao morrer sequestrado ser preso - gmstrikker - 10.09.2013

Queria deixar meu sv mais rpg, e acho q isso ajudaria mts outros rpg, ao player morrer com a variavel sequestrado automaticamente ele fica-se preso 6 hrs, alguem sabe fazer isso?

Meu sistema de sequestro
pawn Код:
//- FS criado por Bruno Pereira/DJ Bruninho. Porfavor nгo retire os creditos! - //
    //- Contato: brunopereiraa-@hotmail.com -//
    //- FS criado por Bruno Pereira/DJ Bruninho. Porfavor nгo retire os creditos! - //

    //Includes
    #include <a_samp>

    //Defines
    #define                                         FILTERSCRIPT
    #if defined                             FILTERSCRIPT
    #define MAXPLAYERS                      100
    #define COLOR_GREY                       0xBFC0C2FF
    #define COLOR_YELLOW             0xF5DEB3AA
    #define COLOR_BLUEZINHO           0x00A5FFFF
    #define COLOR_WHITE                      0xFAFAFAFF
    #define COLOR_LIGHTRED       0xFF6347AA
    #define COLOR_BLUE                        0x005FFFFF
    //NEWS
    new Sequestrado[MAXPLAYERS];
    new Amarrado[MAXPLAYERS];
    new nome[MAX_PLAYER_NAME];
    new nome2[MAX_PLAYER_NAME];
    new SaiuSeq[MAXPLAYERS];
    new FitaNele[MAXPLAYERS];

    forward ProxDetectorS(Float:radi, playerid, targetid);
    public ProxDetectorS(Float:radi, playerid, targetid)
    {
        if(IsPlayerConnected(playerid)&&IsPlayerConnected(targetid))
        {
            new Float:posx, Float:posy, Float:posz;
            new Float:oldposx, Float:oldposy, Float:oldposz;
            new Float:tempposx, Float:tempposy, Float:tempposz;
            GetPlayerPos(playerid, oldposx, oldposy, oldposz);
            GetPlayerPos(targetid, posx, posy, posz);
            tempposx = (oldposx -posx);
            tempposy = (oldposy -posy);
            tempposz = (oldposz -posz);
            if(((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
            {
                return 1;
            }
        }
        return 0;
    }

    //Public's
    public OnFilterScriptInit()
    {
        print("||| Sistema de sequestro carregado! |||");
        print("||| By Bruno Pereira / DJ Bruninho |||");
        return 1;
    }

    public OnFilterScriptExit()
    {
        print("||| Sistema de sequestro descarregado. |||");
        print("||| By Bruno Pereira / DJ Bruninho |||");

        return 1;
    }
    #endif

    public OnPlayerConnect(playerid)//-- Quando alguem conecta no server aparece isso \/
    {
            new string[128];
        if(SaiuSeq[playerid] == 1)
        {
            GetPlayerName(playerid, nome, sizeof(nome));
            format(string, sizeof(string), "[AVISO] A vitima %s ID:[%d] que deu /q no sequestro estб online!",nome, playerid);
                    SendClientMessageToAll(COLOR_LIGHTRED, string);
            }
            return 1;
    }
    public OnPlayerDisconnect(playerid, reason)//-- Quando alguem sai do server aparece isso \/
    {
        new string[128];
            if(Sequestrado[playerid] == 1)
            {
            GetPlayerName(playerid, nome, sizeof(nome));
            format(string, sizeof(string), "[SEQUESTRO]: A Vнtima de Sequestro %s deu /q em pleno sequestro D:",nome);
            SendClientMessageToAll(COLOR_BLUE, string);
            Sequestrado[playerid] = 0;
            Amarrado[playerid] = 0;
            SaiuSeq[playerid] = 1;
            TogglePlayerControllable(playerid, 1);
            }
            return 1;
    }
    public OnPlayerText(playerid, text[])
    {
        if(FitaNele[playerid] == 1)
            {
                    SendClientMessage(playerid, COLOR_LIGHTRED, "Vocк nгo pode falar porque estб com fita na boca!");
                    return 0;
            }
            return 1;
    }
    public OnPlayerCommandText(playerid, cmdtext[])
    {
        new cmd[256], idx;
        new tmp[256];
        cmd = strtok(cmdtext, idx);
        new string[128];
        if(strcmp(cmd, "/ysequestrar", true) == 0)
        {
            new id;
                    new preco;
                    tmp = strtok(cmdtext, idx);
            if(!strlen(tmp)) return SendClientMessage(playerid, COLOR_GREY,"USE: /sequestrar [id player]");
            id = strval(tmp);
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp)) return SendClientMessage(playerid, COLOR_GREY,"USE: /sequestrar [id player] [preco]");
            preco = strval(tmp);
            if(!IsPlayerConnected(id) || id == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_GREY,"Jogador estб OffLine");
            if(Sequestrado[id] == 1)
            {
                SendClientMessage(playerid, COLOR_GREY, " Esse jogador ja estб sendo sequestrado ");
                return 1;
                    }
                    if(preco < 1||preco > 100000)
                    {
                            SendClientMessage(playerid, COLOR_GREY, " O preзo do resgate deve estar entre R$1 e R$ 100000!. ");
                return 1;
                    }
                    if(GetPlayerState(playerid) != 2 || !IsPlayerInVehicle(id, GetPlayerVehicleID(playerid)))
            return SendClientMessage(playerid, COLOR_GREY, " Vocк nгo й o motorista ou o jogador nгo estб no seu carro ");
                    {
                    GetPlayerName(playerid, nome, sizeof(nome));
                    GetPlayerName(id, nome2, sizeof(nome2));
            format(string, sizeof(string), "Vocк estб sequestrando o %s e estб pedindo R$ %d pelo resgate!",nome2, preco);
                    SendClientMessage(playerid, COLOR_YELLOW, string);
            format(string, sizeof(string), "[SEQUESTRO] O sequestrador %s esta sequestrando o %s e estб pedindo R$ %d pelo resgate!",nome, nome2, preco);
                    SendClientMessageToAll(COLOR_LIGHTRED, string);
                    format(string, sizeof(string), "O jogador %s te sequestro",nome);
                    SendClientMessage(id, COLOR_WHITE, string);
                    TogglePlayerControllable(id, 0);
                    SetPlayerWantedLevel(playerid, 3);
            SendClientMessage(playerid, COLOR_LIGHTRED, "Agora vocк estб com 3 niveis de procura por sequestrar :)!");
                    Sequestrado[id] = 1;
                    Amarrado[id] = 1;
                    }
                    return 1;
            }
        if(strcmp(cmd, "/soltarrefem", true) == 0)
        {
            new id;
                    tmp = strtok(cmdtext, idx);
            if(!strlen(tmp)) return SendClientMessage(playerid, COLOR_GREY,"USE: /soltarrefem [id do jogador]");
            id = strval(tmp);
            if(!IsPlayerConnected(id) || id == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_GREY,"Jogador estб OffLine");
            if(Sequestrado[id] == 0)
            {
                SendClientMessage(playerid, COLOR_GREY, " Esse jogador nгo estб sequestrado ");
                return 1;
                    }
                    if(!ProxDetectorS(10.0, playerid, id))
                    {
                    SendClientMessage(playerid,COLOR_WHITE," Vocк estб longe do refйm para poder soltar ele!");
                            return 1;
            }
                    TogglePlayerControllable(id, 1);
                    GetPlayerName(playerid, nome, sizeof(nome));
                    GetPlayerName(id, nome2, sizeof(nome2));
            format(string, sizeof(string), "Vocк soltou o refem %s",id);
                    SendClientMessage(playerid, COLOR_YELLOW, string);
            format(string, sizeof(string), "[SEQUESTRO] O sequestrador %s soltou o ex-refйm %s",nome, nome2);
                    SendClientMessageToAll(COLOR_LIGHTRED, string);
                    format(string, sizeof(string), "O jogador %s te libertou",nome);
                    SendClientMessage(id, COLOR_LIGHTRED, string);
                    Sequestrado[id] = 0;
                    Amarrado[id] = 0;
                    return 1;
            }
        if(strcmp(cmd, "/passarfita", true) == 0)
        {
            new id;
                    tmp = strtok(cmdtext, idx);
            if(!strlen(tmp)) return SendClientMessage(playerid, COLOR_GREY,"USE: /passarfita [id do player]");
            id = strval(tmp);
            if(!IsPlayerConnected(id) || id == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_GREY,"Jogador estб OffLine");
            if(Sequestrado[id] == 0)
            {
                SendClientMessage(playerid, COLOR_GREY, " Esse jogador nгo estб sequestrado ");
                return 1;
                    }
                    if(FitaNele[id] == 1)
            {
                SendClientMessage(playerid, COLOR_GREY, " Esse jogador ja estб mudo ");
                return 1;
                    }
                    if(!ProxDetectorS(10.0, playerid, id))
                    {
                    SendClientMessage(playerid,COLOR_WHITE," Vocк estб longe do refйm para poder colocar a fita nele!");
                            return 1;
            }
                    GetPlayerName(playerid, nome, sizeof(nome));
                    GetPlayerName(id, nome2, sizeof(nome2));
            format(string, sizeof(string), "Vocк passou a fita no refem %s",id);
                    SendClientMessage(playerid, COLOR_YELLOW, string);
                    format(string, sizeof(string), "O sequestrador %s te passou a fita!",nome);
                    SendClientMessage(id, COLOR_LIGHTRED, string);
                    FitaNele[id] = 1;
                    return 1;
            }
        if(strcmp(cmd, "/tirarfita", true) == 0)
        {
            new id;
                    tmp = strtok(cmdtext, idx);
            if(!strlen(tmp)) return SendClientMessage(playerid, COLOR_GREY,"USE: /tirarfita [id do player]");
            id = strval(tmp);
            if(!IsPlayerConnected(id) || id == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_GREY,"Jogador estб OffLine");
            if(Sequestrado[id] == 0)
            {
                SendClientMessage(playerid, COLOR_GREY, " Esse jogador nгo estб sequestrado ");
                return 1;
                    }
                    if(FitaNele[id] == 0)
            {
                SendClientMessage(playerid, COLOR_GREY, " Esse jogador nгo estб mudo! ");
                return 1;
                    }
                    if(!ProxDetectorS(15.0, playerid, id))
                    {
                    SendClientMessage(playerid,COLOR_WHITE," Vocк estб longe do refйm para poder tirar a fita  dele!");
                            return 1;
            }
                    GetPlayerName(playerid, nome, sizeof(nome));
                    GetPlayerName(id, nome2, sizeof(nome2));
            format(string, sizeof(string), "Vocк tirou a fita no refem %s",id);
                    SendClientMessage(playerid, COLOR_YELLOW, string);
                    format(string, sizeof(string), "O sequestrador %s tirou a sua fita agora vocк pode falar.!",nome);
                    SendClientMessage(id, COLOR_LIGHTRED, string);
                    FitaNele[id] = 0;
                    return 1;
            }
            if(strcmp(cmd, "/ydesamarrar", true) == 0)
        {
            new id;
                    tmp = strtok(cmdtext, idx);
            if(!strlen(tmp)) return SendClientMessage(playerid, COLOR_GREY,"USE: /desamarrar [id player]");
            id = strval(tmp);
            if(!IsPlayerConnected(id) || id == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_GREY,"Jogador estб OffLine");
                    if(Amarrado[id] == 0)
                    {
                        SendClientMessage(playerid, COLOR_GREY, " Esse jogador nгo estб amarrado ");
                return 1;
                    }
            if(Sequestrado[id] == 0)
            {
                SendClientMessage(playerid, COLOR_GREY, " Esse jogador nгo estб sequestrado. ");
                return 1;
                    }
                    if(!ProxDetectorS(15.0, playerid, id))
                    {
                    SendClientMessage(playerid,COLOR_WHITE," Vocк estб longe do refйm para poder desamarrar ele!");
                            return 1;
            }
                    new carro = GetPlayerVehicleID(playerid);
                    if(!IsPlayerInAnyVehicle(playerid) && GetPlayerState(playerid) == 2 && IsPlayerInVehicle(id, carro)) return SendClientMessage(playerid, COLOR_GREY, " Vocк nгo й o motorista ou o jogador nгo estб no seu carro ");
                    {
                    TogglePlayerControllable(id, 1);
            GetPlayerName(playerid, nome, sizeof(nome));
            GetPlayerName(id, nome2, sizeof(nome2));
            format(string, sizeof(string), "O jogador %s te desamarrou",nome);
                    SendClientMessage(playerid, COLOR_YELLOW, string);
                    format(string, sizeof(string), "Vocк desamarrou o %s",nome2);
                    SendClientMessage(playerid, COLOR_YELLOW, string);
                    Amarrado[id] = 0;
                    }
                    return 1;
            }
        if(strcmp(cmd, "/yamarrar", true) == 0)
        {
            new id;
                    tmp = strtok(cmdtext, idx);
            if(!strlen(tmp)) return SendClientMessage(playerid, COLOR_GREY,"USE: /amarrar [id player]");
            id = strval(tmp);
            if(!IsPlayerConnected(id) || id == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_GREY,"Jogador estб OffLine");
                    if(Amarrado[id] == 1)
                    {
                        SendClientMessage(playerid, COLOR_GREY, " Esse jogador ja estб amarrado ");
                return 1;
                    }
            if(Sequestrado[id] == 0)
            {
                SendClientMessage(playerid, COLOR_GREY, " Esse jogador nгo estб sequestrado. ");
                return 1;
                    }
                    if(!ProxDetectorS(10.0, playerid, id))
                    {
                    SendClientMessage(playerid,COLOR_WHITE," Vocк estб longe do refйm para poder amarrar ele!");
                            return 1;
            }
                    new carro = GetPlayerVehicleID(playerid);
                    if(!IsPlayerInAnyVehicle(playerid) && GetPlayerState(playerid) == 2 && IsPlayerInVehicle(id, carro)) return SendClientMessage(playerid, COLOR_GREY, " Vocк nгo й o motorista ou o jogador nгo estб no seu carro ");
                    {
                    TogglePlayerControllable(id, 0);
            GetPlayerName(playerid, nome, sizeof(nome));
            GetPlayerName(id, nome2, sizeof(nome2));
            format(string, sizeof(string), "O sequestrador %s te amarrou",nome);
                    SendClientMessage(playerid, COLOR_YELLOW, string);
                    format(string, sizeof(string), "Vocк amarrou o %s",nome2);
                    SendClientMessage(playerid, COLOR_YELLOW, string);
                    Amarrado[id] = 1;
                    }
                    return 1;
            }
            return 0;
    }

    public OnPlayerDeath(playerid, killerid, reason)
    {
            new string[128];
            if(Sequestrado[playerid] == 1)
            {
            GetPlayerName(playerid, nome, sizeof(nome));
            format(string, sizeof(string), "[SEQUESTRO]: A vнtima do sequestro, %s[ID:%d] morreu, sequestro finalizado!",nome);
            SendClientMessageToAll(COLOR_LIGHTRED, string);
            format(string, sizeof(string), "[LUTO] Estб declarado luto por 2 minutos por a morte do %s", nome);
            SendClientMessageToAll(COLOR_LIGHTRED, string);
            Sequestrado[playerid] = 0;
            Amarrado[playerid] = 0;
            TogglePlayerControllable(playerid, 1);
            }
            return 1;
    }

    strtok(const string[], &index)
    {
            new length = strlen(string);
            while ((index < length) && (string[index] <= ' '))
            {
                    index++;
            }

            new offset = index;
            new result[20];
            while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
            {
                    result[index - offset] = string[index];
                    index++;
            }
            result[index - offset] = EOS;
            return result;
    }
    //- FS criado por Bruno Pereira/DJ Bruninho. Porfavor nгo retire os creditos! - //
    //- Contato: brunopereiraa-@hotmail.com -//
    //- FS criado por Bruno Pereira/DJ Bruninho. Porfavor nгo retire os creditos! - //



Re: Ao morrer sequestrado ser preso - gmstrikker - 11.09.2013

Alguem sabe me dizer como faz isso?


Re: Ao morrer sequestrado ser preso - PT - 11.09.2013

o cara morre e ainda e preso?


Re: Ao morrer sequestrado ser preso - gmstrikker - 11.09.2013

й pra causar um medo ai o cara age mais rpg, pq se ele for sequestrado tem q ter medo de morrer pq se fizer anti rpg tipo bater nos cara e os caras matarem ele, ele morre e fica preso pra deixar de ser anti rpg, saca?


Re: Ao morrer sequestrado ser preso - PT - 11.09.2013

ah sim tendi, entao faz o seguinte adapta a fs ao gm depois na CallBack

pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
se o player estiver sequestrado

pawn Код:
if(Sequestrado[playerid] == 1)
adicione a funcao de o prender