SA-MP Forums Archive
INI_WriteInt, several %i/%s statements - 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_WriteInt, several %i/%s statements (/showthread.php?tid=416022)



INI_WriteInt, several %i/%s statements - reckst4r - 15.02.2013

I'm trying to do something like this:
pawn Код:
INI_WriteInt(gFile, "%s = CreateObject(%i, %i, %i, %i, %i, %i, %i /*Added by %s*/", gName, gModel, gPosX, gPosY, gPosZ, gRotX, gRotY, gRotZ, GetPlayerName(playerid));
but apparently it's to many arguments or something. "argument type mismatch (argument 3)"

This is the code/script:
pawn Код:
new string[128];
        new gName[9];
        new gModel[4];
        new gPosX[9];
        new gPosY[9];
        new gPosZ[9];
        new gRotX[9];
        new gRotY[9];
        new gRotZ[9];
        if(sscanf(params, "siiiiiiis", gName, gModel, gPosX, gPosY, gPosZ, gRotX, gRotY, gRotZ)) return SendClientMessage(playerid, COLOR_GREY, "USAGE: /addgate [gateName] [modelid] [posX] [posY] [posZ] [rotX] [rotY] [rotZ]");
       
        new INI:gFile = INI_Open("gates.txt");
        INI_WriteInt(gFile, "%s = CreateObject(%i, %i, %i, %i, %i, %i, %i /*Added by %s*/", gName, gModel, gPosX, gPosY, gPosZ, gRotX, gRotY, gRotZ, GetPlayerName(playerid));
        INI_Close(gFile);



Re: INI_WriteInt, several %i/%s statements - Misiur - 15.02.2013

pawn Код:
INI_WriteInt(gFile, "%s = CreateObject(%i, %i, %i, %i, %i, %i, %i /*Added by %s*/", gName, gModel, gPosX, gPosY, gPosZ, gRotX, gRotY, gRotZ, GetPlayerName(playerid));
//changes to
format(string, sizeof(string), "CreateObject(%i, %i, %i, %i, %i, %i, %i /*Added by %s*/", gModel, gPosX, gPosY, gPosZ, gRotX, gRotY, gRotZ, GetPlayerName(playerid));
INI_WriteString(gFile, gName, string);



Re: INI_WriteInt, several %i/%s statements - reckst4r - 15.02.2013

Quote:
Originally Posted by Misiur
Посмотреть сообщение
pawn Код:
INI_WriteInt(gFile, "%s = CreateObject(%i, %i, %i, %i, %i, %i, %i /*Added by %s*/", gName, gModel, gPosX, gPosY, gPosZ, gRotX, gRotY, gRotZ, GetPlayerName(playerid));
//changes to
format(string, sizeof(string), "CreateObject(%i, %i, %i, %i, %i, %i, %i /*Added by %s*/", gModel, gPosX, gPosY, gPosZ, gRotX, gRotY, gRotZ, GetPlayerName(playerid));
INI_WriteString(gFile, gName, string);
It says that the number of arguments doesn't match the definition, at the format line.


Re: INI_WriteInt, several %i/%s statements - Misiur - 15.02.2013

pawn Код:
new name[MAX_PLAYER_NAME + 1];
GetPlayerName(playerid, name);
and in format line change GetPlayerName(playerid) to name