Advertisement
Guest User

xsL33 scriptt

a guest
Sep 19th, 2013
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.48 KB | None | 0 0
  1.  
  2.  
  3. #include <a_samp>
  4. #include <a_mysql>
  5. #include <ocmd>
  6. #include <sscanf2>
  7. #define Rot 0xC30000FF
  8.  
  9. //enums
  10. enum playerInfo{
  11. eingeloggt,
  12. level
  13. }
  14. new sInfo[MAX_PLAYERS][playerinfo];
  15. //Globale Variablen
  16. new dbhandle;
  17.  
  18.  
  19.  
  20.  
  21. //Dialoge
  22. #define DIALOG_REGISTER 1
  23. #define DIALOG_LOGIN 2
  24.  
  25. //MySQL
  26. #define db_host "*zensiert*"
  27. #define db_user "*zensiert*"
  28. #define db_pass "*zensiert*"
  29. #define db_db "*zensiert*
  30.  
  31. //Forwards
  32. forward OnUserCheck(playerid);
  33. forward OnPasswordResponse(playerid);
  34.  
  35. main()
  36. {
  37. print("\n----------------------------------");
  38. print(" Blank Gamemode by your name here");
  39. print("----------------------------------\n");
  40. }
  41.  
  42.  
  43. public OnGameModeInit()
  44. {
  45. SetGameModeText("Blank Script");
  46. AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
  47.  
  48. //MYSQL
  49. dbhandle = mysql_connect(db_host,db_user,db_db,db_pass);
  50. return 1;
  51. }
  52.  
  53. public OnGameModeExit()
  54. {
  55. mysql_close(dbhandle);
  56. return 1;
  57. }
  58.  
  59. public OnPlayerRequestClass(playerid, classid)
  60. {
  61. SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
  62. SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
  63. SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
  64. return 1;
  65. }
  66.  
  67. public OnPlayerConnect(playerid)
  68. {
  69. new name[MAX_PLAYER_NAME],query[128];
  70. GetPlayerName(playerid,name,sizeof(name));
  71. format(query,sizeof(query),"SELECT id FROM user WHERE username='%s'",name);
  72. mysql_function_query(dbhandle,query,true,"OnUserCheck","i",playerid);
  73.  
  74. return 1;
  75. }
  76. public OnUserCheck(playerid)
  77. {
  78. new num_rows,num_fields;
  79. cache_get_data(num_rows,num_fields,dbhandle);
  80. if(num_rows==0)
  81. {
  82. //Registrierung
  83. ShowPlayerDialog(playerid,DIALOG_REGISTER,DIALOG_STYLE_INPUT,"Regstrierung","Gib bitte dein gewünschtes Passwort an:","OK","Abbrechen");
  84. }
  85. else
  86. //Login
  87. ShowPlayerDialog(playerid,DIALOG_LOGIN,DIALOG_STYLE_PASSWORD,"Login Vorgang","Gib bitte dein Passwort ein:","OK","Abbrechen");
  88. }
  89. return 1;
  90. }
  91.  
  92. public OnPlayerDisconnect(playerid, reason)
  93. {
  94. return 1;
  95. }
  96.  
  97. public OnPlayerSpawn(playerid)
  98. {
  99. return 1;
  100. }
  101.  
  102. public OnPlayerDeath(playerid, killerid, reason)
  103. {
  104. return 1;
  105. }
  106.  
  107. public OnVehicleSpawn(vehicleid)
  108. {
  109. return 1;
  110. }
  111.  
  112. public OnVehicleDeath(vehicleid, killerid)
  113. {
  114. return 1;
  115. }
  116.  
  117. public OnPlayerText(playerid, text[])
  118. {
  119. return 1;
  120. }
  121.  
  122. public OnPlayerCommandText(playerid, cmdtext[])
  123. {
  124. if (strcmp("/mycommand", cmdtext, true, 10) == 0)
  125. {
  126. // Do something here
  127. return 1;
  128. }
  129. return 0;
  130. }
  131.  
  132. public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
  133. {
  134. return 1;
  135. }
  136.  
  137. public OnPlayerExitVehicle(playerid, vehicleid)
  138. {
  139. return 1;
  140. }
  141.  
  142. public OnPlayerStateChange(playerid, newstate, oldstate)
  143. {
  144. return 1;
  145. }
  146.  
  147. public OnPlayerEnterCheckpoint(playerid)
  148. {
  149. return 1;
  150. }
  151.  
  152. public OnPlayerLeaveCheckpoint(playerid)
  153. {
  154. return 1;
  155. }
  156.  
  157. public OnPlayerEnterRaceCheckpoint(playerid)
  158. {
  159. return 1;
  160. }
  161.  
  162. public OnPlayerLeaveRaceCheckpoint(playerid)
  163. {
  164. return 1;
  165. }
  166.  
  167. public OnRconCommand(cmd[])
  168. {
  169. return 1;
  170. }
  171.  
  172. public OnPlayerRequestSpawn(playerid)
  173. {
  174. return 1;
  175. }
  176.  
  177. public OnObjectMoved(objectid)
  178. {
  179. return 1;
  180. }
  181.  
  182. public OnPlayerObjectMoved(playerid, objectid)
  183. {
  184. return 1;
  185. }
  186.  
  187. public OnPlayerPickUpPickup(playerid, pickupid)
  188. {
  189. return 1;
  190. }
  191.  
  192. public OnVehicleMod(playerid, vehicleid, componentid)
  193. {
  194. return 1;
  195. }
  196.  
  197. public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
  198. {
  199. return 1;
  200. }
  201.  
  202. public OnVehicleRespray(playerid, vehicleid, color1, color2)
  203. {
  204. return 1;
  205. }
  206.  
  207. public OnPlayerSelectedMenuRow(playerid, row)
  208. {
  209. return 1;
  210. }
  211.  
  212. public OnPlayerExitedMenu(playerid)
  213. {
  214. return 1;
  215. }
  216.  
  217. public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
  218. {
  219. return 1;
  220. }
  221.  
  222. public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
  223. {
  224. return 1;
  225. }
  226.  
  227. public OnRconLoginAttempt(ip[], password[], success)
  228. {
  229. return 1;
  230. }
  231.  
  232. public OnPlayerUpdate(playerid)
  233. {
  234. return 1;
  235. }
  236.  
  237. public OnPlayerStreamIn(playerid, forplayerid)
  238. {
  239. return 1;
  240. }
  241.  
  242. public OnPlayerStreamOut(playerid, forplayerid)
  243. {
  244. return 1;
  245. }
  246.  
  247. public OnVehicleStreamIn(vehicleid, forplayerid)
  248. {
  249. return 1;
  250. }
  251.  
  252. public OnVehicleStreamOut(vehicleid, forplayerid)
  253. {
  254. return 1;
  255. }
  256. public OnPasswordResponse(playerid)
  257. {
  258. new num_fields,num_rows;
  259. chache_get_data(num_rows,num_fields,dbhandle);
  260. if(num_rows==1)
  261. {
  262. //Passwort richtig
  263. sInfo[playerid][eingeloggt] = 1;
  264. sInfo[playerid][level] = chache_get_field_content_int(0,"level",dbhandle);
  265. }
  266. else
  267. {
  268. //Passwort falsch
  269. SendClientMessage(playerid,Rot,"Das eingegebene Passwort ist falsch");
  270. ShowPlayerDialog(playerid,DIALOG_LOGIN,DIALOG_STYLE_PASSWORD,"Login Vorgang","Gib bitte dein Passwort ein:","OK","Abbrechen");
  271. }
  272. return 1;
  273. }
  274.  
  275. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  276. {
  277. if(dialogid==DIALOG_LOGIN)
  278. {
  279. if(response)
  280. {
  281. new name[MAX_PLAYER_NAME],query[128],passwort[25];
  282. GetPlayerName(playerid,name,sizeof(name));
  283. if(strlen(inputtext)>0)
  284. {
  285. mysql_escape_string(inputtext,passwort,dbhandle);
  286. format(query,sizeof(query),"SELECT * FROM user WHERE username:'%s' AND password='%s'",name,passwort);
  287. mysql_function_query(dbhandle,query,true,"OnPasswordResponse","i",playerid);
  288. {
  289. else
  290. {
  291. SendClientMessage(playerid,Rot,"Gib bitte dein Passwort ein!");
  292. ShowPlayerDialog(playerid,DIALOG_LOGIN,DIALOG_STYLE_PASSWORD,"Login Vorgang","Gib bitte dein Passwort ein:","OK","Abbrechen");
  293. }
  294. }
  295. else
  296. {
  297. Kick(playerid);
  298. }
  299. return 1;
  300. }
  301. if(dialogid==DIALOG_REGISTER)
  302. {
  303. if(response)
  304. {
  305. new name[MAX_PLAYER_NAME],query[128],passwort[25];
  306. GetPlayerName(playerid,name,sizeof(name));
  307. if(strlen(inputtext)>4)
  308. {
  309. //registrierungsfunktion
  310. mysql_escape_string(inputtext,passwort,dbhandle);
  311. format(query,sizeof(query),"INSERT INTO user (username,password) VALUES ('%s','%s' ",name,passwort);
  312. mysql_function_query(dbhandle,query,false,"","");
  313. }
  314. else
  315. {
  316. //kleiner als 3Zeichen
  317. SendClientMessage(playerid,Rot,"Dein Passwort muss mindenstens 5 Zeichen haben!");
  318. ShowPlayerDialog(playerid,DIALOG_REGISTER,DIALOG_STYLE_INPUT,"Regstrierung","Gib bitte dein gewünschtes Passwort an:","OK","Abbrechen");
  319.  
  320. }
  321. }
  322. else
  323. {
  324. Kick(playerid);
  325. }
  326. return 1;
  327. }
  328. return 1;
  329. }
  330.  
  331. public OnPlayerClickPlayer(playerid, clickedplayerid, source)
  332. {
  333. return 1;
  334. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement