[Ajuda] O multar, procurar e algemar!
#1

Se quiser me ajudar me ajude se nгo quiser eu entendo.
Vamos comeзar com o procurar, nele vc digita /procurar [ID] [MOTIVO] ai a textdraw no meio da tela azul apareзe pra vc em vez de apareзer pro carinha...
pawn Код:
if(strcmp(cmd, "/procurar", true) == 0 || strcmp(cmd, "/su", true) == 0)
    {
        new id[256],Pname[24],Sname[24],str[256],Sstr[256];
        GetPlayerName(playerid, Pname, sizeof(Pname));
        format(Sstr, sizeof(Sstr), "Contas/%s.ini", Pname);
        new prof = dini_Int(Sstr, "Profissao");
        new admm = dini_Int(Sstr, "pAdm01");
        new plid;
        if(prof == Policial_C || prof == Policial_F || prof == Recruta || prof == Bope || prof == Swat || prof == Rotam || prof == Policial_M || prof == FBI || prof == Interpol || admm == 1)
        {
            id = strtok(cmdtext, idx);
            new length = strlen(cmdtext);
            while ((idx < length) && (cmdtext[idx] <= ' ')) { idx++;}
            new offset = idx; new result[100];
            while ((idx < length) && ((idx - offset) < (sizeof(result) - 1))) { result[idx - offset] = cmdtext[idx]; idx++; }
            result[idx - offset] = EOS;

            if(!strlen(id) || !strlen(result)) return SendClientMessage(playerid, 0xFFD39BAA, "Use: /procurar [id] [motivo]");
            if(IsPlayerConnected(strval(id)))
            {
                GetPlayerName(strval(id), Sname, sizeof(Sname));
                format(str, sizeof(str), "{2F7AFC} Vocк foi colocado na lista de procurados pelo policial %s. Motivo: %s", Pname, result);
                SendClientMessage(strval(id), 0xFFD39BAA, str);
                format(str, sizeof(str), "{2F7AFC}| PROCURADO | O policial %s colocou %s na lista de procurados pelo motivo: %s", Pname, Sname, result);
                SendClientMessageToAll(0xFFD39BAA, str);
                dini_IntSet(Sstr, "Procurado", dini_Int(Sstr, "Procurado")+1);
                SetPlayerWantedLevel(strval(id), GetPlayerWantedLevel(strval(id))+1);
                Procurados[strval(id)]++;
                GameTextForPlayer(plid,"~b~PROCURADO", 5000, 0);
                return 1;
            }
            else return SendClientMessage(playerid, 0xFFD39BAA, "(ERRO) Jogador nгo conectado no momento!");
        }
        else return SendClientMessage(playerid, 0xFFD39BAA, "(ERRO) Vocк nгo pode usar esse comando!");
    }
Agora vem o /algemar ta tudo ok, oq ta faltando й /algemar [id] [motivo], pq os cara que vгo algemado nem sabem pq vгo algemado, ai tem q ter /algemar [id] [motivo] sу isso:

pawn Код:
if(strcmp(cmd, "/algemar", true) == 0) {
new aname[MAX_PLAYER_NAME];
GetPlayerName(playerid, aname, MAX_PLAYER_NAME);
format(file, sizeof(file), P_CONTAS, aname);
if(dini_Int(file, "Profissao") == Policial_M || dini_Int(file, "Profissao") == Policial_C || dini_Int(file, "Profissao") == Policial_F || dini_Int(file, "Profissao") == Recruta || dini_Int(file, "Profissao") == Bope || dini_Int(file, "Profissao") == Swat || dini_Int(file, "Profissao") == Rotam || dini_Int(file, "Profissao") == FBI || dini_Int(file, "Profissao") == Interpol ||dini_Int(file, "Profissao") == LSPD || dini_Int(file, "pAdm01") == 1){
new tmp[256];
new plid;
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)){
SendClientMessage(playerid, Vermelho, "{0099FF}[x]{CCCCFF} Use: /algemar [id]");
return 1;
}
plid = strval(tmp);
if(IsPlayerInAnyVehicle(plid) == 1 || IsPlayerInAnyVehicle(playerid) == 1){
SendClientMessage(playerid, Vermelho, "{0099FF}[x]{CCCCFF} Alguem estб dentro de um carro.");
return 1 ;
}
if(plid == playerid){
SendClientMessage(playerid, Vermelho, "{0099FF}[x]{CCCCFF} Vocк nгo pode algemar vocк mesmo.");
return 1 ;
}
if(!IsPlayerConnected(plid)){
SendClientMessage(playerid, Vermelho, "{0099FF}[x]{CCCCFF} O jogador nгo estб conectado");
return 1;
} else {
if(GetDistanceBetweenPlayers(plid,playerid) < 10){
format(string, sizeof(string), "{0099FF}[x]{CCCCFF} O Policial %s te algemou.", aname);
SendClientMessage(plid, AzuL4, string);
GameTextForPlayer(plid,"~b~ALGEMADO", 5000, 0);// 5000 =  5 Segundos, 1 = Estilo da fonte.
TogglePlayerControllable(plid, 0);
SendClientMessage(playerid, COLOR_GREEN, "{0099FF}[x]{CCCCFF} Algemado com sucesso.");
algemado[plid] = 1;
return 1;
} else {
SendClientMessage(playerid,Vermelho,"{0099FF}[x]{CCCCFF} Chegue mais perto para algemar.");
return 1;
}
}
} else {
SendClientMessage(playerid,Vermelho,"{0099FF}[x]{CCCCFF} Apenas policiais podem usar este comando.");
return 1;
}
}
Agr vem o multar ta tudo certinho, sу que nгo tem /multar [id] [motivo], sу tem /multar [id] ai o kara nem sabe pq foi multado --', se pudessem colocar pra /multar [id] [motivo] ai apareзe pra todos pq '' O policial tal mutou tal em $$ pelo motivo: Sem capacete..., ai pq se nгo apareзer a mensagem nem o motivo o policial vai sair prendendo todos compriendes? obrigado.
pawn Код:
if(strcmp(cmd, "/multar", true) == 0) {
new aname[MAX_PLAYER_NAME];
GetPlayerName(playerid, aname, MAX_PLAYER_NAME);
format(file, sizeof(file), P_CONTAS, aname);
if(dini_Int(file, "Profissao") == Policial_C || dini_Int(file, "Profissao") == Policial_F || dini_Int(file, "Profissao") == Recruta || dini_Int(file, "Profissao") == Bope || dini_Int(file, "Profissao") == Swat || dini_Int(file, "Profissao") == Rotam || dini_Int(file, "Profissao") == Policial_M || dini_Int(file, "Profissao") == FBI || dini_Int(file, "Profissao") == Interpol || dini_Int(file, "Profissao") == LSPD || dini_Int(file, "pAdm01") == 1 || IsPlayerAdmin(playerid)){
new tmp[256];
new plid;
new quant;
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) {
SendClientMessage(playerid, Vermelho, "/multar [id] [quantidade]");
return 1;
}
plid = strval(tmp);
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) {
SendClientMessage(playerid, Vermelho, "/multar [id] [quantidade]");
return 1;
}
quant = strval(tmp);
if(quant > 1000 || quant <= 0){
SendClientMessage(playerid, Vermelho, "{0099FF}[x]{CCCCFF} Valor de 0 a 1000 R$.");
return 1;
}
if(IsPlayerConnected(plid)){
new pname[MAX_PLAYER_NAME];
GetPlayerName(plid, pname, MAX_PLAYER_NAME);
format(file2, sizeof(file2), P_CONTAS, pname);
format(string, sizeof(string), "{0099FF}[x]{CCCCFF} Vocк recebeu uma multa de R$%d Pelo policial %s . O dinheiro foi retirado do banco.", quant, aname);
SendClientMessage(plid, COLOR_GREEN, string);
GameTextForPlayer(plid,"~b~MULTADO", 5000, 0);
SendClientMessage(playerid, COLOR_GREEN, "{0099FF}[x]{CCCCFF} Multa dada.");
dini_IntSet(file2, "SaldoBancario", dini_Int(file2, "SaldoBancario")- quant);
return 1;
}
else{
SendClientMessage(playerid, Vermelho, "{0099FF}[x]{CCCCFF} O jogador nгo estб conectado!");
return 1;
}
}
}
Aproveitando aki esse /prender o kara digita /prender [id] ai apareзe O policial prendeu o jogador pelo motivo: ai nao apareзe o motivo, tinha que por assim: use /prender [id] [motivo] pra quando o policial for usar /prender [id]:

pawn Код:
if(strcmp(cmd, "/prender", true) == 0)
{
    new aname[MAX_PLAYER_NAME];
    GetPlayerName(playerid, aname, MAX_PLAYER_NAME);
    format(file, sizeof(file), P_CONTAS, aname);

    if(dini_Int(file, "Profissao") == Policial_C || dini_Int(file, "Profissao") == Policial_F || dini_Int(file, "Profissao") == Recruta || dini_Int(file, "Profissao") == Bope || dini_Int(file, "Profissao") == Swat || dini_Int(file, "Profissao") == Rotam || dini_Int(file, "Profissao") == Policial_M || dini_Int(file, "Profissao") == FBI || dini_Int(file, "Profissao") == Interpol || dini_Int(file, "pAdm01") == 1)
    {
        new tmp[256];

        new plid;
        tmp = strtok(cmdtext, idx);

        if(!strlen(tmp))
        {
        SendClientMessage(playerid, Vermelho, "{0099FF}[x]{CCCCFF} Use: /prender [id] [motivo]");
        return 1;
        }

        plid = strval(tmp);
        if(GetPlayerWantedLevel(plid) == 0)
        {
                 return SendClientMessage(playerid, -1, "{2F7AFC} Esse jogador nгo estб sendo procurado, portanto nгo poderб ser preso!");
        }
        if(IsPlayerInAnyVehicle(plid) == 1 || IsPlayerInAnyVehicle(playerid) == 1)
        {
            SendClientMessage(playerid, Vermelho, "{0099FF}[x]{CCCCFF} O Player estб dentro de um carro e nгo pode ser preso.");
            return 1 ;
        }

        if(plid == playerid)
        {
            SendClientMessage(playerid, Vermelho, "{0099FF}[x]{CCCCFF} Vocк nгo pode fazer isto com si mesmo.");
            return 1 ;
        }
        if(!IsPlayerConnected(plid))
        {
            SendClientMessage(playerid, Vermelho, "{0099FF}[x]{CCCCFF} O jogador nгo estб conectado");
            return 1;
        }
        else
        {
            if(GetDistanceBetweenPlayers(plid,playerid) < 10)
            {

                //AQUI VAI LER O MOTIVO
                new length = strlen(cmdtext);
                while ((idx < length) && (cmdtext[idx] <= ' '))
                {
                    idx++;
                }
                new offset = idx;
                new result[100];
                while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
                {
                    result[idx - offset] = cmdtext[idx];
                    idx++;
                }
                result[idx - offset] = EOS;
                //--------------------------------------------

                new pname[MAX_PLAYER_NAME];
                GetPlayerName(plid, pname, MAX_PLAYER_NAME);
                format(file2, sizeof(file2), P_CONTAS, pname);
                format(string, sizeof(string), "[x] O policial %s te prendeu.", aname);
                SendClientMessage(plid, AzuL4, string);
                GameTextForPlayer(plid,"~b~PRESO", 5000, 0);
                SetPlayerPos(plid, 263.8820,77.4002,1001.0391);
                SetPlayerInterior(plid, 6);
                SetPlayerHealth(plid, 99999);
                ResetPlayerWeapons(plid);
                dini_IntSet(file2, "Preso", 1);
                SendClientMessage(playerid, COLOR_GREEN, "{0099FF}[x]{CCCCFF} Preso com sucesso.");
                SetPlayerWantedLevel(plid, 0);
                preso[plid] = 1;
                TogglePlayerControllable(plid, 1);

                //MENSAGEM PARA TODOS
                format(string, sizeof(string), "{2F7AFC} | PRISГO | O policial %s prendeu o procurado %s pelo motivo: %s!", aname, pname, (result));
                SendClientMessageToAll(-1 ,string);

                if(Procurados[plid] == 1)
                {
                    GivePlayerGrana(playerid,60);
                    Procurados[plid] = 0;
                    SendClientMessage(playerid, Verde, "{0099FF}[x]{CCCCFF} Vocк ganhou uns trocados por ter prendido um procurado!");
                    dini_IntSet(file2, "Procurado", 0);
                }
                return 1;
            }
            else
            {
                SendClientMessage(playerid,Vermelho,"{0099FF}[x]{CCCCFF} Chegue mais perto para prender!");
                return 1;
            }
        }
    }
    else
    {
        SendClientMessage(playerid,Vermelho,"{0099FF}[x]{CCCCFF} Apenas policiais podem usar este comando!");
        return 1;
    }
}
Desculpem por pedir muito, mais os policiais do meu servidor estгo abusando desses comandos!
Reply
#2

pawn Код:
GameTextForPlayer(id,"~b~PROCURADO", 5000, 0);
Ai o GameText do /procurar
e no /prender acho que falta um result aн
:

pawn Код:
format(string, sizeof(string), "[x] O policial %s te prendeu, Motivo: %s", aname, result);
Reply
#3

nao podia ter ajudar mais ta ae to aki para ajjudar e o que eu sei eu repasso
espero ter ajudado!

no primeiro caso

pawn Код:
GameTextForPlayer(plid,"~b~PROCURADO", 5000, 0);
//responsavel por emitir a mensagem na tela
~b~   < define que o texto a ser exibido sera azul
no caso do primeiro tanbem tem o
/procurar id motivo
os outros 3 percebi que vc quer fazer o mesmo e simples estude esse primeiro codigo qe dele vc resolvera os outros sozinhos!
Reply
#4

С mais qnd vc digita /procurar a textdraw vai pra vc e nгo pro cara q foi procurado!
Reply
#5

pawn Код:
format(string, sizeof(string), "[x] O policial %s te prendeu, Motivo: %s", aname, result);
olha nessa linha que o funeral postou talvez ajude!
Reply
#6

Ah, presta tenзгo no codigo nй fi...

fui eu quem fez esse procurar id ai pra vc... entгo dб onde vc tirou esse"plid" ??

pra ta usando aki:
Код:
GameTextForPlayer(plid,"~b~PROCURADO", 5000, 0);
ja falei pra vc comeзar a estudar mais axo q num tem jeito.

muda essa linha ai pra essa:

Код:
GameTextForPlayer(strval(id),"~b~PROCURADO", 5000, 0);
e tira sa porra de "plid".
Reply
#7

Ta consegui resolver, agora falta os outros comandos lб em cima!
Reply
#8

Ajuda laб
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)