Problems with a combination of a loop and a string
#1

OMG, I really can't understand this bug!

pawn Код:
public OnPlayerSpawn(playerid)
{
  if(GetPlayerTeam(playerid) == 0) ShowPlayerDialog(playerid, DIALOG_SELECT_PLANE, DIALOG_STYLE_LIST, "Scegli un aeroplano in questa lista", "Boeing 737 800\nLockheed C5 Galaxy\nDeHavilland C7 Caribou\nCessna 172\nDouglas C3\nBombardier Learjet 35\nOracle Stunt Plane\nSirosky S-61\nSirosky HH-60\nBell 206 Jet Ranger\nSA 315B Lama", "Spawn", "");
  else if(GetPlayerTeam(playerid) == 1) PutPlayerInVehicle(playerid, CreateVehicle (485,BAGAGLIX, BAGAGLIY, BAGAGLIZ, 0, 1, 1, 1000000), 0);
  else
  {
    new string[256];
    for(new i=0;i<MAX_PLAYERS;i++)
    {
      if(Lavoro[i] == LAVORO_PILOTA && AereoDiLinea[playerid] == 1)
      {
        new name[128];
        if(Destinazione[i] == 0) format(name,sizeof(name), "%s - San Francisco", PlaneName[i]);
        else format(name,sizeof(name), "%s - Las Vegas", PlaneName[i]);
        format(string,sizeof(string), "%s%s\n", string, name);
      }
    }
    if(!strlen(string)) { ShowPlayerDialog(playerid, DIALOG_DIE, DIALOG_STYLE_LIST, "Nessun volo di linea disponibile", "Scegli un altro personaggio", "OK", ""); }
    Lavoro[playerid] = LAVORO_ALTRO;
    ShowPlayerDialog(playerid, DIALOG_SELECT_FLIGHT, DIALOG_STYLE_LIST, "Scegli un volo di linea", string, "Spawn", "");
  }
  return 1;
}
In every case shows the dialog of "if(!strlen(string))", so the string doesn't have any character, but It should!
Reply


Messages In This Thread
Problems with a combination of a loop and a string - by Sasino97 - 23.06.2011, 21:23
Re: Problems with a combination of a loop and a string - by Sasino97 - 25.06.2011, 19:44

Forum Jump:


Users browsing this thread: 3 Guest(s)