23.08.2010, 17:36
pawn Код:
public LoadBuget()
{
new query[128];
new Data[1024];
new intBuf[64];
format(query, sizeof(query), "SELECT * FROM `Primaria` WHERE `Nume` = '%s' LIMIT 1", "Primaria");
samp_mysql_query(query);
samp_mysql_store_result();
samp_mysql_fetch_row(Data);
samp_mysql_get_field("Capital", intBuf);
Primaria[Capital] = strval(intBuf);
samp_mysql_get_field("BonusLupta", intBuf);
Primaria[BonusLupta] = strval(intBuf);
printf("Primaria : Capital = %d , BonusLupta = %d",Primaria[Capital],Primaria[BonusLupta]);
return 1;
}
public LoadBizz(bizid)
{
new query[128];
new Data[1024];
new intBuf[64];
format(query, sizeof(query), "SELECT * FROM `Bizzuri` WHERE `id` = '%d' LIMIT 1",bizid);
samp_mysql_query(query);
samp_mysql_store_result();
samp_mysql_fetch_row(Data);
samp_mysql_get_field("Owner", intBuf);
BizzInfo[bizid][Owner] = strval(intBuf);
samp_mysql_get_field("Price", intBuf);
BizzInfo[bizid][Price] = strval(intBuf);
samp_mysql_get_field("Cx", intBuf);
BizzInfo[bizid][Cx] = strval(intBuf);
samp_mysql_get_field("Cy", intBuf);
BizzInfo[bizid][Cy] = strval(intBuf);
samp_mysql_get_field("Cz", intBuf);
BizzInfo[bizid][Cz] = strval(intBuf);
samp_mysql_get_field("Cix", intBuf);
BizzInfo[bizid][Cix] = strval(intBuf);
samp_mysql_get_field("Ciy", intBuf);
BizzInfo[bizid][Ciy] = strval(intBuf);
samp_mysql_get_field("Ciz", intBuf);
BizzInfo[bizid][Ciz] = strval(intBuf);
samp_mysql_get_field("Intid", intBuf);
BizzInfo[bizid][Intid] = strval(intBuf);
samp_mysql_get_field("Fee", intBuf);
BizzInfo[bizid][Fee] = strval(intBuf);
samp_mysql_get_field("Status", intBuf);
BizzInfo[bizid][Status] = strval(intBuf);
printf(">><<<<");
printf("Owner : %s , Status : %d , Cx : %f ",BizzInfo[bizid][Owner],BizzInfo[bizid][Status],BizzInfo[bizid][Cx] );
samp_mysql_free_result();
return 1;
}
pawn Код:
public LoadStuff()
{
LoadBuget();
LoadBizz(1);
return 1;
}
Код:
[20:35:53] MYSQL: Attempting to connect to server... [20:35:53] Connection to MySQL database: Successfull ! [20:35:53] MYSQL: Database connection established. [20:35:53] Number of vehicle models: 0 [20:35:59] Primaria : Capital = 300000000 , BonusLupta = 30
Код:
[20:34:27] MYSQL: Attempting to connect to server... [20:34:27] Connection to MySQL database: Successfull ! [20:34:27] MYSQL: Database connection established. [20:34:27] Number of vehicle models: 0 [20:34:33] >><<<< [20:34:33] Owner : , Status : 0 , Cx : 312.000000