[AYUDA] CMD Para ver Policias Conectados
#1

Bueno yo ise un CMD Pero Resulta lo siguiente miren:

pawn Код:
if (strcmp(cmd, "/policias", true) == 0)
{
if(IsPlayerConnected(playerid))
{
SendClientMessage(playerid, COLOR_GRAD1, "Policias en Linea:");
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if(PlayerInfo[i][pMember] == 1 || PlayerInfo[i][pLeader] == 1)
{
new PoliciasP[MAX_PLAYERS];
format(string, 256, " ** Polis: %d ** ",PoliciasP);//Si hay alguno conectado dira la cantidad de los q estan conectado
SendClientMessage(playerid, TEAM_GROVE_COLOR, string);
}
else
{
format(string, 256, " ** Polis: Ninguno ** ");//Si no hay ninguno conectado
SendClientMessage(playerid, TEAM_GROVE_COLOR, string);
}
}
}
}
return 1;
}
Resulta q en ves de aparecer 1 aparece 0 cuando hay un policia conectado como se aregla eso? para q diga 1 en adelante espero ayudas gracias.
Reply
#2

pawn Код:
if (strcmp(cmd, "/policias", true) == 0)
{
new polis;

SendClientMessage(playerid, COLOR_GRAD1, "Policias en Linea:");
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))if(PlayerInfo[i][pMember] == 1 || PlayerInfo[i][pLeader] == 1)polis++;
}
if(polis >= 1)
{
new string[MAX_PLAYERS];
format(string, 256, " ** Polis: %d ** ",PoliciasP);//Si hay alguno conectado dira la cantidad de los q estan conectado
SendClientMessage(playerid, TEAM_GROVE_COLOR, string);
}
else
{
new string[MAX_PLAYERS];
format(string, 256, " ** Polis: Ninguno ** ");//Si no hay ninguno conectado
SendClientMessage(playerid, TEAM_GROVE_COLOR, string);
}
return 1;
}
Ahy deve funcionar perfecto!

EDIT: tenias un error que no corregi!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)