• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Pawn] Why my code only sends "else"?
#1
Code:
for(new i = 0;i < 100;i)

{

if(PlayerInfo[i][cargo] != 0)

{

? ? GameTextForPlayer(i, "~r~Novo Report!", 3000, 5);

? ? GetPlayerName(id, reportado, sizeof(reportado));

? ? GetPlayerName(playerid, reportador, sizeof(reportador));

? ? format(report, sizeof(report), "Nick e id: %s [%d]\nMotivo: %s\nReportado por: %s", reportado, id, motivo, reportador);

? ? SendClientMessage(i, -1, "====={4291ff}Novo Report{FFFFFF}=====");

? ? SendClientMessage(i, -1, report);

}

else

{

SendClientMessage(i, -1, "asdadsadad");//I put it?in else?to prove that code only sends else

}



this code is a /report command. PlayerInfo[][cargo] == Admin level

despite my PlayerInfo[][cargo] != 0 in?game, this code keep sending the else,? considering?PlayerInfo[][cargo] == 0

Basically, it sends "?SendClientMessage(i, -1, "asdadsadad"); " for all online admins instead of the fist code,?and this is not what should happen



Fix it?is easy, obviously just invert?the codes.?But i want know WHY THIS OCCURS???
  Reply
#2
(2021-01-20, 12:50 PM)sampaux Wrote:
Code:
for(new i = 0;i < 100;i)

{

? if(PlayerInfo[i][cargo] != 0)

? {

? ? GameTextForPlayer(i, "~r~Novo Report!", 3000, 5);

? ? GetPlayerName(id, reportado, sizeof(reportado));

? ? GetPlayerName(playerid, reportador, sizeof(reportador));

? ? format(report, sizeof(report), "Nick e id: %s [%d]\nMotivo: %s\nReportado por: %s", reportado, id, motivo, reportador);

? ? SendClientMessage(i, -1, "====={4291ff}Novo Report{FFFFFF}=====");

? ? SendClientMessage(i, -1, report);

? }

? else

? {

? ? ?SendClientMessage(i, -1, "asdadsadad");//I put it?in else?to prove that code only sends else

? }

}





When u make a user is an admin, do u change the?PlayerInfo[playerid][cargo] value?
  Reply


Forum Jump: