13.02.2013, 22:18
When I /createhouse somewhere it saves in the Scriptfiles only once as %i
pawn Код:
#define HousePath "Houses/%i.ini"
new hCount;
CMD:createhouse(playerid, params[])
{
if(pInfo[playerid][Admin]==3)
{
new hPrice,id=hCount;
if(sscanf(params,"i",hPrice)) return SendClientMessage(playerid,COLOR_GRAY,"USAGE: /createhouse [price]");
new Float:x,Float:y,Float:z;
GetPlayerPos(playerid,x,y,z);
hInfo[id][Price] = hPrice;
hInfo[id][Owned] = 0;
hInfo[id][Xpos] = x;
hInfo[id][Ypos] = y;
hInfo[id][Zpos] = z;
hInfo[id][World] = GetPlayerVirtualWorld(playerid);
format(hInfo[id][Owner],24,"Dale");
SendClientMessage(playerid,-1,"House created");
hEnter[id] = CreateDynamicCP(x,y,z,1.5,GetPlayerVirtualWorld(playerid));
hExit[id] = CreateDynamicCP(443.9237,509.4609,1001.4195,1.5,GetPlayerVirtualWorld(playerid));
new str[100];
new INI:file = INI_Open(HousePath);
INI_WriteInt(file,"Price",hPrice);
INI_WriteInt(file,"Owned",0);
INI_WriteFloat(file,"Xpos",x);
INI_WriteFloat(file,"Ypos",y);
INI_WriteFloat(file,"Zpos",z);
INI_WriteInt(file,"World",GetPlayerVirtualWorld(playerid));
INI_WriteString(file,"Owner","Dale");
INI_Close(file);
format(str,sizeof(str),"Owned: No \nPrice: $%i",hPrice);
hInfo[id][Label] = Create3DTextLabel(str,COLOR_GREEN,x,y,z,7,GetPlayerVirtualWorld(playerid));
hCount++;
}
return 1;
}