[Ajuda]cmd fail
#1

alguem poderia concertar meu cmd?

pawn Код:
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, "Digite: /prender [id] [motivo]");
return 1;
}
plid = strval(tmp);
if(IsPlayerConnected(plid)){
new length = strlen(cmdtext);
while ((idx < length) && (cmdtext[idx] <= ' ')) {
idx++;
}
new offset = idx;
new result[64];
while ((idx < length) && ((idx - offset) < (sizeof(result) - 1))) {
result[idx - offset] = cmdtext[idx];
idx++;
}
result[idx - offset] = EOS;
if(!strlen(result))
{
SendClientMessage(playerid, Vermelho, "Uso: /prender [id] [motivo]");
}else{
new pname[MAX_PLAYER_NAME];
GetPlayerName(plid, pname, MAX_PLAYER_NAME);
format(string, sizeof(string), "(INFO) O Policial %s Prendeu o jogador %s (Motivo: %s)", aname,pname,result);
SendClientMessageToAll(tcadm, string);
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;
} 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, COLOR_GREEN, "(INFO) Preso com sucesso.");
preso[plid] = 1;
TogglePlayerControllable(plid, 1);
if(Procurados[plid] == 1){
GivePlayerGrana(playerid,5000);
Procurados[plid] = 0;
SendClientMessage(playerid, Verde, "(INFO) Vocк prendeu um jogador procurado e ganhou 5 mil!");
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;
}
}
Reply
#2

Qual poblema que ele tem? (nao vi o codigo ainda)
Reply
#3

simplismente nao compila
pode ser chaves....
eu n consegui arrumar por isso postei aki D:
Reply
#4

peguei do gm BWE , acho que й igual tenta:

pawn Код:
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;
} 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, COLOR_GREEN, "(INFO) Preso com sucesso.");
SetPlayerWantedLevel(plid, 0);
preso[plid] = 1;
TogglePlayerControllable(plid, 1);
if(Procurados[plid] == 1){
GivePlayerGrana(playerid,5000);
Procurados[plid] = 0;
SendClientMessage(playerid, Verde, "(INFO) Vocк prendeu um jogador procurado e ganhou 5 mil!");
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;
}
}
Reply
#5

pawn Код:
if(!strcmp(cmd, "/prender", true))
{
    new nomes[MAX_PLAYER_NAME][2];
    GetPlayerName(playerid, nomes[0], MAX_PLAYER_NAME);
    format(file, sizeof(file), PASTA_CONTAS, nomes[0]);
    new profissao = dini_Int(file, "Profissao"), admin = dini_Int(file, "aAdmin");
    if(profissao == Policial_C || profissao == Policial_F || profissao == Delegado || profissao == Bope || profissao == Swat || profissao == Narcoticos || profissao == Policial_M || profissao == FBI || profissao == LSPD || admin == 1)
    {
        new tmp[128];
        new plid;
        tmp = strtok(cmdtext, idx);
        if(!strlen(tmp))
            return SendClientMessage(playerid, Vermelho, "Digite: /prender [id] [motivo]");

        plid = strval(tmp);
        if(!IsPlayerConnected(plid) || plid == playerid) return 1;

        if(IsPlayerInAnyVehicle(plid) || IsPlayerInAnyVehicle(playerid)) return
            SendClientMessage(playerid, Vermelho, "(ERRO) Alguem estб dentro de um carro.");
        if(GetDistanceBetweenPlayers(plid,playerid) < 10) return SendClientMessage(playerid, -1, "Longe demais.");

        GetPlayerName(plid, nomes[1], MAX_PLAYER_NAME);
        new file2[MAX_PLAYER_NAME+20];
        format(file2, sizeof(file2), PASTA_CONTAS, nomes[0]);
        new length = strlen(cmdtext);
        while ((idx < length) && (cmdtext[idx] <= ' ')) {
            idx++;
        }
        new offset = idx, result[64];
        while ((idx < length) && ((idx - offset) < (sizeof(result) - 1))) {
            result[idx - offset] = cmdtext[idx];
            idx++;
        }
        result[idx - offset] = EOS;
        if(!strlen(result))
            return SendClientMessage(playerid, Vermelho, "Uso: /prender [id] [motivo]");
        format(string, sizeof(string), "(INFO) O Policial %s Prendeu o jogador %s (Motivo: %s)", aname,nomes[1],result);
        SendClientMessageToAll(tcadm, string);
        format(string, sizeof(string), "(INFO) O Policial %s te prendeu.", nomes[0]);
        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, COLOR_GREEN, "(INFO) Preso com sucesso.");
        preso[plid] = 1;
        TogglePlayerControllable(plid, 1);
        if(Procurados[plid] == 1) {
            GivePlayerGrana(playerid,5000);
            Procurados[plid] = 0;
            SendClientMessage(playerid, Verde, "(INFO) Vocк prendeu um jogador procurado e ganhou 5 mil!");
            dini_IntSet(file2, "Procurado", 0);
        }
        return 1;
    }
    return 1;
}
Identado e editado p/vocк, se compilar da reputation.

Vou pro meu tйcnico inform. agora, flw
Reply
#6

PHP код:
        GetPlayerName(plidnomes[1], MAX_PLAYER_NAME);
        new 
file2[MAX_PLAYER_NAME+60];
        
format(file1sizeof(file2), PASTA_CONTASnomes[0]);
        new 
length strlen(cmdtext);
        while ((
idx length) && (cmdtext[idx] <= ' ')) { 
Reply
#7

Nгo indentei porque estou com preguiзa!
pawn Код:
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, "Digite: /prender [id] [motivo]");
return 1;
}
plid = strval(tmp);
if(IsPlayerConnected(plid)){
new length = strlen(cmdtext);
while ((idx < length) && (cmdtext[idx] <= ' ')) {
idx++;
}
new offset = idx;
new result[64];
while ((idx < length) && ((idx - offset) < (sizeof(result) - 1))) {
result[idx - offset] = cmdtext[idx];
idx++;
}
result[idx - offset] = EOS;
if(!strlen(result))
{
SendClientMessage(playerid, Vermelho, "Uso: /prender [id] [motivo]");
}else{
new pname[MAX_PLAYER_NAME];
GetPlayerName(plid, pname, MAX_PLAYER_NAME);
format(string, sizeof(string), "(INFO) O Policial %s Prendeu o jogador %s (Motivo: %s)", aname,pname,result);
SendClientMessageToAll(tcadm, string);
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;
} 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, COLOR_GREEN, "(INFO) Preso com sucesso.");
preso[plid] = 1;
TogglePlayerControllable(plid, 1);
if(Procurados[plid] == 1){
GivePlayerGrana(playerid,5000);
Procurados[plid] = 0;
SendClientMessage(playerid, Verde, "(INFO) Vocк prendeu um jogador procurado e ganhou 5 mil!");
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;
}
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)