Guest User

Untitled

a guest
Nov 26th, 2016
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.50 KB | None | 0 0
  1. #include <a_samp>
  2. #include <zcmd>
  3. #include <a_mysql>
  4.  
  5. #define MySQL_HOST "localhost"
  6. #define MySQL_USER "root"
  7. #define MySQL_DATA "gta-online"
  8. #define MySQL_PASS ""
  9.  
  10. #pragma tabsize 0
  11.  
  12. main()
  13. {
  14. print("\n----------------------------------");
  15. print(" Blank Gamemode by your name here");
  16. print("----------------------------------\n");
  17. }
  18.  
  19. public OnGameModeInit()
  20. {
  21. mysql_debug( true );
  22. mysql_connect( MySQL_HOST,MySQL_USER,MySQL_DATA,MySQL_PASS );
  23. if( mysql_ping( ) >= 1 )
  24. {
  25. print( "Prisijungeme prie MySQL sekmingai!" );
  26. }
  27. else
  28. {
  29. SendRconCommand( "exit" );
  30. if( mysql_ping( ) >= 1 )
  31. }
  32. AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
  33. return 1;
  34. }
  35.  
  36. public OnGameModeExit()
  37. {
  38. mysql_close( );
  39. return 1;
  40. }
  41.  
  42. public OnPlayerRequestClass(playerid, classid)
  43. {
  44. SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
  45. SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
  46. SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
  47. return 1;
  48. }
  49.  
  50. public OnPlayerConnect(playerid)
  51. {
  52. new
  53. Query[ 200 ]
  54. ;
  55. format( Query,sizeof( Query ),"SELECT * FROM `players` WHERE `Vardas` = '%s'",GetPlayerNameEx( playerid ) );
  56. mysql_query( Query );
  57. mysql_store_result( );
  58.  
  59. if( mysql_num_rows( ) )
  60. {
  61. ShowPlayerDialog( playerid,1,DIALOG_STYLE_INPUT,"Login","Praðome prisijungti","Jungtis","Atðaukti" );
  62. }
  63. else
  64. {
  65. ShowPlayerDialog( playerid,0,DIALOG_STYLE_INPUT,"Register","Praðome uþsiregistruoti","Register","Atðaukti" );
  66. }
  67. mysql_free_result( );
  68. return 1;
  69. }
  70.  
  71. public OnPlayerDisconnect(playerid, reason)
  72. {
  73. return 1;
  74. }
  75.  
  76. public OnPlayerSpawn(playerid)
  77. {
  78. return 1;
  79. }
  80.  
  81. public OnPlayerDeath(playerid, killerid, reason)
  82. {
  83. return 1;
  84. }
  85.  
  86. public OnVehicleSpawn(vehicleid)
  87. {
  88. return 1;
  89. }
  90.  
  91. public OnVehicleDeath(vehicleid, killerid)
  92. {
  93. return 1;
  94. }
  95.  
  96. public OnPlayerText(playerid, text[])
  97. {
  98. return 1;
  99. }
  100.  
  101. public OnPlayerCommandText(playerid, cmdtext[])
  102. {
  103. if (strcmp("/mycommand", cmdtext, true, 10) == 0)
  104. {
  105. return 1;
  106. }
  107. return 0;
  108. }
  109.  
  110. public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
  111. {
  112. return 1;
  113. }
  114.  
  115. public OnPlayerExitVehicle(playerid, vehicleid)
  116. {
  117. return 1;
  118. }
  119.  
  120. public OnPlayerStateChange(playerid, newstate, oldstate)
  121. {
  122. return 1;
  123. }
  124.  
  125. public OnPlayerEnterCheckpoint(playerid)
  126. {
  127. return 1;
  128. }
  129.  
  130. public OnPlayerLeaveCheckpoint(playerid)
  131. {
  132. return 1;
  133. }
  134.  
  135. public OnPlayerEnterRaceCheckpoint(playerid)
  136. {
  137. return 1;
  138. }
  139.  
  140. public OnPlayerLeaveRaceCheckpoint(playerid)
  141. {
  142. return 1;
  143. }
  144.  
  145. public OnRconCommand(cmd[])
  146. {
  147. return 1;
  148. }
  149.  
  150. public OnPlayerRequestSpawn(playerid)
  151. {
  152. return 1;
  153. }
  154.  
  155. public OnObjectMoved(objectid)
  156. {
  157. return 1;
  158. }
  159.  
  160. public OnPlayerObjectMoved(playerid, objectid)
  161. {
  162. return 1;
  163. }
  164.  
  165. public OnPlayerPickUpPickup(playerid, pickupid)
  166. {
  167. return 1;
  168. }
  169.  
  170. public OnVehicleMod(playerid, vehicleid, componentid)
  171. {
  172. return 1;
  173. }
  174.  
  175. public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
  176. {
  177. return 1;
  178. }
  179.  
  180. public OnVehicleRespray(playerid, vehicleid, color1, color2)
  181. {
  182. return 1;
  183. }
  184.  
  185. public OnPlayerSelectedMenuRow(playerid, row)
  186. {
  187. return 1;
  188. }
  189.  
  190. public OnPlayerExitedMenu(playerid)
  191. {
  192. return 1;
  193. }
  194.  
  195. public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
  196. {
  197. return 1;
  198. }
  199.  
  200. public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
  201. {
  202. return 1;
  203. }
  204.  
  205. public OnRconLoginAttempt(ip[], password[], success)
  206. {
  207. return 1;
  208. }
  209.  
  210. public OnPlayerUpdate(playerid)
  211. {
  212. return 1;
  213. }
  214.  
  215. public OnPlayerStreamIn(playerid, forplayerid)
  216. {
  217. return 1;
  218. }
  219.  
  220. public OnPlayerStreamOut(playerid, forplayerid)
  221. {
  222. return 1;
  223. }
  224.  
  225. public OnVehicleStreamIn(vehicleid, forplayerid)
  226. {
  227. return 1;
  228. }
  229.  
  230. public OnVehicleStreamOut(vehicleid, forplayerid)
  231. {
  232. return 1;
  233. }
  234.  
  235. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  236. {
  237. if( dialogid == 0 ) //Registracija
  238. {
  239. if( response )
  240. {
  241. if( !strlen( inputtext ) )
  242. return SendClientMessage( playerid,-1,"Laukelis Negali bûti tuðèias." );
  243. if( strlen( inputtext ) > 40 )
  244. return SendClientMessage( playerid,-1,"Slaptaþodis negali bûti ilgesnis nei 40simboliø." );
  245.  
  246. new
  247. Query[ 150 ]
  248. ;
  249. format( Query,sizeof( Query ),"INSERT INTO `players` (Vardas,Slaptazodis) VALUES ('%s','%s')",GetPlayerNameEx( playerid ),inputtext );
  250. mysql_query( Query );
  251. }
  252. else
  253. {
  254. Kick( playerid );
  255. }
  256. return true;
  257. }
  258. if( dialogid == 1 ) //Prisijungimas
  259. {
  260. if( response )
  261. {
  262. if( !strlen( inputtext ) )
  263. return SendClientMessage( playerid,-1,"Laukelis Negali bûti tuðèias." );
  264. if( strlen( inputtext ) > 40 )
  265. return SendClientMessage( playerid,-1,"Slaptaþodis negali bûti ilgesnis nei 40simboliø." );
  266.  
  267. new
  268. Query[ 150 ]
  269. ;
  270. format( Query,sizeof( Query ),"SELECT * FROM `players` WHERE `Vardas` = '%s' AND `Slaptazodis` = '%s'",GetPlayerNameEx( playerid ),inputtext );
  271. mysql_query( Query );
  272. mysql_store_result( );
  273.  
  274. if(! mysql_num_rows( ) )
  275. {
  276. Kick( playerid );
  277. }
  278. else
  279. {
  280. SendClientMessage( playerid,-1,"Prisijungëte sëkmingai!" );
  281. }
  282. if( !response )
  283. {
  284. Kick( playerid );
  285. }
  286. mysql_free_result( );
  287. return true;
  288. }
  289. return true;
  290. }
  291. return true;
  292. }
  293.  
  294. public OnPlayerClickPlayer(playerid, clickedplayerid, source)
  295. {
  296. return 1;
  297. }
  298.  
  299. stock GetPlayerNameEx( playerid )
  300. {
  301. new
  302. Name[ MAX_PLAYER_NAME ]
  303. ;
  304. GetPlayerName( playerid,Name,MAX_PLAYER_NAME );
  305. return Name;
  306. }
Advertisement
Add Comment
Please, Sign In to add comment