pa2kelis

Untitled

Jan 15th, 2017
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 5.44 KB | None | 0 0
  1. #include <a_samp>
  2. #include <a_mysql>
  3.  
  4. //MYSQL DEFINE
  5. #define MySQL_HOST "localhost"
  6. #define MySQL_USER "root"
  7. #define MySQL_DATA "bandom"
  8. #define MySQL_PASS ""
  9.  
  10. main()
  11. {
  12.     print("\n----------------------------------");
  13.     print(" Blank Gamemode by your name here");
  14.     print("----------------------------------\n");
  15. }
  16.  
  17.  
  18. public OnGameModeInit()
  19. {
  20.     mysql_debug( true );
  21.     mysql_connect( MySQL_HOST,MySQL_USER,MySQL_DATA,MySQL_PASS );
  22.     if( mysql_ping( ) >= 1 )
  23. {
  24.     print( "Prisijungeme prie MySQL sekmingai!" );
  25. }
  26. else
  27. {
  28.     SendRconCommand( "exit" );
  29. }
  30.     // Don't use these lines if it's a filterscript
  31.     SetGameModeText("mokomasis");
  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. stock GetPlayerNameEx( playerid )
  51. {
  52. new
  53.     Name[ MAX_PLAYER_NAME ]
  54. ;
  55. GetPlayerName( playerid,Name,MAX_PLAYER_NAME );
  56. return Name;
  57. }
  58.  
  59. public OnPlayerConnect(playerid)
  60. {
  61. new
  62.     Query[ 200 ]
  63. ;
  64. format( Query,sizeof( Query ),"SELECT * FROM `players` WHERE `Vardas` = '%s'",GetPlayerNameEx( playerid ) );
  65. mysql_query( Query );
  66. mysql_store_result( );
  67.  
  68. if( mysql_num_rows( ) )
  69. {
  70.     ShowPlayerDialog( playerid,1,DIALOG_STYLE_INPUT,"Login","Prašome prisijungti","Jungtis","Atšaukti" );
  71. }
  72. else
  73. {
  74.     ShowPlayerDialog( playerid,0,DIALOG_STYLE_INPUT,"Register","Prašome užsiregistruoti","Register","Atšaukti" );
  75. }
  76. mysql_free_result( );
  77.     return 1;
  78. }
  79.  
  80. public OnPlayerDisconnect(playerid, reason)
  81. {
  82.     return 1;
  83. }
  84.  
  85. public OnPlayerSpawn(playerid)
  86. {
  87.     return 1;
  88. }
  89.  
  90. public OnPlayerDeath(playerid, killerid, reason)
  91. {
  92.     return 1;
  93. }
  94.  
  95. public OnVehicleSpawn(vehicleid)
  96. {
  97.     return 1;
  98. }
  99.  
  100. public OnVehicleDeath(vehicleid, killerid)
  101. {
  102.     return 1;
  103. }
  104.  
  105. public OnPlayerText(playerid, text[])
  106. {
  107.     return 1;
  108. }
  109.  
  110. public OnPlayerCommandText(playerid, cmdtext[])
  111. {
  112.     if (strcmp("/mycommand", cmdtext, true, 10) == 0)
  113.     {
  114.         // Do something here
  115.         return 1;
  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 == 0 ) //Registracija
  248. {
  249.     if( response )
  250.     {
  251.         if( !strlen( inputtext ) )
  252.             return SendClientMessage( playerid,-1,"Laukelis Negali b?ti tu??ias." );
  253.         if( strlen( inputtext ) > 40 )
  254.             return SendClientMessage( playerid,-1,"Slapta?odis negali b?ti ilgesnis nei 40simboliø." );
  255.  
  256.         new
  257.             Query[ 150 ]
  258.         ;
  259.         format( Query,sizeof( Query ),"INSERT INTO `players` (Vardas,Slaptazodis) VALUES ('%s','%s')",GetPlayerNameEx( playerid ),inputtext );
  260.         mysql_query( Query );
  261.     }
  262.     else
  263.     {
  264.         Kick( playerid );
  265.     }
  266.     return true;
  267. }
  268. if( dialogid == 1 ) //Prisijungimas
  269. {
  270.     if( response )
  271.     {
  272.         if( !strlen( inputtext ) )
  273.             return SendClientMessage( playerid,-1,"Laukelis Negali b?ti tu??ias." );
  274.         if( strlen( inputtext ) > 40 )
  275.             return SendClientMessage( playerid,-1,"Slapta?odis negali b?ti ilgesnis nei 40simboliø." );
  276.  
  277.         new
  278.             Query[ 150 ]
  279.         ;
  280.         format( Query,sizeof( Query ),"SELECT * FROM `players` WHERE `Vardas` = '%s' AND `Slaptazodis` = '%s'",GetPlayerNameEx( playerid ),inputtext );
  281.         mysql_query( Query );
  282.         mysql_store_result( );
  283.  
  284.         if(! mysql_num_rows( ) )
  285.         {
  286.             Kick( playerid );
  287.         }
  288.         else
  289.         {
  290.             SendClientMessage( playerid,-1,"Prisijung?te s?kmingai!" );
  291.         }
  292.     if( !response )
  293.     {
  294.         Kick( playerid );
  295.     }
  296.     mysql_free_result( );
  297.     return true;
  298. }
  299. return true;
  300. }
  301. return true;
  302. }
  303.  
  304. public OnPlayerClickPlayer(playerid, clickedplayerid, source)
  305. {
  306.     return 1;
  307. }
Advertisement
Add Comment
Please, Sign In to add comment