Y_INI [HELP]
#1

i am trying to save Score,Health with Y_ini & it isnt really working
This is the SCRIPT
pawn Code:
new gName[MAX_PLAYER_NAME];
new gScore;
new gMoney;

INI:UserFiles[](name[], value[])
{
    INI_String("NAME", gName, sizeof(gName));
    INI_Int("SCORE", gScore);
    INI_Int("MONEY", gMoney);
    return 0;
}

if(strcmp(cmd,"/test",true) == 0){
new INI:PlayerAccount = INI_Open("UserFiles.ini");
INI_WriteInt(PlayerAccount,"MONEY",5000);
INI_WriteInt(PlayerAccount,"SCORE",10);
INI_Close(PlayerAccount);
}
Reply
#2

Anyone ??
Reply
#3

PLS I NEED THIS !!!!
Reply
#4

Where do you get gMoney and gScore (which you got double) ?
Reply
#5

OK i changed it & still dont work ??
pawn Code:
if(strcmp(cmd,"/test",true) == 0){
new PlayerFile[128];
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
format(PlayerFile,sizeof PlayerFile,"/mRegistration/%s.ini",name);
new INI:PlayerAccount = INI_Open(PlayerFile);
INI_WriteInt(PlayerAccount,"MONEY",GetPlayerMoney(playerid));
INI_WriteInt(PlayerAccount,"SCORE",GetPlayerScore(playerid));
INI_Close(PlayerAccount);
SendClientMessage(playerid,COLOR_RED,"TEST DONE");
return 1;
}
Reply
#6

It's cause you don't get the players name.
Reply
#7

Quote:
Originally Posted by Jochemd
View Post
It's cause you don't get the players name.
Holly S*** yeah i forgot about that THX ill see if it works
Reply
#8

Still doesnt save ??
pawn Code:
if(strcmp(cmd,"/test",true) == 0){
new PlayerFile[128];
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
format(PlayerFile,sizeof PlayerFile,"/mRegistration/%s.ini",name);
new INI:PlayerAccount = INI_Open(PlayerFile);
INI_WriteInt(PlayerAccount,"MONEY",GetPlayerMoney(playerid));
INI_WriteInt(PlayerAccount,"SCORE",GetPlayerScore(playerid));
INI_Close(PlayerAccount);
SendClientMessage(playerid,COLOR_RED,"TEST DONE");
return 1;
}
Reply
#9

Is the folder created?
Reply
#10

Quote:
Originally Posted by Jochemd
View Post
Is the folder created?
YEAH
Reply
#11

File created?
Reply
#12

Quote:
Originally Posted by Jochemd
View Post
File created?
No it doesnt CREAT THE FILE i tried doing it with DINI and it didnt work so what could be the problem??
Reply
#13

Why doesnt it WORK
i am trying to save Score,Health with Y_ini & it isnt really working
This is the SCRIPT
pawn Code:
new gName[MAX_PLAYER_NAME];
new gScore;
new gMoney;

INI:UserFiles[](name[], value[])
{
    INI_String("NAME", gName, sizeof(gName));
    INI_Int("SCORE", gScore);
    INI_Int("MONEY", gMoney);
    return 0;
}

if(strcmp(cmd,"/test",true) == 0){
new INI:PlayerAccount = INI_Open("UserFiles.ini");
INI_WriteInt(PlayerAccount,"MONEY",5000);
INI_WriteInt(PlayerAccount,"SCORE",10);
INI_Close(PlayerAccount);
}
}
Reply
#14

Anyone know what the problem is ??
Reply
#15

Check this. Might help you.

https://sampforum.blast.hk/showthread.php?tid=210277
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)