[SOLVED] Problem With Reading File Then Display Value - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: [SOLVED] Problem With Reading File Then Display Value (
/showthread.php?tid=71513)
[SOLVED] Problem With Reading File Then Display Value -
Alec24 - 01.04.2009
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: "
Re: Problem With Reading File Then Display Value -
westre - 01.04.2009
Try this:
Код:
format(Stats, sizeof(Stats), "[STATS] Job Level: %d | Current Truck ID: %d | Jobs Finished: %d", JobLevel[playerid], TruckType[playerid], JobsDone[playerid]);
Re: Problem With Reading File Then Display Value -
Alec24 - 01.04.2009
Thanks That Worked!