30.06.2011, 22:20
Ok so i have moderntopia.. coverting it to new sql, but 1 problem
k this is a old function:
Whats its equiv
for this code
k this is a old function:
PHP код:
samp_mysql_strtok(dest[], separator[], src[]);
Код:
#define mysql_fetch_row(%1) mysql_fetch_row_format(%1,"|") #define mysql_next_row() mysql_retrieve_row() #define mysql_get_field(%1,%2) mysql_fetch_field_row(%2,%1) native mysql_affected_rows(connectionHandle = 1); native mysql_close(connectionHandle = 1); native mysql_connect(const host[],const user[],const database[],const password[]); native mysql_debug(enable = 1); native mysql_errno(connectionHandle = 1); native mysql_fetch_int(connectionHandle = 1); native mysql_fetch_field(number,dest[],connectionHandle = 1); native mysql_fetch_field_row(string[],const fieldname[],connectionHandle = 1); native mysql_fetch_float(&Float:result,connectionHandle = 1); native mysql_fetch_row_format(string[],const delimiter[] = "|",connectionHandle = 1); native mysql_field_count(connectionHandle = 1); native mysql_free_result(connectionHandle = 1); native mysql_get_charset(destination[],connectionHandle = 1); native mysql_insert_id(connectionHandle = 1); native mysql_num_rows(connectionHandle = 1); native mysql_num_fields(connectionHandle = 1); native mysql_ping(connectionHandle = 1); native mysql_query(query[],resultid = (-1),extraid = (-1),connectionHandle = 1); native mysql_query_callback(index,query[],callback[],extraid = 0,connectionHandle = 1); native mysql_real_escape_string(const source[],destination[],connectionHandle = 1); native mysql_reconnect(connectionHandle = 1); native mysql_reload(connectionHandle = 1); native mysql_retrieve_row(connectionHandle = 1); native mysql_set_charset(charset[],connectionHandle = 1); native mysql_stat(const destination[],connectionHandle = 1); native mysql_store_result(connectionHandle = 1); native mysql_warning_count(connectionHandle = 1);
PHP код:
samp_mysql_strtok(Field, "|", Data);
while (samp_mysql_strtok(Field, "|", "")==1)
PHP код:
public OnPlayerLogin(playerid,password[]) // by Luk0r v1.0
{
MySQLCheckConnection();
new tmp2[256];
new string2[64];
new playername2[MAX_PLAYER_NAME];
new playernamesplit[3][MAX_PLAYER_NAME];
GetPlayerName(playerid, playername2, sizeof(playername2));
split(playername2, playernamesplit, '_');
MySQLFetchAcctSingle(PlayerInfo[playerid][pSQLID], "Password", PlayerInfo[playerid][pKey]);
if(strcmp(PlayerInfo[playerid][pKey],password, true ) == 0 )
{
new Data[1024];
new Field[64];
new rcnt = 1;
MySQLFetchAcctRecord(PlayerInfo[playerid][pSQLID], Data);
mysql_retrieve_row();
samp_mysql_strtok(Field, "|", Data);
while (samp_mysql_strtok(Field, "|", "")==1)
{
// The rcnt values here represent the order of the columns in the characters table, so don't mess with them
// If you add a column to the table, just add a new line with a +1 rcnt to the block below
// Start it at 3 to skip the first few records we don't need (id, player name, password)
if (rcnt == 3) PlayerInfo[playerid][pLevel] = strval(Field);
if (rcnt == 4) PlayerInfo[playerid][pAdmin] = strval(Field);
if (rcnt == 5) PlayerInfo[playerid][pDonateRank] = strval(Field);
if (rcnt == 6) PlayerInfo[playerid][gPupgrade] = strval(Field);
if (rcnt == 7) PlayerInfo[playerid][pConnectTime] = strval(Field);