[SOLVED] Problem With Reading File Then Display Value
#1

It should read the values from a file then display some of the text on a /stats command.

pawn Код:
if(strcmp(cmd, "/stats", true) == 0)
    {
    if(Logged[playerid] == 1)
    {
    new Stats[128];
    TruckType[playerid] = dini_Int(udb_encode(PlayerName), "TruckType");
    JobsDone[playerid] = dini_Int(udb_encode(PlayerName), "JobsDone");
    JobLevel[playerid] = dini_Int(udb_encode(PlayerName), "JobLevel");
        format(Stats, sizeof(Stats), "[STATS] Job Level: %s | Current Truck ID: %s | Jobs Finished: %s", JobLevel[playerid], TruckType[playerid], JobsDone[playerid]);
    SendClientMessage(playerid, COLOUR_LIGHTBLUE, Stats);
    }
    else
    {
      SendClientMessage(playerid, COLOUR_RED, "Please First Login: /login [password]");
    }
        return 1;
  }


There is no errors but in the game it will not display.

The file looks like this:
Код:
password=*******
AdminLevel=5
Money=2500
TruckType=413
JobsDone=0
JobLevel=1
Skin=261
Instead it shows as "[STATS] Job Level: | Current Truck ID: | Jobs Finished: "
Reply
#2

Try this:

Код:
format(Stats, sizeof(Stats), "[STATS] Job Level: %d | Current Truck ID: %d | Jobs Finished: %d", JobLevel[playerid], TruckType[playerid], JobsDone[playerid]);
Reply
#3

Thanks That Worked!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)