25.09.2012, 06:54
Okay guys, well I have managed to fix the login system etc., but I am still confused about why my houses aren't loading properly. The labels and pickups are being created, but for some reason it's not reading the X, Y and Z positions of the house. Does this have any relevance to using INI_Float? The /addhouse command works fine, but when the server is restarted, all pickups and labels are spawning at 0, 0, 0. Which I am guessing, means that it isn't loading the PosX, PosY and PosZ variables with INI_ParseFile.
Addhouse command:
Addhouse command:
pawn Код:
CMD:addhouse(playerid,params[])
{
if(!IsPlayerAdmin(playerid) || Player[playerid][Admin] < 10) return SendClientMessage(playerid, red, "ERROR: {FFFFFF}You Have Entered An Invalid Command. Please Read {00FF00}/CMDS{FFFFFF}.");
for(new i = 0; i < MAX_HOUSES; i++)
{
new string[50];
format(string,sizeof(string),HOUSEPATH,i);
if(!fexist(string))
{
new Float:X, Float:Y, Float:Z;
GetPlayerPos(playerid, X, Y, Z);
INI_ParseFile(string, "LoadHouse_%i", .bExtra = true, .extra = i);
House[i][Pickup] = CreateDynamicPickup(1272, 1, X, Y, Z);
House[i][PosX] = X;
House[i][PosY] = Y;
House[i][PosZ] = Z;
House[i][Owned] = 0;
format(string,sizeof(string),"For Sale");
House[i][OwnerName] = string;
format(string,sizeof(string),"House ID %d", i);
House[i][Name] = string;
format(string,sizeof(string),"No Key Holder");
House[i][Key1] = string;
House[i][Key2] = string;
House[i][Key3] = string;
format(string,sizeof(string),"House: %s\nOwner: %s\nID: %d",House[i][Name],House[i][OwnerName],i);
House[i][Label] = CreateDynamic3DTextLabel(string, green, House[i][PosX], House[i][PosY], House[i][PosZ], 100.00);
format(string,sizeof(string),"You Have Successfully Created House ID %d", i);
SendClientMessage(playerid, green, string);
SaveHouse(i);
break;
}
continue;
}
return 1;
}