Textlabel -house not showing
#1

hey why doesnt this work the first part work it shows the id and everything but when its brought it doesnt show the textlabel

pawn Код:
new string[128],string2[128],string3[128];
    if(strcmp(hInfo[hi][Name],"ForSale",true)==0)
    {
        format(string,sizeof(string),"House Available For Sale");
        format(string2,sizeof(string2),"HouseId:%d Cost Price:%d Sell Price:%d",hi,hInfo[hi][Cost],hInfo[hi][Sell]);
        hInfo[hi][hText] = Text3D:CreateDynamic3DTextLabel(string, LIME, iconX, iconY, iconZ, 30,INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 0,-1,-1, -1, 100);
        hInfo[hi][hTextc] = Text3D:CreateDynamic3DTextLabel(string2, LIME, iconX, iconY, iconZ-0.3, 30,INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 0,-1,-1, -1, 100);
       
        HousePickup[hi] = CreateDynamicCP(iconX, iconY, iconZ, 1.5, -1, -1, -1, 30.0);
    }
    else if(strcmp(hInfo[hi][Name],"ForSale",true)!=0)
    {
        format(string3,sizeof(string3),"House Is Brought & Owned By %s~n~ House Id:%d", hInfo[hi][Name],hi);
        UpdateDynamic3DTextLabelText(hInfo[hi][hText], 0x8D8DFF00, string3);
        DestroyDynamic3DTextLabel(hInfo[hi][hTextc]);
        HousePickup[hi] = CreateDynamicCP(iconX, iconY, iconZ, 1.5, -1, -1, -1, 30.0);
    }
Reply
#2

Try this :
Код:
new string[128],string2[128],string3[128];

if(!strcmp(hInfo[hi][Name],"ForSale"))    
{        
	format(string,sizeof(string),"House Available For Sale");        
	format(string2,sizeof(string2),"HouseId:%d Cost Price:%d Sell Price:%d",hi,hInfo[hi][Cost],hInfo[hi][Sell]);        
	hInfo[hi][hText] = Text3D:CreateDynamic3DTextLabel(string, LIME, iconX, iconY, iconZ, 30,INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 0,-1,-1, -1, 100);        
	hInfo[hi][hTextc] = Text3D:CreateDynamic3DTextLabel(string2, LIME, iconX, iconY, iconZ-0.3, 30,INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 0,-1,-1, -1, 100);                
	HousePickup[hi] = CreateDynamicCP(iconX, iconY, iconZ, 1.5, -1, -1, -1, 30.0);    
}    

else    
{        
	format(string3,sizeof(string3),"House Is Bought & Owned By %s~n~ House Id:%d", hInfo[hi][Name],hi);        
	UpdateDynamic3DTextLabelText(hInfo[hi][hText], 0x8D8DFF00, string3);        
	DestroyDynamic3DTextLabel(hInfo[hi][hTextc]);        
	HousePickup[hi] = CreateDynamicCP(iconX, iconY, iconZ, 1.5, -1, -1, -1, 30.0);    
}
I am assuming you have the code for the 3D text labels right.
Reply
#3

yes incognito's streamer. and it didnt work same problem. bought houses not showing the textlabel
Reply
#4

That's when you load the houses, when you start samp-server.exe...

When you /buyhouse, you still have to DeleteDynamic3DTextLabel, and recreate it using the new purchased labels.
Reply
#5

i've already done that. maybe i messed something up?
[edit] ps look at the bottom of the codes
pawn Код:
CMD:buy(playerid,params[])
{
    #pragma unused params
    new str[255],str1[255],pname[24], housenumber,string[128];
    housenumber = Gethi(playerid);
    if(housenumber == -1) return SendClientMessage(playerid, c_r, "You are not in a house icon!");

    GetPlayerName(playerid, pname, 24);
    format(str1, sizeof(str1), "Houses/Users/%s.house", udb_encode(pname));
    if(dini_Exists(str1))
    {
        if (dini_Int(str1, "hi")!=-255) return SendClientMessage(playerid, c_r, "You can only buy one house!");
    }
    format(str1, sizeof(str1), "Houses/hi%d", housenumber);
    if (strcmp(hInfo[housenumber][Name],"ForSale",true)) return SendClientMessage(playerid, c_r, "This house isn't for sale!");
    if(GetPlayerMoney(playerid)<hInfo[housenumber][Cost]) return SendClientMessage(playerid, c_r, "Not enough money!");
    SendClientMessage(playerid, c_y, "You have bought the house!");
    format(str, sizeof(str), "%s has bought houseid %d",pname,housenumber);
    print(str);
    GivePlayerMoney2(playerid, -hInfo[housenumber][Cost]);
    dini_Set(str1, "Name", pname);
    hInfo[housenumber][Name]=pname;
    hInfo[housenumber][Locked] = dini_IntSet(str1,"Locked",0);

    format(str1, sizeof(str1), "Houses/Users/%s.house", udb_encode(pname));
    if (!dini_Exists(str1)) dini_Create(str1);
    new Float:sy, Float:sx, Float:sz;
    dini_IntSet(str1, "hi", housenumber);
    GetPlayerPos(playerid, sx,sy,sz);
    dini_FloatSet(str1, "SpawnX", sx);
    dini_FloatSet(str1, "SpawnY", sy);
    dini_FloatSet(str1, "SpawnZ", sz);
    dini_IntSet(str1, "SpawnInt", GetPlayerInterior(playerid));
    new Float:iconX,Float:iconY,Float:iconZ;
    hInfo[housenumber][iconx]=iconX;
    hInfo[housenumber][icony]=iconY;
    hInfo[housenumber][iconz]=iconZ;
    DestroyDynamicCP(HousePickup[housenumber]);
    HousePickup[housenumber] = CreateDynamicCP(hInfo[housenumber][iconx], hInfo[housenumber][icony], hInfo[housenumber][iconz], 1.5, -1, -1, -1, 15.0);
    format(string,sizeof(string),"House Is Brought & Owned By %s~n~ House Id:%d", hInfo[housenumber][Name],housenumber);
    UpdateDynamic3DTextLabelText(hInfo[housenumber][hText], 0x8D8DFF00, string);
    DestroyDynamic3DTextLabel(hInfo[housenumber][hTextc]);
    return 1;
}
pawn Код:
CMD:sell(playerid,params[])
{
    #pragma unused params
    new str[255],str1[256],pname[24],housenumber,string[128],string2[128];
    housenumber = Gethi(playerid);
    GetPlayerName(playerid, pname, 24);
    format(str1, sizeof(str1), "Houses/hi%d", housenumber);
    if (strcmp(hInfo[housenumber][Name],pname,false)) return SendClientMessage(playerid, c_r, "This house isn't yours!");
    SendClientMessage(playerid, c_y, "You have sold your house!");
    format(str, sizeof(str), "%s has sold houseid %d",pname,housenumber);
    print(str);
    GivePlayerMoney2(playerid, hInfo[housenumber][Sell]);
    dini_Set(str1, "Name", "ForSale");
    hInfo[housenumber][Locked] = dini_IntSet(str1,"Locked",1);
    format(hInfo[housenumber][Name],255,"ForSale");
    format(str1, sizeof(str1), "Houses/Users/%s.house", udb_encode(pname));
    if (!dini_Exists(str1)) dini_Create(str1);
    dini_IntSet(str1, "hi", -255);
    new Float:iconX,Float:iconY,Float:iconZ;
    hInfo[housenumber][iconx]=iconX;
    hInfo[housenumber][icony]=iconY;
    hInfo[housenumber][iconz]=iconZ;
    DestroyDynamicCP(HousePickup[housenumber]);
    HousePickup[housenumber] = CreateDynamicCP(hInfo[housenumber][iconx], hInfo[housenumber][icony], hInfo[housenumber][iconz], 1.5, -1, -1, -1, 15.0);
    format(string,sizeof(string),"House Available For Sale");
    format(string2,sizeof(string2),"HouseId:%d Cost Price:%d Sell Price:%d",housenumber,hInfo[housenumber][Cost],hInfo[housenumber][Sell]);
    hInfo[housenumber][hText] = Text3D:CreateDynamic3DTextLabel(string, LIME, iconX, iconY, iconZ, 30,INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 0,-1,-1, -1, 100);
    hInfo[housenumber][hTextc] = Text3D:CreateDynamic3DTextLabel(string2, LIME, iconX, iconY, iconZ-0.3, 30,INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 0,-1,-1, -1, 100);
    RemovePlayerMapIcon(playerid, housemapicon[playerid]);
    return 1;
}
Reply
#6

Maybe if you destroy the labels and re-create them? I had the same problem previously with Update3DTextLabel, and that solved it... So maybe give it a try? Though... I don't use incognito's so I don't know either.
Reply
#7

i havbe this now;\ but still doesnt work

pawn Код:
CMD:sell(playerid,params[])
{
    #pragma unused params
    new str[255],str1[256],pname[24],housenumber,string[128],string2[128];
    housenumber = Gethi(playerid);
    GetPlayerName(playerid, pname, 24);
    format(str1, sizeof(str1), "Houses/hi%d", housenumber);
    if (strcmp(hInfo[housenumber][Name],pname,false)) return SendClientMessage(playerid, c_r, "This house isn't yours!");
    SendClientMessage(playerid, c_y, "You have sold your house!");
    format(str, sizeof(str), "%s has sold houseid %d",pname,housenumber);
    print(str);
    GivePlayerMoney2(playerid, hInfo[housenumber][Sell]);
    dini_Set(str1, "Name", "ForSale");
    hInfo[housenumber][Locked] = dini_IntSet(str1,"Locked",1);
    format(hInfo[housenumber][Name],255,"ForSale");
    format(str1, sizeof(str1), "Houses/Users/%s.house", udb_encode(pname));
    if (!dini_Exists(str1)) dini_Create(str1);
    dini_IntSet(str1, "hi", -255);
    new Float:iconX,Float:iconY,Float:iconZ;
    hInfo[housenumber][iconx]=iconX;
    hInfo[housenumber][icony]=iconY;
    hInfo[housenumber][iconz]=iconZ;
    DestroyDynamicCP(HousePickup[housenumber]);
    HousePickup[housenumber] = CreateDynamicCP(hInfo[housenumber][iconx], hInfo[housenumber][icony], hInfo[housenumber][iconz], 1.5, -1, -1, -1, 15.0);
    DestroyDynamic3DTextLabel(hInfo[housenumber][hTextc]);
    DestroyDynamic3DTextLabel(hInfo[housenumber][hText]);
    format(string,sizeof(string),"House Available For Sale");
    format(string2,sizeof(string2),"HouseId:%d Cost Price:%d Sell Price:%d",housenumber,hInfo[housenumber][Cost],hInfo[housenumber][Sell]);
    hInfo[housenumber][hText] = Text3D:CreateDynamic3DTextLabel(string, LIME, iconX, iconY, iconZ, 30,INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 0,-1,-1, -1, 100);
    hInfo[housenumber][hTextc] = Text3D:CreateDynamic3DTextLabel(string2, LIME, iconX, iconY, iconZ-0.3, 30,INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 0,-1,-1, -1, 100);
    RemovePlayerMapIcon(playerid, housemapicon[playerid]);
    CreateDynamicCP(hInfo[housenumber][iconx], hInfo[housenumber][icony], hInfo[housenumber][iconz], 1.5, -1, -1, -1, 15.0);
    return 1;
}

CMD:buy(playerid,params[])
{
    #pragma unused params
    new str[255],str1[255],pname[24], housenumber,string[128];
    housenumber = Gethi(playerid);
    if(housenumber == -1) return SendClientMessage(playerid, c_r, "You are not in a house icon!");

    GetPlayerName(playerid, pname, 24);
    format(str1, sizeof(str1), "Houses/Users/%s.house", udb_encode(pname));
    if(dini_Exists(str1))
    {
        if (dini_Int(str1, "hi")!=-255) return SendClientMessage(playerid, c_r, "You can only buy one house!");
    }
    format(str1, sizeof(str1), "Houses/hi%d", housenumber);
    if (strcmp(hInfo[housenumber][Name],"ForSale",true)) return SendClientMessage(playerid, c_r, "This house isn't for sale!");
    if(GetPlayerMoney(playerid)<hInfo[housenumber][Cost]) return SendClientMessage(playerid, c_r, "Not enough money!");
    SendClientMessage(playerid, c_y, "You have bought the house!");
    format(str, sizeof(str), "%s has bought houseid %d",pname,housenumber);
    print(str);
    GivePlayerMoney2(playerid, -hInfo[housenumber][Cost]);
    dini_Set(str1, "Name", pname);
    hInfo[housenumber][Name]=pname;
    hInfo[housenumber][Locked] = dini_IntSet(str1,"Locked",0);

    format(str1, sizeof(str1), "Houses/Users/%s.house", udb_encode(pname));
    if (!dini_Exists(str1)) dini_Create(str1);
    new Float:sy, Float:sx, Float:sz;
    dini_IntSet(str1, "hi", housenumber);
    GetPlayerPos(playerid, sx,sy,sz);
    dini_FloatSet(str1, "SpawnX", sx);
    dini_FloatSet(str1, "SpawnY", sy);
    dini_FloatSet(str1, "SpawnZ", sz);
    dini_IntSet(str1, "SpawnInt", GetPlayerInterior(playerid));
    new Float:iconX,Float:iconY,Float:iconZ;
    hInfo[housenumber][iconx]=iconX;
    hInfo[housenumber][icony]=iconY;
    hInfo[housenumber][iconz]=iconZ;
    DestroyDynamicCP(HousePickup[housenumber]);
    DestroyDynamic3DTextLabel(hInfo[housenumber][hTextc]);
    DestroyDynamic3DTextLabel(hInfo[housenumber][hText]);
    HousePickup[housenumber] = CreateDynamicCP(hInfo[housenumber][iconx], hInfo[housenumber][icony], hInfo[housenumber][iconz], 1.5, -1, -1, -1, 15.0);
    format(string,sizeof(string),"House Is Brought & Owned By %s~n~ House Id:%d", hInfo[housenumber][Name],housenumber);
    UpdateDynamic3DTextLabelText(hInfo[housenumber][hText], 0x8D8DFF00, string);
    CreateDynamicCP(hInfo[housenumber][iconx], hInfo[housenumber][icony], hInfo[housenumber][iconz], 1.5, -1, -1, -1, 15.0);
    return 1;
}
Reply
#8

pawn Код:
DestroyDynamic3DTextLabel(hInfo[housenumber][hTextc]);
DestroyDynamic3DTextLabel(hInfo[housenumber][hText]);
You destroy the labels, and yet you update them:

pawn Код:
UpdateDynamic3DTextLabelText(hInfo[housenumber][hText], 0x8D8DFF00, string);
Change that to CreateDynamic3DTextLabelText(hInfo[housenumber[hText], 0x8D8DFF00, string); or how ever it is you create them ^.^
Reply
#9

well i give up on this..-.-

pawn Код:
CMD:sell(playerid,params[])
{
    #pragma unused params
    new str[255],str1[256],pname[24],housenumber,string[128],string2[128];
    housenumber = Gethi(playerid);
    GetPlayerName(playerid, pname, 24);
    format(str1, sizeof(str1), "Houses/hi%d", housenumber);
    if (strcmp(hInfo[housenumber][Name],pname,false)) return SendClientMessage(playerid, c_r, "This house isn't yours!");
    SendClientMessage(playerid, c_y, "You have sold your house!");
    format(str, sizeof(str), "%s has sold houseid %d",pname,housenumber);
    print(str);
    GivePlayerMoney2(playerid, hInfo[housenumber][Sell]);
    dini_Set(str1, "Name", "ForSale");
    hInfo[housenumber][Locked] = dini_IntSet(str1,"Locked",1);
    format(hInfo[housenumber][Name],255,"ForSale");
    format(str1, sizeof(str1), "Houses/Users/%s.house", udb_encode(pname));
    if (!dini_Exists(str1)) dini_Create(str1);
    dini_IntSet(str1, "hi", -255);
    new Float:iconX,Float:iconY,Float:iconZ;
    hInfo[housenumber][iconx]=iconX;
    hInfo[housenumber][icony]=iconY;
    hInfo[housenumber][iconz]=iconZ;
    DestroyDynamicCP(HousePickup[housenumber]);
    HousePickup[housenumber] = CreateDynamicCP(hInfo[housenumber][iconx], hInfo[housenumber][icony], hInfo[housenumber][iconz], 1.5, -1, -1, -1, 15.0);
    DestroyDynamic3DTextLabel(hInfo[housenumber][hTextc]);
    DestroyDynamic3DTextLabel(hInfo[housenumber][hText]);
    format(string,sizeof(string),"House Available For Sale");
    format(string2,sizeof(string2),"HouseId:%d Cost Price:%d Sell Price:%d",housenumber,hInfo[housenumber][Cost],hInfo[housenumber][Sell]);
    hInfo[housenumber][hText] = Text3D:CreateDynamic3DTextLabel(string, LIME, iconX, iconY, iconZ, 30,INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 0,-1,-1, -1, 100);
    hInfo[housenumber][hTextc] = Text3D:CreateDynamic3DTextLabel(string2, LIME, iconX, iconY, iconZ-0.3, 30,INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 0,-1,-1, -1, 100);
    RemovePlayerMapIcon(playerid, housemapicon[playerid]);
    CreateDynamicCP(hInfo[housenumber][iconx], hInfo[housenumber][icony], hInfo[housenumber][iconz], 1.5, -1, -1, -1, 15.0);
    return 1;
}

CMD:buy(playerid,params[])
{
    #pragma unused params
    new str[255],str1[255],pname[24], housenumber,string[128];
    housenumber = Gethi(playerid);
    if(housenumber == -1) return SendClientMessage(playerid, c_r, "You are not in a house icon!");

    GetPlayerName(playerid, pname, 24);
    format(str1, sizeof(str1), "Houses/Users/%s.house", udb_encode(pname));
    if(dini_Exists(str1))
    {
        if (dini_Int(str1, "hi")!=-255) return SendClientMessage(playerid, c_r, "You can only buy one house!");
    }
    format(str1, sizeof(str1), "Houses/hi%d", housenumber);
    if (strcmp(hInfo[housenumber][Name],"ForSale",true)) return SendClientMessage(playerid, c_r, "This house isn't for sale!");
    if(GetPlayerMoney(playerid)<hInfo[housenumber][Cost]) return SendClientMessage(playerid, c_r, "Not enough money!");
    SendClientMessage(playerid, c_y, "You have bought the house!");
    format(str, sizeof(str), "%s has bought houseid %d",pname,housenumber);
    print(str);
    GivePlayerMoney2(playerid, -hInfo[housenumber][Cost]);
    dini_Set(str1, "Name", pname);
    hInfo[housenumber][Name]=pname;
    hInfo[housenumber][Locked] = dini_IntSet(str1,"Locked",0);

    format(str1, sizeof(str1), "Houses/Users/%s.house", udb_encode(pname));
    if (!dini_Exists(str1)) dini_Create(str1);
    new Float:sy, Float:sx, Float:sz;
    dini_IntSet(str1, "hi", housenumber);
    GetPlayerPos(playerid, sx,sy,sz);
    dini_FloatSet(str1, "SpawnX", sx);
    dini_FloatSet(str1, "SpawnY", sy);
    dini_FloatSet(str1, "SpawnZ", sz);
    dini_IntSet(str1, "SpawnInt", GetPlayerInterior(playerid));
    new Float:iconX,Float:iconY,Float:iconZ;
    hInfo[housenumber][iconx]=iconX;
    hInfo[housenumber][icony]=iconY;
    hInfo[housenumber][iconz]=iconZ;
    DestroyDynamicCP(HousePickup[housenumber]);
    DestroyDynamic3DTextLabel(hInfo[housenumber][hTextc]);
    DestroyDynamic3DTextLabel(hInfo[housenumber][hText]);
    HousePickup[housenumber] = CreateDynamicCP(hInfo[housenumber][iconx], hInfo[housenumber][icony], hInfo[housenumber][iconz], 1.5, -1, -1, -1, 15.0);
    format(string,sizeof(string),"House Is Brought & Owned By %s~n~ House Id:%d", hInfo[housenumber][Name],housenumber);
    hInfo[housenumber][hText] = Text3D:CreateDynamic3DTextLabel(string, 0x8D8DFF00, iconX, iconY, iconZ, 30,INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 0,-1,-1, -1, 100);
    CreateDynamicCP(hInfo[housenumber][iconx], hInfo[housenumber][icony], hInfo[housenumber][iconz], 1.5, -1, -1, -1, 15.0);
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)