INI file error
#1

This is the code I am using to create a username.ini file

pawn Код:
new string[128];
new directory[128];
new name[MAX_PLAYER_NAME+1];
GetPlayerName(playerid, name, sizeof(name));
format(string, sizeof(string), "scriptfiles/users/%s.ini", name);
format(directory, sizeof(directory), "users/%s.ini", name);

if(!fexist(string))
{
    new INI: newFile = INI_Open (directory);
    INI_WriteInt(newFile, "username", name);
    INI_Close(newFile);

} else {
        SendClientMessage(playerid, COLOR_LIGHTBLUE, "Your account is registered.");
}
All it is doing is making a new file, and writing "username=[USERNAME]" in it, however, i get the follwing error

pawn Код:
F:\SAMP\gamemodes\naterp.pwn(250) : error 035: argument type mismatch (argument 3)
If I comment out line 250, it will create the file, but obviously, not write anything because I did not tell it to.
Reply
#2

INI_WriteInt, as it's name says, is for saving integer values, however, you are trying to save a string, that's why it's giving you error. Use INI_WriteString instead
Reply
#3

Quote:
Originally Posted by OPremium
Посмотреть сообщение
INI_WriteInt, as it's name says, is for saving integer values, however, you are trying to save a string, that's why it's giving you error. Use INI_WriteString instead
Oh, stupid me... *face palm*
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)