C-подобный:
#include <sourcemod>
public OnClientPutInServer(client)
{
decl String:SteamID[25];
if (GetClientAuthId(client, AuthId_Steam2, SteamID, sizeof(SteamID))) PrintToChatAll("connected: %s", SteamID);
new String:error[255]
new Handle:db = SQL_DefConnect(error, sizeof(error))
if (db == INVALID_HANDLE)
{
PrintToChatAll("Could not connect: %s", error)
}
else
{
new Handle:hQuery
new String:query[100]
/* Create enough space to make sure our string is quoted properly */
new buffer_len = strlen(SteamID) * 2 + 1
new String:new_name[buffer_len]
/* Ask the SQL driver to make sure our string is safely quoted */
SQL_QuoteString(db, SteamID, new_name, buffer_len)
/* Build the query */
Format(query, sizeof(query), "SELECT userid FROM vb_user WHERE username = '%s'", new_name)
/* Execute the query */
if ((hQuery = SQL_Query(query)) == INVALID_HANDLE)
{
return 0
}
/* Get some info here
*/
CloseHandle(hQuery)
}
}
C-подобный:
(33) : error 035: argument type mismatch (argument 1)
(36) : warning 213: tag mismatch
(3) : error 025: function heading differs from prototype