INI_WriteInt, several %i/%s statements
#1

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);
Reply
#2

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);
Reply
#3

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.
Reply
#4

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


Forum Jump:


Users browsing this thread: 2 Guest(s)