[REP+much love]Problem with dini - file creating
#1

All lines creating but without values - everything is 0. what is bad ?!
only password works.
Код:
    new player[64];
    new PlayerName[MAX_PLAYER_NAME];
    GetPlayerName(playerid,PlayerName,sizeof(PlayerName));
    format(player,sizeof(player), ACCOUNTS ,PlayerName);
    dini_Create(player);
    dini_Set(player,"Password",key);
    dini_IntSet(player,"Money",3000);
    dini_IntSet(player,"Points",0);
    dini_IntSet(player,"ActualCar",503);
    dini_IntSet(player,"ClassC-HAVE",1);
    dini_IntSet(player,"ClassC-COLOR1",23);
    dini_IntSet(player,"ClassC-COLOR2",23);
    dini_FloatSet(player,"ClassC-HEALTH",1000.0);
    dini_IntSet(player,"ClassC-TIRES",60);
    dini_IntSet(player,"ClassB-HAVE",0);
    dini_IntSet(player,"ClassB-COLOR1",23);
    dini_IntSet(player,"ClassB-COLOR2",23);
    dini_FloatSet(player,"ClassB-HEALTH",1000.0);
    dini_IntSet(player,"ClassB-TIRES",60);
    dini_IntSet(player,"ClassA-HAVE",0);
    dini_IntSet(player,"ClassA-COLOR1",23);
    dini_IntSet(player,"ClassA-COLOR2",23);
    dini_FloatSet(player,"ClassA-HEALTH",1000.0);
    dini_IntSet(player,"ClassA-TIRES",60);
Reply
#2

try to change your dini include
maybe it will be ok
i don't know
Reply
#3

still nothing but catch the rep+.

where is the problem, maybe in another part of code? loading works, save too.
Reply
#4

Quote:
Originally Posted by cnoopers
Посмотреть сообщение
still nothing but catch the rep+.

where is the problem, maybe in another part of code? loading works, save too.
i tested it:
pawn Код:
#include <a_samp>
#include <dini>

public OnFilterScriptInit()
{

    new player[] = "dini/account.ini";
    dini_Create(player);
    dini_Set(player,"Password","123");
    dini_IntSet(player,"Money",3000);
    dini_IntSet(player,"Points",0);
    dini_IntSet(player,"ActualCar",503);
    dini_IntSet(player,"ClassC-HAVE",1);
    dini_IntSet(player,"ClassC-COLOR1",23);
    dini_IntSet(player,"ClassC-COLOR2",23);
    dini_FloatSet(player,"ClassC-HEALTH",1000.0);
    dini_IntSet(player,"ClassC-TIRES",60);
    dini_IntSet(player,"ClassB-HAVE",0);
    dini_IntSet(player,"ClassB-COLOR1",23);
    dini_IntSet(player,"ClassB-COLOR2",23);
    dini_FloatSet(player,"ClassB-HEALTH",1000.0);
    dini_IntSet(player,"ClassB-TIRES",60);
    dini_IntSet(player,"ClassA-HAVE",0);
    dini_IntSet(player,"ClassA-COLOR1",23);
    dini_IntSet(player,"ClassA-COLOR2",23);
    dini_FloatSet(player,"ClassA-HEALTH",1000.0);
    dini_IntSet(player,"ClassA-TIRES",60);
   
    return 1;
}
and the file looks like
Код:
Password=123
Money=3000
Points=0
ActualCar=503
ClassC-HAVE=1
ClassC-COLOR1=23
ClassC-COLOR2=23
ClassC-HEALTH=1000.000000
ClassC-TIRES=60
ClassB-HAVE=0
ClassB-COLOR1=23
ClassB-COLOR2=23
ClassB-HEALTH=1000.000000
ClassB-TIRES=60
ClassA-HAVE=0
ClassA-COLOR1=23
ClassA-COLOR2=23
ClassA-HEALTH=1000.000000
ClassA-TIRES=60
so everything works... i wonder why it's all 0 for you though :/

show us where and most importantly how you defined "ACCOUNTS"
Reply
#5

Код:
#define ACCOUNTS "/Accounts/%s.ini"
It must be okay, file is creating.
Reply
#6

pawn Код:
GetPlayerName(playerid,PlayerName,sizeof(PlayerName));
format(player,sizeof(player),"ACCOUNTS/%s.ini" ,PlayerName);
I'm not a master at dini, however this may/ might work. Make sure you create a folder called "ACCOUNTS" in scriptfiles. Try this.
Reply
#7

Folder exist, I wrote - file is creating but every value is 0.
Reply
#8

Quote:
Originally Posted by cnoopers
Посмотреть сообщение
Код:
#define ACCOUNTS "/Accounts/%s.ini"
It must be okay, file is creating.
ye looks legit..
hmm... it must be something in your script setting it all to 0.
you said that loading and saving works.
look, what if it gets created, you disconnect and then
you do the saving thing and it sets all to 0 besides the password.

that actually might be what's happening here!
try it like i did, make a small fs which only creates the file and sets the values
and nothing else besides this.
if it works, this means that it all gets set to 0 due to a mistake somewhere
where you save the values.
Nah that's it 100% sure, check that part of your script where you save stuff
Reply
#9

solved! reputation for everybody

Код:
new classchave[MAX_PLAYERS];
new classccolor1[MAX_PLAYERS];
new classccolor2[MAX_PLAYERS];
new classchealth[MAX_PLAYERS];
new classctires[MAX_PLAYERS];

new classbhave[MAX_PLAYERS];
new classbcolor1[MAX_PLAYERS];
new classbcolor2[MAX_PLAYERS];
new classbhealth[MAX_PLAYERS];
new classbtires[MAX_PLAYERS];

new classahave[MAX_PLAYERS];
new classacolor1[MAX_PLAYERS];
new classacolor2[MAX_PLAYERS];
new classahealth[MAX_PLAYERS];
new classatires[MAX_PLAYERS];
Stupid logic error.
Tables wasn't be setted after register!

by the way, my money is not refreshing automallity. i must use SetMoney(playerid, GetMoney(playerid)); (natives from my anty-moneycheat, it's not the reason - i tested without too).
Where could be problem?
Reply
#10

Quote:
Originally Posted by cnoopers
Посмотреть сообщение
solved! reputation for everybody

Код:
new classchave[MAX_PLAYERS];
new classccolor1[MAX_PLAYERS];
new classccolor2[MAX_PLAYERS];
new classchealth[MAX_PLAYERS];
new classctires[MAX_PLAYERS];

new classbhave[MAX_PLAYERS];
new classbcolor1[MAX_PLAYERS];
new classbcolor2[MAX_PLAYERS];
new classbhealth[MAX_PLAYERS];
new classbtires[MAX_PLAYERS];

new classahave[MAX_PLAYERS];
new classacolor1[MAX_PLAYERS];
new classacolor2[MAX_PLAYERS];
new classahealth[MAX_PLAYERS];
new classatires[MAX_PLAYERS];
Stupid logic error.
Tables wasn't be setted after register!

by the way, my money is not refreshing automallity. i must use SetMoney(playerid, GetMoney(playerid)); (natives from my anty-moneycheat, it's not the reason - i tested without too).
Where could be problem?
GivePlayerMoney and ResetPlayerMoney are the only functions capable of updating the money bar (unless you have a custom one e.g. serversided money)

so you would have to use these functions if you want to change the value of the money bar
for example, we have serversided cash in a variable named "cash"
to show that cash on the bar, i'd reset it and give the "cash"
pawn Код:
ResetPlayerMoney(playerid);
GivePlayerMoney(playerid,cash);
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)