Mysql Problem | Help Meee :( Helpp
#1

Function
-~~-
public MySQLFetchAcctRecord(sqlplayerid, sqlresult[]) // by Luk0r
{
new query[64];
format(query, sizeof(query), "SELECT * FROM players WHERE id = %d LIMIT 1", sqlplayerid);
samp_mysql_query(query);
samp_mysql_store_result();
if(samp_mysql_fetch_row(sqlresult)==1)
{
return 1;
}
return 0;
}

OnPlayerLogin

~|~~|~

new Data[1024];
new Field[64];
new rcnt = 1;
MySQLFetchAcctRecord(PlayerInfo[playerid][pSQLID], Data);
samp_mysql_strtok(Field, "|", Data);
while (samp_mysql_strtok(Field, "|", "")==1)

Add OnPlayerLogin'e samp-server.exe I wonder what the reason is




HELPME

Reply
#2

Moderntopia/Citywide RP's MySQL functions don't work in SA:MP 0.3. Honestly, I don't know what's wrong with the code, but it doesn't work in 0.3 anymore. I suggest you remove the features and re-do the querys. There's a topic I think, about how to convert to another plugin, I couldn't find it though. The problem though is obviously with samp_mysql_strtok
Reply
#3

How Well Do We Do?
Reply
#4

FLOOD : Help mee
Reply
#5

I had just finished an mysql login/register so here is what i used :
pawn Код:
new query[128];
new row[10];
/// -- ADMIN -- //
format(query, sizeof(query), "SELECT `AdminLevel` FROM `players` WHERE `id` = %d LIMIT 1", PlayerInfo[playerid][pSQLID]);
samp_mysql_query(query);
samp_mysql_store_result();
samp_mysql_fetch_row(row);
PlayerInfo[playerid][AdminLevel] = strval(row);
/// -- Money -- ///
format(query, sizeof(query), "SELECT `Money` FROM `players` WHERE `id` = %d LIMIT 1", PlayerInfo[playerid][pSQLID]);
samp_mysql_query(query);
samp_mysql_store_result();
samp_mysql_fetch_row(row);
PlayerInfo[playerid][Money] = strval(row);

///// ETC ETC /////
Also at the onplayerconnect
pawn Код:
new sqlaccountstatus = MySQLCheckAccount(plname);
PlayerInfo[playerid][pSQLID] = sqlaccountstatus;
i'm guessing that you already have the mysqlcheckaccount function .
Reply
#6

Код:
new query[128];
new row[10];
/// -- ADMIN -- //
format(query, sizeof(query), "SELECT `AdminLevel` FROM `players` WHERE `id` = %d LIMIT 1", PlayerInfo[playerid][pSQLID]);
samp_mysql_query(query);
samp_mysql_store_result();
samp_mysql_fetch_row(row);
PlayerInfo[playerid][AdminLevel] = strval(row);
/// -- Money -- ///
format(query, sizeof(query), "SELECT `Money` FROM `players` WHERE `id` = %d LIMIT 1", PlayerInfo[playerid][pSQLID]);
samp_mysql_query(query);
samp_mysql_store_result();
samp_mysql_fetch_row(row);
PlayerInfo[playerid][Money] = strval(row);

///// ETC ETC /////
where horses are and how it works Why not use Record?
Reply
#7

format(query, sizeof(query), "SELECT `whatyouneed` FROM `tablename` WHERE `id` = %d LIMIT 1", PlayerInfo[playerid][pSQLID]);

PlayerInfo[playerid][pSQLID] = the rowid
Reply
#8

Quote:
Originally Posted by Dj_maryo1993
format(query, sizeof(query), "SELECT `whatyouneed` FROM `tablename` WHERE `id` = %d LIMIT 1", PlayerInfo[playerid][pSQLID]);

PlayerInfo[playerid][pSQLID] = the rowid


OnPlayerLogin
{
What we have to write here


---------------------
OnPlayerRegister
{
What we have to write here



Could you tell I'm like a bruised x (
Reply
#9

Well if i do you the function what is left for you ? you have up ahead everything you need
Reply
#10

why don't you use, MySQL R4 its better. . . and you can select all from table and then just split it
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)