[SOLVED] Dialogs / Age
#1

Solved, Problem was in LoadPlayerStats(playerid);
Okay. So I made a dialog with ages 16-50. When they choose an age, it should be set by using "listitem+16". I thought that pawn could do simple maths, & instead of using 34 if statements i'd just use that (listitem+16). But this isn't working, it just returns 0 all the time. I need a simpler way that will work.
Any ideas would be appreciated.
pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    new
      string[128],
      name[MAX_PLAYER_NAME],
        file[128];
     
    GetPlayerName(playerid, name, sizeof(name));
    format(file, sizeof(file), "%s.ini", name);
   
    if (dialogid == DIALOG_AGE)
    {
      if (response == 1)
      {
        dini_Create(file);
            dini_IntSet(file, "pAdminLevel", 0);
          dini_IntSet(file, "pAge", 16+listitem);
          LoadPlayerStats(playerid);
        format(string, sizeof(string), "You've select age %d!", PlayerInfo[playerid][pAge]);
        SendClientMessage(playerid, COLOR_GREEN, string);
        format(string, sizeof(string), "Account Successfully Created (Name: %s || Age: %d)!", name, PlayerInfo[playerid][pAge]);
        SendClientMessage(playerid, COLOR_BLUE, string);
        TogglePlayerControllable(playerid, 1);
        SpawnPlayer(playerid);
        /*
        SetPlayerPos(playerid, X, Y, Z);
        SetPlayerFacingAngle(playerid, A);
        SetPlayerInterior(playerid, I);
        */

        return true;
        }
        else if (response == 0)
        {
          SendClientMessage(playerid, COLOR_RED, "You have canceled!");
          Kick(playerid);
          return true;
        }
    }
    return true;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)