Guest User

Untitled

a guest
Aug 12th, 2018
190
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.15 KB | None | 0 0
  1. //=============================================Includes=================================================================================================================================//
  2. #include <a_samp>
  3. #include <a_mysql>
  4. #include <streamer>
  5. //=============================================Defines==================================================================================================================================//
  6. #define db_host "..."
  7. #define db_user "..."
  8. #define db_db "..."
  9. #define db_pass "..."
  10. #define DIALOG_REGISTER 1
  11. #define DIALOG_LOGIN 2
  12. #define RAUDONA 0xFF0000FF
  13. #define MELYNA 0x0087FFFF
  14. #define LIME 0x19FF00FF
  15. //=============================================News=====================================================================================================================================//
  16. new manomysql;
  17. //=============================================Forwards=================================================================================================================================//
  18. forward OnUserCheck(playerid);
  19. //=============================================Callbacks================================================================================================================================//
  20. main()
  21. {
  22. print("==================================");
  23. print("NevLocus GameMode by haX0r");
  24. print("==================================");
  25. }
  26. //--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------//
  27. public OnGameModeInit()
  28. {
  29. //Game mode tipas
  30. SetGameModeText("NevLocus");
  31. //Žaidėjo spawn informacija
  32. AddPlayerClass(289, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
  33. //MySQL
  34. manomysql = mysql_connect(db_host, db_user, db_db, db_pass);
  35. return 1;
  36. }
  37. //--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------//
  38. public OnGameModeExit()
  39. {
  40. mysql_close(manomysql);
  41. return 1;
  42. }
  43. //--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------//
  44. public OnPlayerRequestClass(playerid, classid)
  45. {
  46. SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
  47. SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
  48. SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
  49. return 1;
  50. }
  51. //---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------//
  52. public OnUserCheck(playerid)
  53. {
  54. new num_rows, num_fields;
  55. cache_get_data(num_rows, num_fields, manomysql);
  56. if(num_rows == 0)
  57. {
  58. //Register
  59. ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, "Registracija", "Prašome įvesti sugalvotą slaptažodį!", "Registruotis", "Išeiti");
  60. }
  61. else
  62. {
  63. //Login
  64. }
  65. return 1;
  66. }
  67. //---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------//
  68. public OnPlayerConnect(playerid)
  69. {
  70. new vardas [MAX_PLAYER_NAME], query[64];
  71. GetPlayerName(playerid, vardas, sizeof(vardas));
  72. format(query, sizeof(query), "SELECT `id` FROM `user` WHERE `vardas` = '%s'", vardas);
  73. mysql_function_query(manomysql, query, true, "OnUserCheck", "i", playerid);
  74. return 1;
  75. }
  76.  
  77. public OnPlayerDisconnect(playerid, reason)
  78. {
  79. return 1;
  80. }
  81.  
  82. public OnPlayerSpawn(playerid)
  83. {
  84. return 1;
  85. }
  86.  
  87. public OnPlayerDeath(playerid, killerid, reason)
  88. {
  89. return 1;
  90. }
  91.  
  92. public OnVehicleSpawn(vehicleid)
  93. {
  94. return 1;
  95. }
  96.  
  97. public OnVehicleDeath(vehicleid, killerid)
  98. {
  99. return 1;
  100. }
  101.  
  102. public OnPlayerText(playerid, text[])
  103. {
  104. return 1;
  105. }
  106.  
  107. public OnPlayerCommandText(playerid, cmdtext[])
  108. {
  109. if(!strcmp("/tr1", cmdtext, true, 10))
  110. {
  111. new Float:x, Float:y, Float:z;
  112. GetPlayerPos(playerid, x, y, z);
  113. y = y + 5;
  114. x = x + 5;
  115. SetVehicleNumberPlate(CreateVehicle(560, x, y, z, 0, 229, 229, -1, 0), "Minerva");
  116. }
  117. return 0;
  118. }
  119.  
  120. public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
  121. {
  122. return 1;
  123. }
  124.  
  125. public OnPlayerExitVehicle(playerid, vehicleid)
  126. {
  127. return 1;
  128. }
  129.  
  130. public OnPlayerStateChange(playerid, newstate, oldstate)
  131. {
  132. return 1;
  133. }
  134.  
  135. public OnPlayerEnterCheckpoint(playerid)
  136. {
  137. return 1;
  138. }
  139.  
  140. public OnPlayerLeaveCheckpoint(playerid)
  141. {
  142. return 1;
  143. }
  144.  
  145. public OnPlayerEnterRaceCheckpoint(playerid)
  146. {
  147. return 1;
  148. }
  149.  
  150. public OnPlayerLeaveRaceCheckpoint(playerid)
  151. {
  152. return 1;
  153. }
  154.  
  155. public OnRconCommand(cmd[])
  156. {
  157. return 1;
  158. }
  159.  
  160. public OnPlayerRequestSpawn(playerid)
  161. {
  162. return 1;
  163. }
  164.  
  165. public OnObjectMoved(objectid)
  166. {
  167. return 1;
  168. }
  169.  
  170. public OnPlayerObjectMoved(playerid, objectid)
  171. {
  172. return 1;
  173. }
  174.  
  175. public OnPlayerPickUpPickup(playerid, pickupid)
  176. {
  177. return 1;
  178. }
  179.  
  180. public OnVehicleMod(playerid, vehicleid, componentid)
  181. {
  182. return 1;
  183. }
  184.  
  185. public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
  186. {
  187. return 1;
  188. }
  189.  
  190. public OnVehicleRespray(playerid, vehicleid, color1, color2)
  191. {
  192. return 1;
  193. }
  194.  
  195. public OnPlayerSelectedMenuRow(playerid, row)
  196. {
  197. return 1;
  198. }
  199.  
  200. public OnPlayerExitedMenu(playerid)
  201. {
  202. return 1;
  203. }
  204.  
  205. public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
  206. {
  207. return 1;
  208. }
  209.  
  210. public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
  211. {
  212. return 1;
  213. }
  214.  
  215. public OnRconLoginAttempt(ip[], password[], success)
  216. {
  217. return 1;
  218. }
  219.  
  220. public OnPlayerUpdate(playerid)
  221. {
  222. return 1;
  223. }
  224.  
  225. public OnPlayerStreamIn(playerid, forplayerid)
  226. {
  227. return 1;
  228. }
  229.  
  230. public OnPlayerStreamOut(playerid, forplayerid)
  231. {
  232. return 1;
  233. }
  234.  
  235. public OnVehicleStreamIn(vehicleid, forplayerid)
  236. {
  237. return 1;
  238. }
  239.  
  240. public OnVehicleStreamOut(vehicleid, forplayerid)
  241. {
  242. return 1;
  243. }
  244.  
  245. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  246. {
  247. if(dialogid == DIALOG_REGISTER)
  248. {
  249. if(response)
  250. {
  251. //Slaptažodžio ilgis
  252. new vardas[MAX_PLAYER_NAME], query[64], slaptazodis[32];
  253. GetPlayerName(playerid, vardas, sizeof(vardas));
  254. if(strlen(inputtext) >= 6)
  255. {
  256. mysql_escape_string(inputtext, slaptazodis, manomysql);
  257. format(query, sizeof(query), "INSERT INTO `user` (vardas, slaptazodis) VALUES ('%s', '%s')", vardas, inputtext);
  258. mysql_function_query(manomysql, query, false, "", "");
  259. SendClientMessage(playerid, LIME, "Sėkmingai užsiregistravote serveryje! Gero žaidimo");
  260. }
  261. else
  262. {
  263. SendClientMessage(playerid, MELYNA, "Slaptažodis turi būti bent 6 simbolių ilgio!");
  264. ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, "Registracija", "Prašome įvesti sugalvotą slaptažodį!", "Registruotis", "Išeiti");
  265. }
  266. }
  267. else
  268. {
  269. Kick(playerid);
  270. SendClientMessage(playerid, RAUDONA, "Atšaukėte registraciją!");
  271. }
  272. }
  273. return 1;
  274. }
  275.  
  276. public OnPlayerClickPlayer(playerid, clickedplayerid, source)
  277. {
  278. return 1;
  279. }
Advertisement
Add Comment
Please, Sign In to add comment