House Label problem
#1

Hello everybody.I got problem.My friend made House system.He borrow it to me too.But owner name was in Integer.But Now I don`t know how to switch that integer to classic string.Also..I got problem with label.So when players name who is owning that house is Sanady in game is writed S,=,; .I don`t know why.Here is picture.



And code is :
pawn Код:
forward LoadHouses();
public LoadHouses()
{
    mysql_query("SELECT * FROM samp_houses");
    mysql_store_result();
    if(mysql_num_rows())
    {
        new tmp[256], houseid;
        while(mysql_retrieve_row())
        {
            mysql_get_field("Owner", hInfo[houseid][hOwner]);
            mysql_get_field("EnterX", tmp); hInfo[houseid][hEnterX] = floatstr(tmp);
            mysql_get_field("EnterY", tmp); hInfo[houseid][hEnterY] = floatstr(tmp);
            mysql_get_field("EnterZ", tmp); hInfo[houseid][hEnterZ] = floatstr(tmp);
            mysql_get_field("ExitX", tmp); hInfo[houseid][hExitX] = floatstr(tmp);
            mysql_get_field("ExitY", tmp); hInfo[houseid][hExitY] = floatstr(tmp);
            mysql_get_field("ExitZ", tmp); hInfo[houseid][hExitZ] = floatstr(tmp);
            mysql_get_field("Interior", tmp); hInfo[houseid][hInterior] = strval(tmp);
            mysql_get_field("World", tmp); hInfo[houseid][hWorld] = strval(tmp);
            mysql_get_field("Locked", tmp); hInfo[houseid][hLocked] = strval(tmp);
            mysql_get_field("Price", tmp); hInfo[houseid][hPrice] = strval(tmp);
            mysql_get_field("OnSale", tmp); hInfo[houseid][hOnSale] = strval(tmp);

            if(hInfo[houseid][hOwner] == 0 || hInfo[houseid][hOnSale] == 1)
            {
                format(tmp, sizeof(tmp), "[House for sale]\n{FFFFFF}Owner: %s\nPrice: $%d", hInfo[houseid][hOwner],hInfo[houseid][hPrice]);
                HouseText[houseid] = Create3DTextLabel(tmp, 0xFFBF00FF, hInfo[houseid][hEnterX], hInfo[houseid][hEnterY], hInfo[houseid][hEnterZ],40.0,0, 1);
            }
            else
            {
                format(tmp, sizeof(tmp), "[House]\n{FFFFFF}Owner: {FFFFFF}%s",hInfo[houseid][hOwner]);
                HouseText[houseid] = Create3DTextLabel(tmp, 0xFFBF00FF, hInfo[houseid][hEnterX], hInfo[houseid][hEnterY], hInfo[houseid][hEnterZ],40.0,0, 1);
            }
            houseid++;
        }
        printf("Loaded houses: %d", houseid);
    }
    mysql_free_result();
    return 1;
}
Take a look,and help me if you know how to.

Thanks Sanady.
Reply
#2

Is "hInfo[houseid][hOwner]" a string? Does it contain the username of the player or his ID?

Show us where you create it (the enum).
Reply
#3

Quote:
Originally Posted by Mean
Посмотреть сообщение
Is "hInfo[houseid][hOwner]" a string? Does it contain the username of the player or his ID?

Show us where you create it (the enum).
You mean this?
pawn Код:
enum HouseInformations
{
    hOwner,
    Float:hEnterX,
    Float:hEnterY,
    Float:hEnterZ,
    Float:hExitX,
    Float:hExitY,
    Float:hExitZ,
    hInterior,
    hWorld,
    hLocked,
    hPrice,
    hOnSale,
}
new hInfo[MAX_HOUSES][HouseInformations];
In this house system my friend create just Load and Save system..
If you want to see save?
Reply
#4

pawn Код:
enum HouseInformations
{
    hOwner[MAX_PLAYER_NAME],
    Float:hEnterX,
    Float:hEnterY,
    Float:hEnterZ,
    Float:hExitX,
    Float:hExitY,
    Float:hExitZ,
    hInterior,
    hWorld,
    hLocked,
    hPrice,
    hOnSale,
}
new hInfo[MAX_HOUSES][HouseInformations];
That should fix it.
You can't save a username into an integer variable.
Reply
#5

Quote:
Originally Posted by Mean
Посмотреть сообщение
pawn Код:
enum HouseInformations
{
    hOwner[MAX_PLAYER_NAME],
    Float:hEnterX,
    Float:hEnterY,
    Float:hEnterZ,
    Float:hExitX,
    Float:hExitY,
    Float:hExitZ,
    hInterior,
    hWorld,
    hLocked,
    hPrice,
    hOnSale,
}
new hInfo[MAX_HOUSES][HouseInformations];
That should fix it.
You can't save a username into an integer variable.
Aha thank you very much.Just one more thing lines:
pawn Код:
if(hInfo[houseid][hOwner] == 0 || hInfo[houseid][hOnSale] == 1)
            {
                format(tmp, sizeof(tmp), "[House for sale]\n{FFFFFF}Owner: %s\nPrice: $%d", hInfo[houseid][hOwner],hInfo[houseid][hPrice]);
                HouseText[houseid] = Create3DTextLabel(tmp, 0xFFBF00FF, hInfo[houseid][hEnterX], hInfo[houseid][hEnterY], hInfo[houseid][hEnterZ],40.0,0, 1);
            }
            else
            {
                format(tmp, sizeof(tmp), "[House]\n{FFFFFF}Owner: {FFFFFF}%s",hInfo[houseid][hOwner]);
                HouseText[houseid] = Create3DTextLabel(tmp, 0xFFBF00FF, hInfo[houseid][hEnterX], hInfo[houseid][hEnterY], hInfo[houseid][hEnterZ],40.0,0, 1);
            }
When player is owning house.Then it`s telling me that house is for sale but in script is writted when player is owning house then house is not for sale but this is saying me that something here is bugged.Can someone helps me ?
Reply
#6

Quote:
Originally Posted by Sanady
Посмотреть сообщение
Aha thank you very much.Just one more thing lines:
pawn Код:
if(hInfo[houseid][hOwner] == 0 || hInfo[houseid][hOnSale] == 1)
            {
                format(tmp, sizeof(tmp), "[House for sale]\n{FFFFFF}Owner: %s\nPrice: $%d", hInfo[houseid][hOwner],hInfo[houseid][hPrice]);
                HouseText[houseid] = Create3DTextLabel(tmp, 0xFFBF00FF, hInfo[houseid][hEnterX], hInfo[houseid][hEnterY], hInfo[houseid][hEnterZ],40.0,0, 1);
            }
            else
            {
                format(tmp, sizeof(tmp), "[House]\n{FFFFFF}Owner: {FFFFFF}%s",hInfo[houseid][hOwner]);
                HouseText[houseid] = Create3DTextLabel(tmp, 0xFFBF00FF, hInfo[houseid][hEnterX], hInfo[houseid][hEnterY], hInfo[houseid][hEnterZ],40.0,0, 1);
            }
When player is owning house.Then it`s telling me that house is for sale but in script is writted when player is owning house then house is not for sale but this is saying me that something here is bugged.Can someone helps me ?
I don't understand - explain more.
Reply
#7

Quote:
Originally Posted by Mean
Посмотреть сообщение
I don't understand - explain more.
When house have owner.Example I create house.House have owner and it`s for sale and in script is writted when house don`t have owner and when is setted in PHPMyAdmin on sale then to be on sale.But I setted OnSale : 0 not for sale and in game it`s writted that is for sale.I don`t know why..
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)