[Ajuda] Poblema no comando!
#1

Intгo meu poblema й este comando logo abaixo, Quando vou prender um player procurado jб pela policia, quando vai prender o player o comando diz O jogador nгo estб sendo procurado.



PHP код:
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") == Soldado || 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){
new 
tmp[256];
new 
plid;
tmp = strtok(cmdtext, idx);
if(!
strlen(tmp)){
SendClientMessage(playerid, Vermelho, "[ > ] Use: /prender [id]");
return 
1;
}
if(
dini_Int(file, "Level") <= 2){
SendClientMessage(playerid,Vermelho,"[ x ] Proibido prender novatos atй o level 3.");
return 
1;
}
plid = strval(tmp);
if(
IsPlayerInAnyVehicle(plid) == 1 || IsPlayerInAnyVehicle(playerid) == 1){
SendClientMessage(playerid, Vermelho, "[ > ] O Player estб dentro de um carro e nгo pode ser preso.");
return 
1 ;
}
if(
dini_IntSet(file2, "Procurado", 1)){
SendClientMessage(playerid, Vermelho, "[ x ] O jogador nгo estб sendo procurado.");
return 
1;
}
if(!
IsPlayerConnected(plid)){
SendClientMessage(playerid, Vermelho, "[ x ] O jogador nгo estб conectado");
return 
1;
} else {
if(
GetDistanceBetweenPlayers(plid,playerid) < 30){
new 
pname[MAX_PLAYER_NAME];
GetPlayerName(plid, pname, MAX_PLAYER_NAME);
format(file2, sizeof(file2), PASTA_CONTAS, pname);
format(string, sizeof(string), "[ PRISГO ] O(a) Policial %s te prendeu, vocк vai cumprir 10 minutos de prisгo.", aname);
SendClientMessage(plid, AzuL4, string);
SetPlayerPos(plid, 263.8820,77.4002,1001.0391);
SetPlayerInterior(plid, 6);
SetPlayerHealth(plid, 99999); // vida do player
SetPlayerArmour(playerid, 0.0); // colete do player
ResetPlayerWeapons(plid);
dini_IntSet(file2, "Preso", 1);
SendClientMessage(playerid, COLOR_GREEN, "[ > ] Preso com sucesso.");
SetPlayerWantedLevel(plid, 0);
preso[plid] = 1;
Mute[plid] = 1;
TogglePlayerControllable(plid, 1);
if(
Procurados[plid] == 1){
GivePlayerGrana(playerid,300);
Procurados[plid] = 0;
SendClientMessage(playerid, amarelo, "[ INFO ] Vocк ganhou $300 Por prender um procurado!");
dini_IntSet(file2, "Procurado", 0);
}
return 
1;
} else {
SendClientMessage(playerid,Vermelho,"[ x ] Chegue mais perto para prender!");
return 
1;
}
}
} else {
SendClientMessage(playerid,Vermelho,"[ x ] Apenas policiais podem usar este comando!");
return 
1;
}
} 
Reply
#2

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") == Soldado || 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){
new tmp[256];
new plid;
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)){
SendClientMessage(playerid, Vermelho, "[ > ] Use: /prender [id]");
return 1;
}
if(dini_Int(file, "Level") <= 2){
SendClientMessage(playerid,Vermelho,"[ x ] Proibido prender novatos atй o level 3.");
return 1;
}
plid = strval(tmp);
if(IsPlayerInAnyVehicle(plid) == 1 || IsPlayerInAnyVehicle(playerid) == 1){
SendClientMessage(playerid, Vermelho, "[ > ] O Player estб dentro de um carro e nгo pode ser preso.");
return 1 ;
}
if(dini_IntSet(file2, "Procurado", 0)){
SendClientMessage(playerid, Vermelho, "[ x ] O jogador nгo estб sendo procurado.");
return 1;
}
if(!IsPlayerConnected(plid)){
SendClientMessage(playerid, Vermelho, "[ x ] O jogador nгo estб conectado");
return 1;
} else {
if(GetDistanceBetweenPlayers(plid,playerid) < 30){
new pname[MAX_PLAYER_NAME];
GetPlayerName(plid, pname, MAX_PLAYER_NAME);
format(file2, sizeof(file2), PASTA_CONTAS, pname);
format(string, sizeof(string), "[ PRISГO ] O(a) Policial %s te prendeu, vocк vai cumprir 10 minutos de prisгo.", aname);
SendClientMessage(plid, AzuL4, string);
SetPlayerPos(plid, 263.8820,77.4002,1001.0391);
SetPlayerInterior(plid, 6);
SetPlayerHealth(plid, 99999); // vida do player
SetPlayerArmour(playerid, 0.0); // colete do player
ResetPlayerWeapons(plid);
dini_IntSet(file2, "Preso", 1);
SendClientMessage(playerid, COLOR_GREEN, "[ > ] Preso com sucesso.");
SetPlayerWantedLevel(plid, 0);
preso[plid] = 1;
Mute[plid] = 1;
TogglePlayerControllable(plid, 1);
if(Procurados[plid] == 1){
GivePlayerGrana(playerid,300);
Procurados[plid] = 0;
SendClientMessage(playerid, amarelo, "[ INFO ] Vocк ganhou $300 Por prender um procurado!");
dini_IntSet(file2, "Procurado", 0);
}
return 1;
} else {
SendClientMessage(playerid,Vermelho,"[ x ] Chegue mais perto para prender!");
return 1;
}
}
} else {
SendClientMessage(playerid,Vermelho,"[ x ] Apenas policiais podem usar este comando!");
return 1;
}
}
tenta

P.S: uma dica muda para sscanf
Reply


Forum Jump:


Users browsing this thread: