Guest User

Samp

a guest
Sep 29th, 2012
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 4.41 KB | None | 0 0
  1. #include <a_samp>
  2.  
  3. //Mysql
  4. #define SQL_HOST     "localhost"
  5. #define SQL_USER     "root"
  6. #define SQL_DB       "samp"
  7. #define SQL_PASS     "cambiala"
  8. #include <a_mysql>
  9. //forward MySQLUpdateFinish(query[], sqlplayerid);
  10. //forward MySQLUpdateBuild(query[], sqlname);
  11. //========
  12.  
  13.  
  14. #pragma tabsize 0
  15. #define registro                    0
  16. main()
  17. {
  18.     print("\n----------------------------------");
  19.     print(" Blank Gamemode by your name here");
  20.     print("----------------------------------\n");
  21. }
  22.  
  23. public OnGameModeInit()
  24. {
  25.     ConectarMySQL();
  26.     SetGameModeText("Blank Script");
  27.     return 1;
  28. }
  29.  
  30. public OnGameModeExit()
  31. {
  32.     return 1;
  33. }
  34.  
  35. public OnPlayerRequestClass(playerid, classid)
  36. {
  37.  
  38. return 1;
  39. }
  40.  
  41. public OnPlayerConnect(playerid)
  42. {
  43. new szQuery[128], szName[MAX_PLAYER_NAME];
  44. GetPlayerName(playerid, szName, sizeof szName);
  45. format(szQuery, sizeof szQuery, "SELECT * FROM Usuarios WHERE Nombre = '%s'", szName);
  46. mysql_function_query(1, szQuery, true, "OnPlayerExists", "i", playerid);
  47.     return 1;
  48. }
  49.  
  50. public OnPlayerDisconnect(playerid, reason)
  51. {
  52.     return 1;
  53. }
  54.  
  55. public OnPlayerSpawn(playerid)
  56. {
  57.     return 1;
  58. }
  59.  
  60. public OnPlayerDeath(playerid, killerid, reason)
  61. {
  62.     return 1;
  63. }
  64.  
  65. public OnVehicleSpawn(vehicleid)
  66. {
  67.     return 1;
  68. }
  69.  
  70. public OnVehicleDeath(vehicleid, killerid)
  71. {
  72.     return 1;
  73. }
  74.  
  75. public OnPlayerText(playerid, text[])
  76. {
  77.  
  78.     return 1;
  79. }
  80.  
  81. public OnPlayerCommandText(playerid, cmdtext[])
  82. {
  83.     return 0;
  84. }
  85.  
  86. public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
  87. {
  88.     return 1;
  89. }
  90.  
  91. public OnPlayerExitVehicle(playerid, vehicleid)
  92. {
  93.     return 1;
  94. }
  95.  
  96. public OnPlayerStateChange(playerid, newstate, oldstate)
  97. {
  98.     return 1;
  99. }
  100.  
  101. public OnPlayerEnterCheckpoint(playerid)
  102. {
  103.     return 1;
  104. }
  105.  
  106. public OnPlayerLeaveCheckpoint(playerid)
  107. {
  108.     return 1;
  109. }
  110.  
  111. public OnPlayerEnterRaceCheckpoint(playerid)
  112. {
  113.     return 1;
  114. }
  115.  
  116. public OnPlayerLeaveRaceCheckpoint(playerid)
  117. {
  118.     return 1;
  119. }
  120.  
  121. public OnRconCommand(cmd[])
  122. {
  123.     return 1;
  124. }
  125.  
  126. public OnPlayerRequestSpawn(playerid)
  127. {
  128.     return 1;
  129. }
  130.  
  131. public OnObjectMoved(objectid)
  132. {
  133.     return 1;
  134. }
  135.  
  136. public OnPlayerObjectMoved(playerid, objectid)
  137. {
  138.     return 1;
  139. }
  140.  
  141. public OnPlayerPickUpPickup(playerid, pickupid)
  142. {
  143.     return 1;
  144. }
  145.  
  146. public OnVehicleMod(playerid, vehicleid, componentid)
  147. {
  148.     return 1;
  149. }
  150.  
  151. public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
  152. {
  153.     return 1;
  154. }
  155.  
  156. public OnVehicleRespray(playerid, vehicleid, color1, color2)
  157. {
  158.     return 1;
  159. }
  160.  
  161. public OnPlayerSelectedMenuRow(playerid, row)
  162. {
  163.     return 1;
  164. }
  165.  
  166. public OnPlayerExitedMenu(playerid)
  167. {
  168.     return 1;
  169. }
  170.  
  171. public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
  172. {
  173.     return 1;
  174. }
  175.  
  176. public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
  177. {
  178.     return 1;
  179. }
  180.  
  181. public OnRconLoginAttempt(ip[], password[], success)
  182. {
  183.     return 1;
  184. }
  185.  
  186. public OnPlayerUpdate(playerid)
  187. {
  188.     return 1;
  189. }
  190.  
  191. public OnPlayerStreamIn(playerid, forplayerid)
  192. {
  193.     return 1;
  194. }
  195.  
  196. public OnPlayerStreamOut(playerid, forplayerid)
  197. {
  198.     return 1;
  199. }
  200.  
  201. public OnVehicleStreamIn(vehicleid, forplayerid)
  202. {
  203.     return 1;
  204. }
  205.  
  206. public OnVehicleStreamOut(vehicleid, forplayerid)
  207. {
  208.     return 1;
  209. }
  210.  
  211. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  212. {
  213.  if (dialogid == registro)
  214.    {
  215. //new nombre[MAX_PLAYER_NAME], clave[256], query[1024];
  216. //GetPlayerName(playerid, nombre, sizeof(nombre));
  217. //format(clave, sizeof(clave), "%s", inputtext);
  218. //format(query, sizeof(query), "INSERT INTO members (member_name, passwd, real_name) VALUES('%s', MD5('%s'), '%s')", nombre, clave, nombre);
  219. //mysql_query(query);
  220. }
  221.     return 1;
  222. }
  223.  
  224. public OnPlayerClickPlayer(playerid, clickedplayerid, source)
  225. {
  226.     return 1;
  227. }
  228. stock ConectarMySQL()
  229. {
  230.     mysql_connect(SQL_HOST, SQL_USER, SQL_DB, SQL_PASS);
  231.     mysql_debug(1);
  232.     if(mysql_ping() == 1)
  233.     {
  234.         printf("\t\t[MYSQL]: Conexion Satisfactoria (DataBase: '%s')\n", SQL_DB);
  235.     }
  236.     else
  237.     {
  238.         printf("\t\t[MYSQL]: ERROR. Conexion Fallida (DataBase: '%s')\n", SQL_DB);
  239.         SendRconCommand("exit");
  240.     }
  241.     return 1;
  242. }
  243. forward OnPlayerExists(playerid);
  244. public OnPlayerExists(playerid)
  245. {
  246.     new iRows, iFields;
  247.     cache_get_data(iRows, iFields);
  248.     if(iRows)
  249.     {
  250.         SendClientMessage(playerid, -1, "Esta registrado");
  251.     }
  252.     else
  253.     {
  254.         ShowPlayerDialog(playerid, registro, DIALOG_STYLE_PASSWORD, "Registro", "Coloque su contraseña para crear su cuenta", "Registrar", "Cancelar");
  255.     }
  256.     return 1;
  257. }
Advertisement
Add Comment
Please, Sign In to add comment