19.02.2016, 22:38
Код:
public OnPlayerConnect(playerid) { GetPlayerName(playerid, Name[playerid], (24 + 1)); GetPlayerIp(playerid, PlayerIP[playerid], (15+1)); LoadMappings(playerid); TogglePlayerSpectating(playerid, true); CrashCheckTimer[playerid] = SetTimerEx("CheckSpeed", 100, 1, "i", playerid); IsPlayerNameNonRP(Name[playerid]); SetPlayerColor(playerid, COLOR_WHITE); LoadPlayerTextDraws(playerid); if(!IsPlayerNPC(playerid)) { new query[128]; mysql_format(sqlHandle, query, sizeof(query), "SELECT `Password`, `ID` FROM `samp_users` WHERE `Username` = '%e'", Name[playerid]); mysql_tquery(sqlHandle, query, "OnPlayerConnectMessage", "i", playerid); print(query); SendClientMessage(playerid, COLOR_GREEN, "Welcome to "GAMEMODE_NAME". © "SERVER_OWNER" and "SERVER_DEVELOPER""); } return 1; }
Код:
Function:OnPlayerConnectMessage(playerid) { new rows, fields; cache_get_data(rows, fields); cache_get_field_content(0, "Password", Account[playerid][Password]); printf("PASS: %s", Account[playerid][Password]); new string[255]; if(rows) { if(!isnull(string)) format(string, sizeof(string), "%s", EOS); format(string, sizeof(string), "{FFFFFF}Welcome back to {0080C0}"GAMEMODE_NAME"{FFFFFF}, {C0C0C0}%s{FFFFFF}.\n\nPlease enter your {FF0000}password below.{000000}\n{FFFFFF}", GetNameWithSpace(playerid)); ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "{FFFFFF}Welcome to {008080}"GAMEMODE_NAME"", string, "Login", "Quit"); } else { if(!isnull(string)) format(string, sizeof(string), "%s", EOS); format(string, sizeof(string), "{00FF00}Welcome to {008000}"GAMEMODE_NAME"{00FF00}, {008000}%s{00FF00}.\n\n{FFFFFF}We are glad to have you registering here at our server.\n\nYour registration process is simple: \n\n{FFFFFF}1) Type your desired password\n2) Go through the quiz\n", GetNameWithSpace(playerid)); ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD, "{FFFFFF}Welcome to {0080C0}"GAMEMODE_NAME"", string, "Register", "Quit"); } return 1; }
printf("PASS: %s", Account[playerid][Password]);
That isn't working, it just prints "PASS:"