Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #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(db,query)) == INVALID_HANDLE)
- {
- return 0;
- }
- /* Get some info here
- */
- CloseHandle(hQuery)
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement