public OnPlayerConnect(playerid)
{
//Check if player has an account
new query[256], pname[MAX_PLAYER_NAME];
GetPlayerName(playerid, pname, sizeof(pname));
mysql_format(sql_connection, query, sizeof(query), "SELECT * FROM player WHERE name = '%s' LIMIT 1", pname);
mysql_tquery(sql_connection, query, "OnAccountCheck", "r", playerid);
return 1;
}
forward OnAccountCheck(playerid);
public OnAccountCheck(playerid)
{
printf("Connect status: %d", IsPlayerConnected(playerid));
new row_count;
if(!cache_get_row_count(row_count))
{
return 1;
}
if(row_count == 0) //No account, register
{
}
else //Account registered, log in
{
printf("Hello %s", RoleplayName(playerid));
}
return 1;
}
printf("Connect status: %d", IsPlayerConnected(playerid));
Connect status: 0 |
mysql_tquery(sql_connection, query, "OnAccountCheck", "r", playerid);
if(!cache_get_row_count(row_count))
{
return 1;
}
if(row_count == 0) //No account, register
{
}