How can I get this working? [Detailed][Vortex 1] -
Ben7544 - 21.07.2011
Alright, as I am scripting for 10 Hours already, in order to change a thing, little one.
What I want to change is
Vortex's house icon >
3DTextLabel.
I never thought it'll take me so long.
After multiple attempts & tests & helping threads, I couldn't figure out why 3DText dosent appears?
Here is a picture from the last attempt of mine, which is actually an evidence that it is not working :
I cant find out, where's the problems and the bugs that blocks it to work properly as its supposed to work.
Please, I will keep working on this till it gets done, but I could use some generous help or assistance to get this working :].
Things I edited or created in order to atleast get a 3D text, but havent succeed :
Код:
stock InitHouses()
{
new FileName[128];
new labelString[96];
for(new h = 0; h < sizeof(Houses); h++)
{
format(FileName, sizeof(FileName), "Houses/House_%d.ini", h);
if(fexist(FileName))
{
Houses[h][hInteriorID] = dini_Int(FileName, "InteriorID");
Houses[h][hInteriorX] = dini_Float(FileName, "InteriorX");
Houses[h][hInteriorY] = dini_Float(FileName, "InteriorY");
Houses[h][hInteriorZ] = dini_Float(FileName, "InteriorZ");
Houses[h][HousePrice] = dini_Int(FileName, "HousePrice");
Houses[h][hExteriorID] = dini_Int(FileName, "ExteriorID");
Houses[h][hExteriorX] = dini_Float(FileName, "ExteriorX");
Houses[h][hExteriorY] = dini_Float(FileName, "ExteriorY");
Houses[h][hExteriorZ] = dini_Float(FileName, "ExteriorZ");
Houses[h][VaultMoney] = dini_Int(FileName, "VaultMoney");
Houses[h][HouseCocaine] = dini_Int(FileName, "HouseCocaine");
Houses[h][HousePot] = dini_Int(FileName, "HousePot");
Houses[h][HouseMaterials] = dini_Int(FileName, "HouseMaterials");
Houses[h][hOwner] = dini_Get(FileName, "Owner");
Houses[h][LockStatus] = dini_Int(FileName, "LockStatus");
Houses[h][WeaponSlot1] = dini_Int(FileName, "WeaponSlot1");
Houses[h][WeaponSlot2] = dini_Int(FileName, "WeaponSlot2");
Houses[h][WeaponSlot3] = dini_Int(FileName, "WeaponSlot3");
new NewHouseID = SpawnedHouses+1;
if(strcmp(Houses[h][hOwner], "Nobody", true) == 0)
{
format(labelString, sizeof(labelString), "House %d\n Price: %d",NewHouseID, h);
CreateDynamic3DTextLabel(labelString, ADMIN_GREEN, Houses[NewHouseID][hExteriorX],Houses[NewHouseID][hExteriorY],Houses[NewHouseID][hExteriorZ],30.0,0,1);
}
else
{
format(labelString, sizeof(labelString), "House %d",NewHouseID);
Create3DTextLabel(labelString,RED,Houses[NewHouseID][hExteriorX],Houses[NewHouseID][hExteriorY],Houses[NewHouseID][hExteriorZ],30.0,0,1);
}
printf("[system] House %d spawned.", h);
SpawnedHouses++;
}
}
return 1;
}
Код:
if(strcmp(Usage, "complete", true) == 0)
{
if(Player[playerid][HouseInterior] > 0 || Player[playerid][HouseExterior] > 0)
{
new NewHouseID = SpawnedHouses+1;
if(NewHouseID >= MAX_HOUSES)
{
SendClientMessage(playerid, WHITE, "Too many houses are currently spawned!");
}
else
{
format(string, sizeof(string), "Houses/House_%d.ini", NewHouseID);
if(!fexist(string))
{
new labelString[96];
Houses[NewHouseID][hInteriorID] = Player[playerid][hIntID];
Houses[NewHouseID][hExteriorID] = Player[playerid][hExtID];
Houses[NewHouseID][hInteriorX] = Player[playerid][hIntX];
Houses[NewHouseID][hInteriorY] = Player[playerid][hIntY];
Houses[NewHouseID][hInteriorZ] = Player[playerid][hIntZ];
Houses[NewHouseID][hExteriorX] = Player[playerid][hExtX];
Houses[NewHouseID][hExteriorY] = Player[playerid][hExtY];
Houses[NewHouseID][hExteriorZ] = Player[playerid][hExtZ];
format(Houses[NewHouseID][hOwner], 255, "Nobody");
Houses[MAX_HOUSES-1][hLabelID] = CreateDynamic3DTextLabel(labelString, ADMIN_GREEN, Houses[NewHouseID][hExteriorX],Houses[NewHouseID][hExteriorY],Houses[NewHouseID][hExteriorZ],30.0,0,1);
Houses[NewHouseID][LockStatus] = 0;
dini_Create(string);
dini_IntSet(string, "InteriorID", Houses[NewHouseID][hInteriorID]);
dini_FloatSet(string, "InteriorX", Houses[NewHouseID][hInteriorX]);
dini_FloatSet(string, "InteriorY", Houses[NewHouseID][hInteriorY]);
dini_FloatSet(string, "InteriorZ", Houses[NewHouseID][hInteriorZ]);
dini_IntSet(string, "HousePrice", 0);
dini_IntSet(string, "ExteriorID", 0);
dini_FloatSet(string, "ExteriorX", Houses[NewHouseID][hExteriorX]);
dini_FloatSet(string, "ExteriorY", Houses[NewHouseID][hExteriorY]);
dini_FloatSet(string, "ExteriorZ", Houses[NewHouseID][hExteriorZ]);
dini_IntSet(string, "VaultMoney", -1);
dini_IntSet(string, "HouseCocaine", -1);
dini_IntSet(string, "HousePot", -1);
dini_IntSet(string, "HouseMaterials", -1);
dini_Set(string, "Owner", "Nobody");
dini_IntSet(string, "LockStatus", Houses[NewHouseID][LockStatus]);
Player[playerid][HouseExterior]--;
Player[playerid][HouseInterior]--;
SpawnedHouses++;
SendClientMessage(playerid, NICESKY, "Successfully created house!");
SetPlayerInterior(playerid, Houses[NewHouseID][hExteriorID]);
for(new h=0; h < MAX_HOUSES; h++)
{
format(labelString, sizeof(labelString), "House %d\n Price: %d", NewHouseID, Houses[h][HousePrice]);
SetPlayerPos(playerid, Houses[NewHouseID][hExteriorX], Houses[NewHouseID][hExteriorY], Houses[NewHouseID][hExteriorZ]);
}
}
else
{
SendClientMessage(playerid, WHITE, "Error: File already exists!");
}
}
}
else
{
SendClientMessage(playerid, WHITE, "You must select an exterior and an interior first!");
}
}
}
}
return 1;
}
Код:
stock Create3DHouse()
{
new string[ 96 ];
for(new h = 0; h < sizeof(Houses); h++)
{
new NewHouseID = SpawnedHouses+1;
if(Houses[h][HousePrice] == -1)
{
format(string, sizeof(string), "House %d", h);
Create3DTextLabel(string,RED,Houses[NewHouseID][hExteriorX],Houses[NewHouseID][hExteriorY],Houses[NewHouseID][hExteriorZ],30.0,0,1);
}
else
{
format(string, sizeof(string), "House %d\n Price: %d", h, Houses[h][HousePrice]);
Create3DTextLabel(string,ADMIN_GREEN,Houses[NewHouseID][hExteriorX],Houses[NewHouseID][hExteriorY],Houses[NewHouseID][hExteriorZ],30.0,0);
}
}
}
Does anyone has suggestion for me or a tip, or even a script fix, so I can get this working?
I dont ask you to do this for me, I just want to learn from my mistakes, and the most to get this working.
Will appericate any help =]!.
Re: How can I get this working? [Detailed][Vortex 1] -
[HiC]TheKiller - 21.07.2011
pawn Код:
stock Create3DHouse()
{
for(new NewHouseID; NewHouseID<sizeof(Houses); NewHouseID++)
{
if(!Houses[NewHouseID][hExteriorY]) continue;
new string[ 96 ];
if(Houses[NewHouseID][HousePrice] == -1)
{
format(string, sizeof(string), "House %d", h);
Create3DTextLabel(string,RED,Houses[NewHouseID][hExteriorX],Houses[NewHouseID][hExteriorY],Houses[NewHouseID][hExteriorZ],30.0,0,1);
}
else
{
format(string, sizeof(string), "House %d\n Price: %d", h, Houses[h][HousePrice]);
Create3DTextLabel(string,ADMIN_GREEN,Houses[NewHouseID][hExteriorX],Houses[NewHouseID][hExteriorY],Houses[NewHouseID][hExteriorZ],30.0,0);
}
}
return 1;
}
Give that a go.
Re: How can I get this working? [Detailed][Vortex 1] -
Ben7544 - 21.07.2011
Thank you, but where should I place a 'Create3DHouse', so it'll work?
( Probably at 'complete'? ( example 2), but where actually there? )
Re: How can I get this working? [Detailed][Vortex 1] -
[HiC]TheKiller - 21.07.2011
Put it anywhere outside callbacks in your gamemode / filterscript.
Re: How can I get this working? [Detailed][Vortex 1] -
Ben7544 - 21.07.2011
I am getting two errors while trying to compile it
Both of them are :
PHP код:
error 017: undefined symbol "h"
Re: How can I get this working? [Detailed][Vortex 1] -
[HiC]TheKiller - 21.07.2011
Oh sorry, forgot to edit that part
pawn Код:
stock Create3DHouse()
{
for(new NewHouseID; NewHouseID<sizeof(Houses); NewHouseID++)
{
if(!Houses[NewHouseID][hExteriorY]) continue;
new string[ 96 ];
if(Houses[NewHouseID][HousePrice] == -1)
{
format(string, sizeof(string), "House %d", NewHouseID);
Create3DTextLabel(string,RED,Houses[NewHouseID][hExteriorX],Houses[NewHouseID][hExteriorY],Houses[NewHouseID][hExteriorZ],30.0,0,1);
}
else
{
format(string, sizeof(string), "House %d\n Price: %d", NewHouseID, Houses[NewHouseID][HousePrice]);
Create3DTextLabel(string,ADMIN_GREEN,Houses[NewHouseID][hExteriorX],Houses[NewHouseID][hExteriorY],Houses[NewHouseID][hExteriorZ],30.0,0);
}
}
return 1;
}
Re: How can I get this working? [Detailed][Vortex 1] -
Ben7544 - 21.07.2011
Working great!
THANK YOU!!
But, there's a problem, when I shut the server down, the houses are still exist but the 3D Icons are disappearing.
How can I make that perm?
Re: How can I get this working? [Detailed][Vortex 1] -
[HiC]TheKiller - 21.07.2011
It should be permanent if you have Create3DHouse(); on OnGameModeInit.
Re: How can I get this working? [Detailed][Vortex 1] -
Ben7544 - 21.07.2011
Alright, but there is a problem.
As I saw its working, I want to add a feature which says in what street the house is at.
So, I downloaded include ''playerzone''.
And done this shit :
Код:
stock Create3DHouse()
{
for(new NewHouseID; NewHouseID<sizeof(Houses); NewHouseID++)
{
if(!Houses[NewHouseID][hExteriorY]) continue;
new string[ 96 ];
if(Houses[NewHouseID][HousePrice] == -1)
{
format(string, sizeof(string), "[House]\n %d %s", NewHouseID, Houses[NewHouseID][HouseZone]);
CreateDynamic3DTextLabel(string,RED,Houses[NewHouseID][hExteriorX],Houses[NewHouseID][hExteriorY],Houses[NewHouseID][hExteriorZ],30.0,0,1);
}
else
{
format(string, sizeof(string), "[House]\n %d %s \n $%d buy price(/buyhouse)", NewHouseID, Houses[NewHouseID][HouseZone] ,Houses[NewHouseID][HousePrice]);
CreateDynamic3DTextLabel(string,ADMIN_GREEN,Houses[NewHouseID][hExteriorX],Houses[NewHouseID][hExteriorY],Houses[NewHouseID][hExteriorZ],30.0,0);
}
}
return 1;
}
Код:
if(strcmp(Usage, "exterior", true) == 0)
{
Player[playerid][HouseExterior]++;
Player[playerid][hExtID] = GetPlayerInterior(playerid);
GetPlayerPos(playerid, Player[playerid][hExtX], Player[playerid][hExtY], Player[playerid][hExtZ]);
format(string, sizeof(string), "Exterior set! (X: %f, Y: %f, Z: %f).", Player[playerid][hExtX], Player[playerid][hExtY], Player[playerid][hExtZ]);
Player[playerid][hZo] = GetPlayerZone(playerid);
SendClientMessage(playerid, WHITE, string);
}
I included the ''playerzone''.
I even made a code that it'll save the HouseZone.
And because of that feature that I added, the
3DText dosent shows up again! =[, what I've done wrong?
I created variables with 128 Arrays in the enum of HouseData(HouseZone) and PlayerStatitics(hZo)
And somehow, it says on the House's file, that the 'HouseZone' is a number, I mean..
Take a look :
Its supposed to be like amm, Idlewood or something like that.
And why the 3DTextLabel dosent show up again?
Re: How can I get this working? [Detailed][Vortex 1] -
Ben7544 - 21.07.2011
One more question, how am I supposed to make this updating, for example.
As player /buyhouse, the 3DText changing to red immediatly and with another text ( The format has already created though).