Need help please
#1

pawn Код:
#include <a_samp>
#include <zcmd>
#include <sscanf2>
#include <mysql>


#pragma tabsize 0

#define COLOR_YELLOW 0xFFFF00AA
#define COLOR_RED   0xFF303EFF
#define COLOR_BLUE 0x1C10EFFF
#define COLOR_GREEN 0x0FBF15FF
#define COLOR_ORANGE 0xFF9900AA
#define COLOR_YELLOW2 0xF5DEB3AA
#define COLOR_GREY 0xAFAFAFAA
#define COLOR_LIGHTRED 0xFF6347AA
#define COLOR_WHITE 0xFFFFFFAA

#define MYSQL_HOST  "localhost"
#define MYSQL_USER  "homehost"
#define MYSQL_PASS  "nochance0"
#define MYSQL_DB    "database"

#define MAX_HOUSES 500
main()
{
    print("\n----------------------------------");
    print(" San Andreas RolePlay");
    print("----------------------------------\n");
}




enum house()
{
id,
Float:enterx,
Float:entery,
Float:enterz,
Float:exitx,
Float:exity,
Float:exitz,
interior,
value,
owner[MAX_PLAYER_NAME],
housepickup,
}
new houseinfo[MAX_HOUSES][house];

public OnGameModeInit()
{
    mysql_init();
    mysql_connect(MYSQL_HOST,MYSQL_USER,MYSQL_PASS,MYSQL_DB);
    SetGameModeText("San Andreas");
    AddPlayerClass(0, 1958.33, 1343.12, 15.36, 269.15, 26, 36, 28, 150, 0, 0);
    LoadHouses();
    return 1;
}

public OnGameModeExit()
{
    return 1;
}

forward LoadHouses();
public LoadHouses()
{
    new Query[255];
    for(new i; i < MAX_HOUSES; i++) // Makes an loop so all vehicles get loaded.
    {
        format(Query, sizeof(Query), "SELECT * FROM houses WHERE id= %d", i);
        mysql_query(Query); // Querys the "Query" Variable.
        mysql_store_result(); // Stores the result from Query
        if(mysql_num_rows()) // Checks if theres anyrow.
        if(mysql_fetch_row(Query)) // Splits the row
        {
            sscanf(Query, "p<|>e<iffffffiis[24]>", houseinfo[i]);
            printf("%s",Query);
            printf("id %d enterx %f owner %s",houseinfo[i][id],houseinfo[i][enterx],houseinfo[i][owner]);
            houseinfo[i][housepickup] = CreatePickup(1273, 1, houseinfo[i][enterx],houseinfo[i][entery],houseinfo[i][enterz], 0);
            printf("pickup id %d",houseinfo[i][housepickup]);
        }
    }
}

public OnPlayerPickUpPickup(playerid, pickupid)
{
    for(new i; i < MAX_HOUSES; i++)
    {
        if(IsPlayerConnected(playerid))
        {
            if(pickupid == houseinfo[i][housepickup])
            {
                new str[25];
                printf("pickup id %d",houseinfo[i][housepickup]);
                format(str, sizeof(str),"'%s'",houseinfo[i][owner]);
                printf("This is a test %s",houseinfo[i][owner]);
                SendClientMessage(playerid,COLOR_GREEN,str);
            }
        }
    }
    return 1;
}
I'm trying to display the house owner name on the pickup callback and it doest display also the loop doest stop.If someone can take a look and help i would be apreciated!
Reply
#2

Anyone can help?
Reply
#3

Bump 24 hours after.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)