[Ajuda] Cmd /soltar
#1

Estou com um problema aki.
meu comando /soltar esta bugado. Ele esta soltando atй os players q nao estao presos.
Eu coloquei isso isso aki dai :
pawn Код:
if(Preso[plid] == 0)
return SendClientMessage(playerid, Vermelho, "Este Player nao Esta Preso. ");
return 1;
mas esta dando uma warning.
pawn Код:
warning 225: unreachable code
aki esta o comando de soltar:
pawn Код:
if(strcmp(cmd, "/soltar", true) == 0) {
new aname[MAX_PLAYER_NAME];
GetPlayerName(playerid, aname, MAX_PLAYER_NAME);
format(file, sizeof(file), PASTA_CONTAS, aname);
if(pAdmin[playerid]  == 1 || pAdmin[playerid] == 2 || pAdmin[playerid] == 3 || pAdmin[playerid] == 4 || dini_Int(file, "Profissao") == Prefeito || dini_Int(file, "Profissao") == Presidente ||  dini_Int(file, "Profissao") == Guardiao || dini_Int(file, "Profissao") == Advogado || pAdmin[playerid] == 5){
new tmp[256];
new plid;
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)){
SendClientMessage(playerid, Vermelho, "(ERRO) Use: /soltar [id]");
return 1;
}
plid = strval(tmp);
if(!IsPlayerConnected(plid)){
SendClientMessage(playerid, Vermelho, "(ERRO) O jogador nгo estб online");
return 1;
} else {
if(Preso[plid] == 0)
return SendClientMessage(playerid, Vermelho, "Este Player nao Esta Preso. ");
return 1;
new pname[MAX_PLAYER_NAME];
GetPlayerName(plid, pname, MAX_PLAYER_NAME);
format(file2, sizeof(file2), PASTA_CONTAS, pname);
SendClientMessage(plid, Aviso, string);
dini_IntSet(file2, "Preso", 0);
preso[plid] = 0;
SetPlayerHealth(plid,100);
Preso[plid] = 0;
algemado[plid] = 0;
SpawnPlayer(plid);
SendClientMessage(playerid, COLOR_GREEN, "(INFO) Jogador Solto !");
return 1;
}
} else {
SendClientMessage(playerid,Vermelho,"(ERRO) Vocк nгo й um Advogado");
return 1;
}
}
Eu estou achando q esta faltando algo . Pq eu acho q esta no lugar certo.
Me Ajudem.
Reply
#2

Tenta ai:
pawn Код:
if(strcmp(cmd, "/soltar", true) == 0)
{
    new aname[MAX_PLAYER_NAME];
    GetPlayerName(playerid, aname, MAX_PLAYER_NAME);
    format(file, sizeof(file), PASTA_CONTAS, aname);
    if(pAdmin[playerid]  == 1 || pAdmin[playerid] == 2 || pAdmin[playerid] == 3 || pAdmin[playerid] == 4 || dini_Int(file, "Profissao") == Prefeito || dini_Int(file, "Profissao") == Presidente ||  dini_Int(file, "Profissao") == Guardiao || dini_Int(file, "Profissao") == Advogado || pAdmin[playerid] == 5)
    {
        new tmp[256],plid;
        tmp = strtok(cmdtext, idx);
        if(!strlen(tmp)) return SendClientMessage(playerid, Vermelho, "(ERRO) Use: /soltar [id]");
        plid = strval(tmp);
        if(!IsPlayerConnected(plid)) return SendClientMessage(playerid, Vermelho, "(ERRO) O jogador nгo estб online");
        if(Preso[plid] == 0) return SendClientMessage(playerid, Vermelho, "Este Player nao Esta Preso. ");
        new pname[MAX_PLAYER_NAME];
        GetPlayerName(plid, pname, MAX_PLAYER_NAME);
        format(file2, sizeof(file2), PASTA_CONTAS, pname);
        SendClientMessage(plid, Aviso, string);
        dini_IntSet(file2, "Preso", 0);
        preso[plid] = 0;
        SetPlayerHealth(plid,100);
        Preso[plid] = 0;
        algemado[plid] = 0;
        SpawnPlayer(plid);
        SendClientMessage(playerid, COLOR_GREEN, "(INFO) Jogador Solto !");
        return 1;
    }
    else return SendClientMessage(playerid,Vermelho,"(ERRO) Vocк nгo й um Advogado");
    return 1;
}
Reply
#3

Mesmo warning amigo.
Reply
#4

pawn Код:
if(Preso[plid] == 1)
{
      //Comando a Ser Feito
}
else if(Preso[plid] == 0)
{
      SendClientMessage(playerid, Vermelho, "Este Player nao Esta Preso. "); // caso ele nao esteja preso
}
return 1;
Acho que e assim, nao uso muito strcmp, so zcmd
Reply
#5

Tenta assim entгo:
pawn Код:
if(strcmp(cmd, "/soltar", true) == 0)
{
    new aname[MAX_PLAYER_NAME];
    GetPlayerName(playerid, aname, MAX_PLAYER_NAME);
    format(file, sizeof(file), PASTA_CONTAS, aname);
    if(pAdmin[playerid]  == 1 || pAdmin[playerid] == 2 || pAdmin[playerid] == 3 || pAdmin[playerid] == 4 || dini_Int(file, "Profissao") == Prefeito || dini_Int(file, "Profissao") == Presidente ||  dini_Int(file, "Profissao") == Guardiao || dini_Int(file, "Profissao") == Advogado || pAdmin[playerid] == 5)
    {
        new tmp[256],plid;
        tmp = strtok(cmdtext, idx);
        if(!strlen(tmp)) return SendClientMessage(playerid, Vermelho, "(ERRO) Use: /soltar [id]");
        plid = strval(tmp);
        if(!IsPlayerConnected(plid)) return SendClientMessage(playerid, Vermelho, "(ERRO) O jogador nгo estб online");
        if(Preso[plid] == 0) return SendClientMessage(playerid, Vermelho, "Este Player nao Esta Preso. ");
        new pname[MAX_PLAYER_NAME];
        GetPlayerName(plid, pname, MAX_PLAYER_NAME);
        format(file2, sizeof(file2), PASTA_CONTAS, pname);
        SendClientMessage(plid, Aviso, string);
        dini_IntSet(file2, "Preso", 0);
        preso[plid] = 0;
        SetPlayerHealth(plid,100);
        Preso[plid] = 0;
        algemado[plid] = 0;
        SpawnPlayer(plid);
        SendClientMessage(playerid, COLOR_GREEN, "(INFO) Jogador Solto !");
    }
    else return SendClientMessage(playerid,Vermelho,"(ERRO) Vocк nгo й um Advogado");
    return 1;
}
Jб usei desse jeito (nгo com essas variбveis) e dб certinho ^^
Reply
#6

Nгo testei mas parece que funciona

@Edit: Eu retirei o 2є return que fiz '-'
tenta ai.


pawn Код:
if(strcmp(cmd, "/soltar", true) == 0) {
new aname[MAX_PLAYER_NAME];
GetPlayerName(playerid, aname, MAX_PLAYER_NAME);
format(file, sizeof(file), PASTA_CONTAS, aname);
if(pAdmin[playerid]  == 1 || pAdmin[playerid] == 2 || pAdmin[playerid] == 3 || pAdmin[playerid] == 4 || dini_Int(file, "Profissao") == Prefeito || dini_Int(file, "Profissao") == Presidente ||  dini_Int(file, "Profissao") == Guardiao || dini_Int(file, "Profissao") == Advogado || pAdmin[playerid] == 5){
new tmp[256];
new plid;
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)){
SendClientMessage(playerid, Vermelho, "(ERRO) Use: /soltar [id]");
return 1;
}
plid = strval(tmp);
if(!IsPlayerConnected(plid)){
SendClientMessage(playerid, Vermelho, "(ERRO) O jogador nгo estб online");
return 1;
}
plid = strval(tmp);
if(IsPlayerConnected(plid)){
if(Preso[plid] == 0)
SendClientMessage(playerid, Vermelho, "Este Player nao Esta Preso. ");
return 1;
}else {
new pname[MAX_PLAYER_NAME];
GetPlayerName(plid, pname, MAX_PLAYER_NAME);
format(file2, sizeof(file2), PASTA_CONTAS, pname);
SendClientMessage(plid, Aviso, string);
dini_IntSet(file2, "Preso", 0);
preso[plid] = 0;
SetPlayerHealth(plid,100);
Preso[plid] = 0;
algemado[plid] = 0;
SpawnPlayer(plid);
SendClientMessage(playerid, COLOR_GREEN, "(INFO) Jogador Solto !");
return 1;
}
} else {
SendClientMessage(playerid,Vermelho,"(ERRO) Vocк nгo й um Advogado");
return 1;
}
}
Reply
#7

Quote:
Originally Posted by ShutDown_
Посмотреть сообщение
Nгo testei mas parece que funciona
pawn Код:
if(strcmp(cmd, "/soltar", true) == 0) {
new aname[MAX_PLAYER_NAME];
GetPlayerName(playerid, aname, MAX_PLAYER_NAME);
format(file, sizeof(file), PASTA_CONTAS, aname);
if(pAdmin[playerid]  == 1 || pAdmin[playerid] == 2 || pAdmin[playerid] == 3 || pAdmin[playerid] == 4 || dini_Int(file, "Profissao") == Prefeito || dini_Int(file, "Profissao") == Presidente ||  dini_Int(file, "Profissao") == Guardiao || dini_Int(file, "Profissao") == Advogado || pAdmin[playerid] == 5){
new tmp[256];
new plid;
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)){
SendClientMessage(playerid, Vermelho, "(ERRO) Use: /soltar [id]");
return 1;
}
plid = strval(tmp);
if(!IsPlayerConnected(plid)){
SendClientMessage(playerid, Vermelho, "(ERRO) O jogador nгo estб online");
return 1;
}
plid = strval(tmp);
if(!IsPlayerConnected(plid)){
if(Preso[plid] == 0)
return SendClientMessage(playerid, Vermelho, "Este Player nao Esta Preso. ");
return 1;
}else {
new pname[MAX_PLAYER_NAME];
GetPlayerName(plid, pname, MAX_PLAYER_NAME);
format(file2, sizeof(file2), PASTA_CONTAS, pname);
SendClientMessage(plid, Aviso, string);
dini_IntSet(file2, "Preso", 0);
preso[plid] = 0;
SetPlayerHealth(plid,100);
Preso[plid] = 0;
algemado[plid] = 0;
SpawnPlayer(plid);
SendClientMessage(playerid, COLOR_GREEN, "(INFO) Jogador Solto !");
return 1;
}
} else {
SendClientMessage(playerid,Vermelho,"(ERRO) Vocк nгo й um Advogado");
return 1;
}
}
Agora o cуdigo lascou-se completamente D: Presta atenзгo no que vocк fez.
Reply
#8

pawn Код:
if(strcmp(cmd, "/soltar", true) == 0)
{
    new aname[MAX_PLAYER_NAME];
    GetPlayerName(playerid, aname, MAX_PLAYER_NAME);
    format(file, sizeof(file), PASTA_CONTAS, aname);
    if(pAdmin[playerid]  == 1 || pAdmin[playerid] == 2 || pAdmin[playerid] == 3 || pAdmin[playerid] == 4 || dini_Int(file, "Profissao") == Prefeito || dini_Int(file, "Profissao") == Presidente ||  dini_Int(file, "Profissao") == Guardiao || dini_Int(file, "Profissao") == Advogado || pAdmin[playerid] == 5)
    {
        new tmp[256],plid;
        tmp = strtok(cmdtext, idx);
        if(!strlen(tmp)) return SendClientMessage(playerid, Vermelho, "(ERRO) Use: /soltar [id]");
        plid = strval(tmp);
        if(!IsPlayerConnected(plid)) return SendClientMessage(playerid, Vermelho, "(ERRO) O jogador nгo estб online");
        if(Preso[plid] == 0) return SendClientMessage(playerid, Vermelho, "Este Player nao Esta Preso. ");
        new pname[MAX_PLAYER_NAME];
        GetPlayerName(plid, pname, MAX_PLAYER_NAME);
        format(file2, sizeof(file2), PASTA_CONTAS, pname);
        SendClientMessage(plid, Aviso, string);
        dini_IntSet(file2, "Preso", 0);
        preso[plid] = 0;
        SetPlayerHealth(plid,100);
        Preso[plid] = 0;
        algemado[plid] = 0;
        SpawnPlayer(plid);
        SendClientMessage(playerid, COLOR_GREEN, "(INFO) Jogador Solto !");
        return 1;
    }
    else SendClientMessage(playerid,Vermelho,"(ERRO) Vocк nгo й um Advogado");
    return 1;
}
Reply
#9

pawn Код:
if(strcmp(cmd, "/soltar", true) == 0)
{
new aname[MAX_PLAYER_NAME];
GetPlayerName(playerid, aname, MAX_PLAYER_NAME);
format(file, sizeof(file), PASTA_CONTAS, aname);
if(pAdmin[playerid]  == 1 || pAdmin[playerid] == 2 || pAdmin[playerid] == 3 || pAdmin[playerid] == 4 || dini_Int(file, "Profissao") == Prefeito || dini_Int(file, "Profissao") == Presidente ||  dini_Int(file, "Profissao") == Guardiao || dini_Int(file, "Profissao") == Advogado || pAdmin[playerid] == 5){
new tmp[256];
new plid;
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)){
SendClientMessage(playerid, Vermelho, "(ERRO) Use: /soltar [id]");

plid = strval(tmp);
if(Preso[plid] == 0)
return SendClientMessage(playerid, Vermelho, "Este Player nao Esta Preso. ");
new pname[MAX_PLAYER_NAME];
GetPlayerName(plid, pname, MAX_PLAYER_NAME);
format(file2, sizeof(file2), PASTA_CONTAS, pname);
SendClientMessage(plid, Aviso, string);
dini_IntSet(file2, "Preso", 0);
preso[plid] = 0;
SetPlayerHealth(plid,100);
Preso[plid] = 0;
algemado[plid] = 0;
SpawnPlayer(plid);
SendClientMessage(playerid, COLOR_GREEN, "(INFO) Jogador Solto !");
}
return true;
}
Reply
#10

Quote:
Originally Posted by MatriXBorn
Посмотреть сообщение
pawn Код:
if(strcmp(cmd, "/soltar", true) == 0)
{
new aname[MAX_PLAYER_NAME];
GetPlayerName(playerid, aname, MAX_PLAYER_NAME);
format(file, sizeof(file), PASTA_CONTAS, aname);
if(pAdmin[playerid]  == 1 || pAdmin[playerid] == 2 || pAdmin[playerid] == 3 || pAdmin[playerid] == 4 || dini_Int(file, "Profissao") == Prefeito || dini_Int(file, "Profissao") == Presidente ||  dini_Int(file, "Profissao") == Guardiao || dini_Int(file, "Profissao") == Advogado || pAdmin[playerid] == 5){
new tmp[256];
new plid;
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)){
SendClientMessage(playerid, Vermelho, "(ERRO) Use: /soltar [id]");

plid = strval(tmp);
f(Preso[plid] == 0)
return SendClientMessage(playerid, Vermelho, "Este Player nao Esta Preso. ");
new pname[MAX_PLAYER_NAME];
GetPlayerName(plid, pname, MAX_PLAYER_NAME);
format(file2, sizeof(file2), PASTA_CONTAS, pname);
SendClientMessage(plid, Aviso, string);
dini_IntSet(file2, "Preso", 0);
preso[plid] = 0;
SetPlayerHealth(plid,100);
Preso[plid] = 0;
algemado[plid] = 0;
SpawnPlayer(plid);
SendClientMessage(playerid, COLOR_GREEN, "(INFO) Jogador Solto !");
}
return true;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)