24.07.2013, 05:06
(
Последний раз редактировалось _Khaled_; 24.07.2013 в 06:20.
)
I'm converting from SSI to Y_INI and need to know how to do it
example:
I swear I'd appreciate any help here
example:
pawn Код:
stock LoadHouses(name[],value[])
{
new file[60],houseowner[24];
for(new i = 0; i < MAX_HOUSES_BUILT;i++)
{
format(file,sizeof(file),"Houses/%i.ini",i);
INI_Open(file);
INI_Int("Price", HInfo[i][Price]);
INI_Int("Owned", HInfo[i][Owned]);
INI_Float("posX", HInfo[i][posX]);
INI_Float("posY", HInfo[i][posY]);
INI_Float("posZ", HInfo[i][posZ]);
INI_Int("VirtualWorld", HInfo[i][VW]);
INI_String("Owner", HInfo[i][Owner], 24);
format(houseowner, sizeof(houseowner), "%s", HInfo[i][Owner]);
HousesEntrance[i] = CreateDynamicCP(HInfo[i][posX], HInfo[i][posY], HInfo[i][posZ], 1.5, HInfo[i][VW]);
HousesExit[i] = CreateDynamicCP(443.9237, 509.4609, 1001.4195, 1.5, HInfo[i][VW]);
new labelstring[100];
switch(HInfo[i][Owned])
{
case 0:{format(labelstring, sizeof(labelstring), ""#COL_GREEN#"Owned: "#COL_RED#"No \n"#COL_GREEN#"Price: "#COL_YELLOW#"%i", HInfo[i][Price]);}
case 1:{format(labelstring, sizeof(labelstring), ""#COL_GREEN#"Owned: "#COL_BLUE#"Yes \n"#COL_GREEN#"Price: "#COL_YELLOW#"%i \n"#COL_GREEN#"Owner: "#COL_VIOLET#"%s", HInfo[i][Price], HInfo[i][Owner]);}
}
HInfo[i][HouseLabel] = Create3DTextLabel(labelstring, 0xFF0000FF, HInfo[i][posX], HInfo[i][posY], HInfo[i][posZ], 25.0, HInfo[i][VW]);
Housesnumbers++;
INI_Close(); // warning 202: number of arguments does not match definition
}
return 1;
}
//Have 5 warnings like that in the script (same line)
//============================================================================================//
if(dialogid == 2001)
{
if(response)
{
for(new i = 0; i < MAX_HOUSES_BUILT;i++)
{
if(!IsPlayerInRangeOfPoint(playerid, 8.0, HInfo[i][posX], HInfo[i][posY], HInfo[i][posZ])) continue;
if(GetPlayerMoney(playerid) < HInfo[i][Price]) return SendClientMessage(playerid, COLOR_RED, "[ERROR] You don't have enough cash.");
if(HInfo[i][Owned] == 1) return SendClientMessage(playerid,COLOR_RED,"[ERROR] This house is already owned.");
HInfo[i][Owned] = 1;
new file[60], pName[24];
GetPlayerName(playerid, pName, sizeof(pName));
format(HInfo[i][Owner], 24, "%s", pName);
format(file,sizeof(file),"Houses/%i.ini", i);
INI_Open(file);
INI_WriteInt("Owned", 1); //error 035: argument type mismatch (argument 1)
INI_WriteString("Owner", pName);
INI_Close();
format(string,sizeof(string),""#COL_GREEN#"Owned: "#COL_WHITE#"Yes \n"#COL_GREEN#"Price: "#COL_RED#"%i \n"#COL_GREEN#"Owner: "#COL_WHITE#"%s", HInfo[i][Price], pName);
Update3DTextLabelText(HInfo[i][HouseLabel], 0xFF0000FF, string);
GivePlayerMoney(playerid, -HInfo[i][Price]);
return 1;
}
}
else
{
SendClientMessage(playerid, COLOR_RED, "[HOUSE] You canceled buying the house.");
}
return 1;
}
//I have 11 errors of that, then I'm done includes "INI_WriteString" "INI_WriteFloat" etc..