[Ajuda] Comando /desalgemar
#1

Boa Tarde!.

Coloquei um AttachObject no /algemar e o Destruir no /desalgemar, mais o problema й que quando o jogador nгo estб algemado qualquer um oficial pode desalgemar quantas vezes quizer e nisso da o Bug, aн vai meu cуdigo

Код:
if(strcmp(cmd, "/desalgemar", 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_M || 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") == FBI || dini_Int(file, "Profissao") == Interpol || 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: /desalgemar [id]");
return 1;
}
plid = strval(tmp);
if(IsPlayerInAnyVehicle(plid) == 1 || IsPlayerInAnyVehicle(playerid) == 1){
SendClientMessage(playerid, Vermelho, "(ERRO) Alguem estб dentro de um carro");
PlayerPlaySound(playerid, 1055, 0.0, 0.0, 0.0);
return 1 ;
}
if(plid == playerid){
SendClientMessage(playerid, Vermelho, "(ERRO) Vocк nгo pode tirar algemas de vocк mesmo.");
PlayerPlaySound(playerid, 1055, 0.0, 0.0, 0.0);
return 1 ;
}
if(!IsPlayerConnected(plid)){
SendClientMessage(playerid, Vermelho, "(ERRO) O jogador nгo estб conectado");
PlayerPlaySound(playerid, 1055, 0.0, 0.0, 0.0);
return 1;
} else {
if(GetDistanceBetweenPlayers(plid,playerid) < 5){
format(string, sizeof(string), "(INFO) O Policial %s te desalgemou.", aname);
SendClientMessage(plid, Blue, string);
TogglePlayerControllable(plid, 1);
SendClientMessage(playerid, COLOR_GREEN, "(INFO) Desalgemado com sucesso.");
SetPlayerSpecialAction(plid, 0);
RemovePlayerAttachedObject(playerid,4);
algemado[plid] = 0;
return 1;
} else {
SendClientMessage(playerid,Vermelho,"{EE0000}•{FFFFFF} Vocк estб muito distвnte do(a) jogador(a)");
PlayerPlaySound(playerid, 1055, 0.0, 0.0, 0.0);
return 1;
}
}
} else {
SendClientMessage(playerid,Vermelho,"{FF3030}Ч{FFFFFF} Vocк nгo й um(a) oficial !");
PlayerPlaySound(playerid, 1055, 0.0, 0.0, 0.0);
return 1;
}
}
Resumo
Eu quero que libere o /desalgemar somente se o jogador estiver algemado !
Reply
#2

pawn Код:
if(algemado[plid] == 0)
{
    SendClientMessage(playerid, Vermelho, "(ERRO) O jogador nгo ta algemado!");
    return 1;
}
Reply
#3

Eu sabia que nгo era difнcil, valeu aн pelo apoio !

+1 de reputaзгo adicionado !.

Resolvido !
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)