Hi people, I start with MySQL with this simple code to load frags with SteamID of the player.
The code:
PHP Code:
public OnClientAuthorized(client, const String:auth[]);
{
new String:name[32] = GetClientName(client, name, sizeof(name))
new String:query[255];
Format(query, sizeof(query), "SELECT frags FROM users WHERE ID = ^"%s^"", auth);
new Handle:hQuery = SQL_Query(db, query)
if (hQuery == INVALID_HANDLE)
{
return Plugin_Handled;
}
CheckAndLoad(client, hQuery)
}
public CheckAndLoad(client, Handle:query)
{
new String:name[65]
while(SQL_FetchRow(query))
{
SQL_FetchString(query, 0, name, sizeof(name))
PrintToChat(client, "Your frags are loaded!");
}
}
I have 2 questions. If I put this code:
PHP Code:
if(SQL_FetchRow(query))
{
SQL_FetchString(query, 0, name, sizeof(name))
PrintToChat(client, "Your frags are loaded!");
/*PrintToServer("Name \"%s\" was found.", name)*/
}
else
{
PrintToChat(client, "Frags don't founded");
}
It's ok? I want to give an error message if the user don't stay in the database. And if I want to load more data? Example: frags, deaths, round wins...
Thank you