[Ajuda] Policiais Prendem Policiais !
#1

Por exemplo , se um cara й policial ,e um outro policial estб procurado , dб para prender outro !
Queria um jeito de blockear as profissoes poderem prender a mesma !
/Prender :
Code:
if(strcmp(cmd, "/prender", true) == 0) {
new aname[MAX_PLAYER_NAME];
GetPlayerName(playerid, aname, MAX_PLAYER_NAME);
format(file, sizeof(file), PASTA_CONTAS, aname);
if(dini_Int(file, "Profissao") == Policial_C || dini_Int(file, "Profissao") == Policial_F || dini_Int(file, "Profissao") == Delegado || dini_Int(file, "Profissao") == Bope || dini_Int(file, "Profissao") == Swat || dini_Int(file, "Profissao") == Narcoticos || dini_Int(file, "Profissao") == Policial_M || dini_Int(file, "Profissao") == FBI || dini_Int(file, "Profissao") == LSPD || dini_Int(file, "aAdmin") == 1){
new tmp[256];
new plid;
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)){
SendClientMessage(playerid, Vermelho, "(ERRO) Use: /prender [id]");
return 1;
}
plid = strval(tmp);
if(IsPlayerInAnyVehicle(plid) == 1 || IsPlayerInAnyVehicle(playerid) == 1){
SendClientMessage(playerid, Vermelho, "(ERRO) Alguem estб dentro de um carro.");
return 1 ;
}
if(plid == playerid){
SendClientMessage(playerid, Vermelho, "(ERRO) Vocк nгo pode fazer isto com si mesmo.");
return 1 ;
}
if(!IsPlayerConnected(plid)){
SendClientMessage(playerid, Vermelho, "(ERRO) O jogador nгo estб conectado");
return 1;
}
if(Procurados[plid] == 0){
SendClientMessage(playerid, Azul, " » Player Nao esta Procurado « ");
return 1;
} else {
if(GetDistanceBetweenPlayers(plid,playerid) < 10){
new pname[MAX_PLAYER_NAME];
GetPlayerName(plid, pname, MAX_PLAYER_NAME);
format(file2, sizeof(file2), PASTA_CONTAS, pname);
format(string, sizeof(string), "(INFO) O Policial %s te prendeu", aname);
SendClientMessage(plid, Blue, string);
SetPlayerPos(plid, 263.8820,77.4002,1001.0391);
SetPlayerInterior(plid, 6);
SetPlayerHealth(plid, 99999);
ResetPlayerWeapons(plid);
dini_IntSet(file2, "Preso", 1);
SendClientMessage(playerid, Verde, "(INFO) Vocк prendeu um jogador procurado e ganhou 2.500 !");
SetPlayerWantedLevel(plid, 0);
preso[plid] = 1;
TogglePlayerControllable(plid, 1);
if(Procurados[plid] == 1){
GivePlayerGrana(playerid,2500);
dini_IntSet(file, "Velocimetro", 1);
Procurados[plid] = 0;
SendClientMessage(playerid, Verde, "(INFO) Esta Aqui Sua Recompensa ganhou 2.500 !");
dini_IntSet(file2, "Procurado", 0);
}
return 1;
} else {
SendClientMessage(playerid,Vermelho,"(ERRO) Chegue mais perto para prender!");
return 1;
}
}
} else {
SendClientMessage(playerid,Vermelho,"(ERRO) Apenas policiais podem usar este comando!");
return 1;
}
}
Id das profissoes que dб pra prender :
3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - 28 - 31
Reply
#2

Antes de prender faz uma verificaзгo se o jogador preso й de uma organizaзгo policial, se nгo for, vocк taca um return com alguma mensagem.
Reply
#3

Quote:
Originally Posted by Joao Pedro
View Post
Antes de prender faz uma verificaзгo se o jogador preso й de uma organizaзгo policial, se nгo for, vocк taca um return com alguma mensagem.
Nгo seria se for?

pawn Code:
if(PlayerInfo[playerid][org] == 1) return SendClientMessage(playerid,-1,"Nгo prenda cops!");
Reply
#4

Olб IGp!

Nгo estб correto seria mais ou menos assim:
pawn Code:
if(PlayerInfo[plid][org] != 3 && PlayerInfo[plid][org] != 4 && PlayerInfo[plid][org] != 5)
SendClientMessage(playerid,-1,"Vocк nгo pode assaltar !");
return true;
Vlw!
Reply
#5

Olhem como funciona o comando dele, й diferente dos GF.

pawn Code:
if(strcmp(cmd, "/prender", true) == 0)
{
    new aname[MAX_PLAYER_NAME], profid;
    GetPlayerName(playerid, aname, MAX_PLAYER_NAME);
    format(file, sizeof(file), PASTA_CONTAS, aname);
    profid = dini_Int(file, "Profissao");
    if(profid == Policial_C || profid == Policial_F || profid == Delegado || profid == Bope || profid == Swat || profid == Narcoticos || profid == Policial_M || profid == FBI || profid == LSPD || dini_Int(file, "aAdmin") == 1)
    {
        new tmp[256];
        new plid;
        tmp = strtok(cmdtext, idx);
        if(!strlen(tmp))
        {
            SendClientMessage(playerid, Vermelho, "(ERRO) Use: /prender [id]");
            return 1;
        }
        plid = strval(tmp);
        if(IsPlayerInAnyVehicle(plid) == 1 || IsPlayerInAnyVehicle(playerid) == 1)
        {
            SendClientMessage(playerid, Vermelho, "(ERRO) Alguem estб dentro de um carro.");
            return 1 ;
        }
        if(plid == playerid)
        {
            SendClientMessage(playerid, Vermelho, "(ERRO) Vocк nгo pode fazer isto com si mesmo.");
            return 1 ;
        }
        if(!IsPlayerConnected(plid))
        {
            SendClientMessage(playerid, Vermelho, "(ERRO) O jogador nгo estб conectado");
            return 1;
        }
        if(Procurados[plid] == 0)
        {
            SendClientMessage(playerid, Azul, " » Player Nao esta Procurado « ");
            return 1;
        }
        else
        {
            if(GetDistanceBetweenPlayers(plid,playerid) < 10)
            {
                new pname[MAX_PLAYER_NAME];
                GetPlayerName(plid, pname, MAX_PLAYER_NAME);
                format(file2, sizeof(file2), PASTA_CONTAS, pname);
                profid = dini_Int(file2, "Profissao");
                if(profid == Policial_C || profid == Policial_F || profid == Delegado || profid == Bope || profid == Swat || profid == Narcoticos || profid == Policial_M || profid == FBI || profid == LSPD || dini_Int(file, "aAdmin") == 1)
                {
                    //Mensagem
                    return 1;
                }
                format(string, sizeof(string), "(INFO) O Policial %s te prendeu", aname);
                SendClientMessage(plid, Blue, string);
                SetPlayerPos(plid, 263.8820,77.4002,1001.0391);
                SetPlayerInterior(plid, 6);
                SetPlayerHealth(plid, 99999);
                ResetPlayerWeapons(plid);
                dini_IntSet(file2, "Preso", 1);
                SendClientMessage(playerid, Verde, "(INFO) Vocк prendeu um jogador procurado e ganhou 2.500 !");
                SetPlayerWantedLevel(plid, 0);
                preso[plid] = 1;
                TogglePlayerControllable(plid, 1);
                if(Procurados[plid] == 1)
                {
                    GivePlayerGrana(playerid,2500);
                    dini_IntSet(file, "Velocimetro", 1);
                    Procurados[plid] = 0;
                    SendClientMessage(playerid, Verde, "(INFO) Esta Aqui Sua Recompensa ganhou 2.500 !");
                    dini_IntSet(file2, "Procurado", 0);
                }
                return 1;
            }
            else
            {
                SendClientMessage(playerid,Vermelho,"(ERRO) Chegue mais perto para prender!");
                return 1;
            }
        }
    }
    else
    {
        SendClientMessage(playerid,Vermelho,"(ERRO) Apenas policiais podem usar este comando!");
        return 1;
    }
}
Deve funcionar...
Reply
#6

Quote:
Originally Posted by iReflesh
View Post
Olhem como funciona o comando dele, й diferente dos GF.

pawn Code:
if(strcmp(cmd, "/prender", true) == 0)
{
    new aname[MAX_PLAYER_NAME], profid;
    GetPlayerName(playerid, aname, MAX_PLAYER_NAME);
    format(file, sizeof(file), PASTA_CONTAS, aname);
    profid = dini_Int(file, "Profissao");
    if(profid == Policial_C || profid == Policial_F || profid == Delegado || profid == Bope || profid == Swat || profid == Narcoticos || profid == Policial_M || profid == FBI || profid == LSPD || dini_Int(file, "aAdmin") == 1)
    {
        new tmp[256];
        new plid;
        tmp = strtok(cmdtext, idx);
        if(!strlen(tmp))
        {
            SendClientMessage(playerid, Vermelho, "(ERRO) Use: /prender [id]");
            return 1;
        }
        plid = strval(tmp);
        if(IsPlayerInAnyVehicle(plid) == 1 || IsPlayerInAnyVehicle(playerid) == 1)
        {
            SendClientMessage(playerid, Vermelho, "(ERRO) Alguem estб dentro de um carro.");
            return 1 ;
        }
        if(plid == playerid)
        {
            SendClientMessage(playerid, Vermelho, "(ERRO) Vocк nгo pode fazer isto com si mesmo.");
            return 1 ;
        }
        if(!IsPlayerConnected(plid))
        {
            SendClientMessage(playerid, Vermelho, "(ERRO) O jogador nгo estб conectado");
            return 1;
        }
        if(Procurados[plid] == 0)
        {
            SendClientMessage(playerid, Azul, " » Player Nao esta Procurado « ");
            return 1;
        }
        else
        {
            if(GetDistanceBetweenPlayers(plid,playerid) < 10)
            {
                new pname[MAX_PLAYER_NAME];
                GetPlayerName(plid, pname, MAX_PLAYER_NAME);
                format(file2, sizeof(file2), PASTA_CONTAS, pname);
                profid = dini_Int(file2, "Profissao");
                if(profid == Policial_C || profid == Policial_F || profid == Delegado || profid == Bope || profid == Swat || profid == Narcoticos || profid == Policial_M || profid == FBI || profid == LSPD || dini_Int(file, "aAdmin") == 1)
                {
                    //Mensagem
                    return 1;
                }
                format(string, sizeof(string), "(INFO) O Policial %s te prendeu", aname);
                SendClientMessage(plid, Blue, string);
                SetPlayerPos(plid, 263.8820,77.4002,1001.0391);
                SetPlayerInterior(plid, 6);
                SetPlayerHealth(plid, 99999);
                ResetPlayerWeapons(plid);
                dini_IntSet(file2, "Preso", 1);
                SendClientMessage(playerid, Verde, "(INFO) Vocк prendeu um jogador procurado e ganhou 2.500 !");
                SetPlayerWantedLevel(plid, 0);
                preso[plid] = 1;
                TogglePlayerControllable(plid, 1);
                if(Procurados[plid] == 1)
                {
                    GivePlayerGrana(playerid,2500);
                    dini_IntSet(file, "Velocimetro", 1);
                    Procurados[plid] = 0;
                    SendClientMessage(playerid, Verde, "(INFO) Esta Aqui Sua Recompensa ganhou 2.500 !");
                    dini_IntSet(file2, "Procurado", 0);
                }
                return 1;
            }
            else
            {
                SendClientMessage(playerid,Vermelho,"(ERRO) Chegue mais perto para prender!");
                return 1;
            }
        }
    }
    else
    {
        SendClientMessage(playerid,Vermelho,"(ERRO) Apenas policiais podem usar este comando!");
        return 1;
    }
}
Deve funcionar...
Vou testar o seu , porque meu servidor n tem org's \o/
Reply
#7

Quote:
Originally Posted by iReflesh
View Post
Olhem como funciona o comando dele, й diferente dos GF.

pawn Code:
if(strcmp(cmd, "/prender", true) == 0)
{
    new aname[MAX_PLAYER_NAME], profid;
    GetPlayerName(playerid, aname, MAX_PLAYER_NAME);
    format(file, sizeof(file), PASTA_CONTAS, aname);
    profid = dini_Int(file, "Profissao");
    if(profid == Policial_C || profid == Policial_F || profid == Delegado || profid == Bope || profid == Swat || profid == Narcoticos || profid == Policial_M || profid == FBI || profid == LSPD || dini_Int(file, "aAdmin") == 1)
    {
        new tmp[256];
        new plid;
        tmp = strtok(cmdtext, idx);
        if(!strlen(tmp))
        {
            SendClientMessage(playerid, Vermelho, "(ERRO) Use: /prender [id]");
            return 1;
        }
        plid = strval(tmp);
        if(IsPlayerInAnyVehicle(plid) == 1 || IsPlayerInAnyVehicle(playerid) == 1)
        {
            SendClientMessage(playerid, Vermelho, "(ERRO) Alguem estб dentro de um carro.");
            return 1 ;
        }
        if(plid == playerid)
        {
            SendClientMessage(playerid, Vermelho, "(ERRO) Vocк nгo pode fazer isto com si mesmo.");
            return 1 ;
        }
        if(!IsPlayerConnected(plid))
        {
            SendClientMessage(playerid, Vermelho, "(ERRO) O jogador nгo estб conectado");
            return 1;
        }
        if(Procurados[plid] == 0)
        {
            SendClientMessage(playerid, Azul, " » Player Nao esta Procurado « ");
            return 1;
        }
        else
        {
            if(GetDistanceBetweenPlayers(plid,playerid) < 10)
            {
                new pname[MAX_PLAYER_NAME];
                GetPlayerName(plid, pname, MAX_PLAYER_NAME);
                format(file2, sizeof(file2), PASTA_CONTAS, pname);
                profid = dini_Int(file2, "Profissao");
                if(profid == Policial_C || profid == Policial_F || profid == Delegado || profid == Bope || profid == Swat || profid == Narcoticos || profid == Policial_M || profid == FBI || profid == LSPD || dini_Int(file, "aAdmin") == 1)
                {
                    //Mensagem
                    return 1;
                }
                format(string, sizeof(string), "(INFO) O Policial %s te prendeu", aname);
                SendClientMessage(plid, Blue, string);
                SetPlayerPos(plid, 263.8820,77.4002,1001.0391);
                SetPlayerInterior(plid, 6);
                SetPlayerHealth(plid, 99999);
                ResetPlayerWeapons(plid);
                dini_IntSet(file2, "Preso", 1);
                SendClientMessage(playerid, Verde, "(INFO) Vocк prendeu um jogador procurado e ganhou 2.500 !");
                SetPlayerWantedLevel(plid, 0);
                preso[plid] = 1;
                TogglePlayerControllable(plid, 1);
                if(Procurados[plid] == 1)
                {
                    GivePlayerGrana(playerid,2500);
                    dini_IntSet(file, "Velocimetro", 1);
                    Procurados[plid] = 0;
                    SendClientMessage(playerid, Verde, "(INFO) Esta Aqui Sua Recompensa ganhou 2.500 !");
                    dini_IntSet(file2, "Procurado", 0);
                }
                return 1;
            }
            else
            {
                SendClientMessage(playerid,Vermelho,"(ERRO) Chegue mais perto para prender!");
                return 1;
            }
        }
    }
    else
    {
        SendClientMessage(playerid,Vermelho,"(ERRO) Apenas policiais podem usar este comando!");
        return 1;
    }
}
Deve funcionar...
Tem jeito de quando for prender um policial dar a mensagem : Vocк nao pode prender esse player ! ?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)