INI file error - 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)
+--- Thread: INI file error (
/showthread.php?tid=419359)
INI file error -
Nathan_Taylor - 28.02.2013
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.
Respuesta: INI file error -
OPremium - 28.02.2013
INI_Write
Int, 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
Re: Respuesta: INI file error -
Nathan_Taylor - 28.02.2013
Quote:
Originally Posted by OPremium
INI_Write Int, 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*