Advertisement
Guest User

Untitled

a guest
Jun 16th, 2011
2,000
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.21 KB | None | 0 0
  1. #include <sourcemod>
  2. new g_CommandTime[MAXPLAYERS +1];
  3. new Handle:db = INVALID_HANDLE;
  4.  
  5.  
  6. public Plugin:myinfo =
  7. {
  8. name = "Invitation Groupe Steam",
  9. author = "Spirit",
  10. version = "1.0",
  11. description = "Invite les utilisateurs automatiquement dans un groupe",
  12. url = "http://www.zombie-hell.fr"
  13. };
  14.  
  15. public OnPluginStart()
  16. {
  17. new String:error[255];
  18. db = SQL_Connect("invite_steam", true, error, sizeof(error));
  19. if (db == INVALID_HANDLE)
  20. {
  21. PrintToChatAll("Impossible de se connecter: %s", error);
  22. }
  23. }
  24.  
  25. public OnPluginEnd()
  26. {
  27. if (db != INVALID_HANDLE)
  28. {
  29. CloseHandle(db);
  30. db = INVALID_HANDLE;
  31. }
  32. }
  33.  
  34.  
  35.  
  36. public OnClientPutInServer(client)
  37. {
  38. new String:steamid[64];
  39. GetClientAuthString(client, steamid, 64);
  40.  
  41. if (db != INVALID_HANDLE)
  42. {
  43. new String:query[250];
  44. Format(query, sizeof(query), "SELECT * FROM `invite_steam` WHERE `steam_id` LIKE '%s'", steamid);
  45. new Handle:hQuery = SQL_Query(db, query);
  46. if (!SQL_FetchRow(hQuery))
  47. {
  48. new timestamp;
  49. timestamp = GetTime();
  50. Format(query, sizeof(query), "INSERT INTO `invite_steam` (`steam_id` ,`invited`) VALUES ('%s', '0')", steamid);
  51. g_CommandTime[client] = timestamp;
  52. SQL_FastQuery(db, query);
  53. }
  54.  
  55. }
  56. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement