Guest User

Untitled

a guest
May 21st, 2013
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <a_samp>
  2. #include <DOF2>
  3. #include <zcmd>
  4. #include <sscanf>
  5.  
  6. #define CONTAS "Players/%s.ini"
  7. #define REGISTRO 1
  8. #define LOGIN 2
  9.  
  10.  
  11. main()
  12. {
  13. print("\n----------------------------------");
  14. print(" Gamemode de Teste ");
  15. print(" ");
  16. print(" Sistema de registro 1.0 ");
  17. print("----------------------------------\n");
  18. }
  19.  
  20. public OnGameModeInit()
  21. {
  22. SetGameModeText("[FS]Login 1.0");
  23. AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
  24. return 1;
  25. }
  26.  
  27. public OnGameModeExit()
  28. {
  29. DOF2_Exit();
  30. return 1;
  31. }
  32.  
  33. public OnPlayerRequestClass(playerid, classid)
  34. {
  35. new String[256];
  36. format(String, sizeof(String),CONTAS,Nome(playerid));
  37. if(!DOF2_FileExists(String))
  38. {
  39. ShowPlayerDialog(playerid, REGISTRO, DIALOG_STYLE_INPUT,"Registrar","Você ainda não tem uma conta.\nDigite uma senha para registrar:","Registrar","Cancelar");
  40. }
  41. else
  42. {
  43. ShowPlayerDialog(playerid, LOGIN, DIALOG_STYLE_INPUT,"Login","Você já tem uma conta.\nDigite sua senha para continuar:","Logar","Sair");
  44. }
  45. SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
  46. SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
  47. SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
  48. return 1;
  49. }
  50.  
  51. public OnPlayerConnect(playerid)
  52. {
  53. return 1;
  54. }
  55.  
  56. public OnPlayerDisconnect(playerid, reason)
  57. {
  58. return 1;
  59. }
  60.  
  61. public OnPlayerSpawn(playerid)
  62. {
  63. return 1;
  64. }
  65.  
  66. public OnPlayerDeath(playerid, killerid, reason)
  67. {
  68. return 1;
  69. }
  70.  
  71. public OnVehicleSpawn(vehicleid)
  72. {
  73. return 1;
  74. }
  75.  
  76. public OnVehicleDeath(vehicleid, killerid)
  77. {
  78. return 1;
  79. }
  80.  
  81. public OnPlayerText(playerid, text[])
  82. {
  83. return 1;
  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. if(!response) return Kick(playerid);
  216. if(!strlen(inputtext)) return ShowPlayerDialog(playerid, REGISTRO, DIALOG_STYLE_INPUT,"Registrar","Você ainda não tem uma conta.\nDigite uma senha para registrar:","Registrar","Cancelar");
  217. if(strlen(inputtext))
  218. {
  219. new String[256];
  220. format(String, sizeof(String),CONTAS,Nome(playerid));
  221. DOF2_CreateFile(String);
  222. DOF2_SetString(String,"senha",inputtext);
  223. format(String, sizeof(String),"[INFO]: Você se registrou com a senha '%s'",inputtext);
  224. SendClientMessage(playerid, 0xFFFF00AA, String);
  225. PlayerPlaySound(playerid,1057,0.0,0.0,0.0);
  226. }
  227. }
  228.  
  229. if(dialogid == LOGIN)
  230. {
  231. if(!response) return Kick(playerid);
  232. if(!strlen(inputtext)) return ShowPlayerDialog(playerid, LOGIN, DIALOG_STYLE_INPUT,"Login","Você já tem uma conta.\nDigite sua senha para continuar:","Logar","Sair");
  233. new String[256];
  234. format(String, sizeof(String),String,"Senha");
  235. if(!strcmp(inputtext, DOF2_GetString(CONTAS, "senha"), false))
  236. {
  237. SpawnPlayer(playerid);
  238. PlayerPlaySound(playerid,1057,0.0,0.0,0.0);
  239. }
  240. else
  241. {
  242. ShowPlayerDialog(playerid, LOGIN, DIALOG_STYLE_INPUT,"Login","Você já tem uma conta.\nDigite sua senha para continuar:","Logar","Sair");
  243. SendClientMessage(playerid, 0xFF0000AA,"ERRO: Senha errada!");
  244. }
  245. }
  246. return 1;
  247. }
  248.  
  249. public OnPlayerClickPlayer(playerid, clickedplayerid, source)
  250. {
  251. return 1;
  252. }
  253.  
  254. //------------------------------------------------------------------------------
  255. stock Salvar(playerid)
  256. {
  257. new String[256];
  258. format(String, sizeof(String),CONTAS,Nome(playerid));
  259. DOF2_SetString(String,"senha",senha[playerid]);
  260. return 1;
  261. }
  262.  
  263. stock Carregar(playerid)
  264. {
  265. new String[256];
  266. format(String, sizeof(String),CONTAS,Nome(playerid));
  267. senha[playerid] = DOF2_SetString(String,"senha");
  268. return 1;
  269. }
  270. //------------------------------------------------------------------------------
  271. stock Nome(playerid)
  272. {
  273. new pname[MAX_PLAYER_NAME];
  274. GetPlayerName(playerid, pname, MAX_PLAYER_NAME);
  275. return pname;
  276. }
  277. //------------------------------------------------------------------------------
Advertisement
Add Comment
Please, Sign In to add comment