31.08.2012, 17:55
Hello,
Okay now I made a create house cmd but I have a problem.The problem is that when I use the cmd it create the house as I want but when i try to create a second house,it creates the pickup but not the 3d textlable.No error or warning.
codes:
Okay now I made a create house cmd but I have a problem.The problem is that when I use the cmd it create the house as I want but when i try to create a second house,it creates the pickup but not the 3d textlable.No error or warning.
codes:
PHP код:
CMD:createhouse(playerid, params[])
{
if(IsPlayerAdmin(playerid))
{
new Float:x,Float:y,Float:z;
new HousePrice,id = HouseCount;
GetPlayerPos(playerid,x,y,z);
if(sscanf(params,"i",HousePrice)) return SendClientMessage(playerid,-1,"USAGE: /createhouse <price>");
HInfo[id][Price] = HousePrice;
HInfo[id][XPos] = x;
HInfo[id][YPos] = y;
HInfo[id][ZPos] = z;
new file[40],labelstring[100];
format(HInfo[id][Owner],24,"NoOwner");
SendClientMessage(playerid,-1,"House created");
HouseEnter[id] = CreateDynamicCP(x,y,z,1.5,GetPlayerVirtualWorld(playerid));
HouseExit[id] = CreateDynamicCP(443.9237,509.4609,1001.4195,1.5,GetPlayerVirtualWorld(playerid));
format(file,sizeof(file),"FHouse/Houses/%i.ini",id);
INI_Open(file);
new INI:File = INI_Open(UserPath(playerid));
INI_SetTag(File,"housedata");
INI_WriteInt(File,"Price",HousePrice);
INI_WriteInt(File,"Owned",0);
INI_WriteInt(File,"VirtualWorld",GetPlayerVirtualWorld(playerid));
INI_WriteFloat(File,"XPos",x);
INI_WriteFloat(File,"YPos",y);
INI_WriteFloat(File,"ZPos",z);
INI_WriteString(File,"Owner","NoOwner");
INI_Close(File);
HInfo[id][VirtualWorld] = GetPlayerVirtualWorld(playerid);
format(labelstring,sizeof(labelstring),"Owned: No \nPrice: %i",HousePrice);
HInfo[id][HouseLabel] = Create3DTextLabel(labelstring,0xFF0000FF,x,y,z,25.0,GetPlayerVirtualWorld(playerid));
HouseCount++;
}
return 1;
}