Mysql Problem | Help Meee :( Helpp -
Musty80 - 11.06.2010
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
Re: Mysql Problem | Help Meee :( Helpp -
Carlton - 11.06.2010
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
Re: Mysql Problem | Help Meee :( Helpp -
Musty80 - 11.06.2010
How Well Do We Do?
Re: Mysql Problem | Help Meee :( Helpp -
Musty80 - 11.06.2010
FLOOD :
Help mee
Re: Mysql Problem | Help Meee :( Helpp -
Dj_maryo1993 - 11.06.2010
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
.
Re: Mysql Problem | Help Meee :( Helpp -
Musty80 - 12.06.2010
Код:
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?
Re: Mysql Problem | Help Meee :( Helpp -
Dj_maryo1993 - 13.06.2010
format(query, sizeof(query), "SELECT `whatyouneed` FROM `tablename` WHERE `id` = %d LIMIT 1", PlayerInfo[playerid][pSQLID]);
PlayerInfo[playerid][pSQLID] = the rowid
Re: Mysql Problem | Help Meee :( Helpp -
Musty80 - 13.06.2010
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 (
Re: Mysql Problem | Help Meee :( Helpp -
Dj_maryo1993 - 13.06.2010
Well if i do you the function what is left for you ? you have up ahead everything you need
Re: Mysql Problem | Help Meee :( Helpp -
Aleksandar_Zivanovci - 13.06.2010
why don't you use, MySQL R4 its better. . . and you can select all from table and then just split it