Guest User

Registro

a guest
May 21st, 2013
30
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.88 KB | None | 0 0
  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. #define COR_PRINCIPAL 0x33AAFFFF
  11. #define COR_USOCORRETO 0x2641FEAA
  12. #define COR_ROXO 0xC798FAAA
  13. #define COR_ERRO 0xFF0000FF
  14.  
  15. new pAdmin[MAX_PLAYERS];
  16.  
  17.  
  18. main()
  19. {
  20. print("\n----------------------------------");
  21. print(" Gamemode de Teste ");
  22. print(" ");
  23. print(" Sistema de registro 1.0 ");
  24. print("----------------------------------\n");
  25. }
  26.  
  27. public OnGameModeInit()
  28. {
  29. SetGameModeText("[FS]Login 1.0");
  30. AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
  31. return 1;
  32. }
  33.  
  34. public OnGameModeExit()
  35. {
  36. DOF2_Exit();
  37. return 1;
  38. }
  39.  
  40. public OnPlayerRequestClass(playerid, classid)
  41. {
  42. new String[256];
  43. format(String, sizeof(String),CONTAS,Nome(playerid));
  44. if(!DOF2_FileExists(String))
  45. {
  46. ShowPlayerDialog(playerid, REGISTRO, DIALOG_STYLE_INPUT,"Registrar","Você ainda não tem uma conta.\nDigite uma senha para registrar:","Registrar","Cancelar");
  47. }
  48. else
  49. {
  50. ShowPlayerDialog(playerid, LOGIN, DIALOG_STYLE_INPUT,"Login","Você já tem uma conta.\nDigite sua senha para continuar:","Logar","Sair");
  51. }
  52. SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
  53. SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
  54. SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
  55. return 1;
  56. }
  57.  
  58. public OnPlayerConnect(playerid)
  59. {
  60. return 1;
  61. }
  62.  
  63. public OnPlayerDisconnect(playerid, reason)
  64. {
  65. return 1;
  66. }
  67.  
  68. public OnPlayerSpawn(playerid)
  69. {
  70. return 1;
  71. }
  72.  
  73. public OnPlayerDeath(playerid, killerid, reason)
  74. {
  75. return 1;
  76. }
  77.  
  78. public OnVehicleSpawn(vehicleid)
  79. {
  80. return 1;
  81. }
  82.  
  83. public OnVehicleDeath(vehicleid, killerid)
  84. {
  85. return 1;
  86. }
  87.  
  88. public OnPlayerText(playerid, text[])
  89. {
  90. return 1;
  91. }
  92.  
  93. //------------------------------------------------------------------------------
  94. CMD:setadmin(playerid, params[])
  95. {
  96. new ID,level,String[250];
  97. if(sscanf(params,"ud",ID,level)) return SendClientMessage(playerid, COR_USOCORRETO,"Uso: /setadmin [ID/Parte do nick] [level]");
  98. if(!IsPlayerConnected(ID)) return SendClientMessage(playerid, COR_ERRO,"ERRO: ID Inválido");
  99. if(level > 5) return SendClientMessage(playerid, COR_ERRO,"ERRO: level 0 - 5");
  100. format(String, sizeof(String),"admCMD: Você mudou a conta de %s para level %d de Administrador.",Nome(ID),level);
  101. SendClientMessage(playerid, COR_PRINCIPAL, String);
  102. format(String, sizeof(String),"admCMD: O Game Master %s mudou o level de sua conta para %d - Administrador.",Nome(playerid),level);
  103. SendClientMessage(ID, COR_PRINCIPAL, String);
  104. pAdmin[ID] = level;
  105. format(String, sizeof(String),"-OpenServ- O Game Master %s mudou o level da conta de %s para %d - Administrador.",Nome(playerid),Nome(ID),level);
  106. for(new i=0; i <= MAX_PLAYERS; i++)
  107. if(pAdmin[i] >= 1)
  108. SendClientMessage(i, 0xFFBD9DFF, String);
  109. return 1;
  110. }
  111. //------------------------------------------------------------------------------
  112.  
  113. public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
  114. {
  115. return 1;
  116. }
  117.  
  118. public OnPlayerExitVehicle(playerid, vehicleid)
  119. {
  120. return 1;
  121. }
  122.  
  123. public OnPlayerStateChange(playerid, newstate, oldstate)
  124. {
  125. return 1;
  126. }
  127.  
  128. public OnPlayerEnterCheckpoint(playerid)
  129. {
  130. return 1;
  131. }
  132.  
  133. public OnPlayerLeaveCheckpoint(playerid)
  134. {
  135. return 1;
  136. }
  137.  
  138. public OnPlayerEnterRaceCheckpoint(playerid)
  139. {
  140. return 1;
  141. }
  142.  
  143. public OnPlayerLeaveRaceCheckpoint(playerid)
  144. {
  145. return 1;
  146. }
  147.  
  148. public OnRconCommand(cmd[])
  149. {
  150. return 1;
  151. }
  152.  
  153. public OnPlayerRequestSpawn(playerid)
  154. {
  155. return 1;
  156. }
  157.  
  158. public OnObjectMoved(objectid)
  159. {
  160. return 1;
  161. }
  162.  
  163. public OnPlayerObjectMoved(playerid, objectid)
  164. {
  165. return 1;
  166. }
  167.  
  168. public OnPlayerPickUpPickup(playerid, pickupid)
  169. {
  170. return 1;
  171. }
  172.  
  173. public OnVehicleMod(playerid, vehicleid, componentid)
  174. {
  175. return 1;
  176. }
  177.  
  178. public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
  179. {
  180. return 1;
  181. }
  182.  
  183. public OnVehicleRespray(playerid, vehicleid, color1, color2)
  184. {
  185. return 1;
  186. }
  187.  
  188. public OnPlayerSelectedMenuRow(playerid, row)
  189. {
  190. return 1;
  191. }
  192.  
  193. public OnPlayerExitedMenu(playerid)
  194. {
  195. return 1;
  196. }
  197.  
  198. public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
  199. {
  200. return 1;
  201. }
  202.  
  203. public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
  204. {
  205. return 1;
  206. }
  207.  
  208. public OnRconLoginAttempt(ip[], password[], success)
  209. {
  210. return 1;
  211. }
  212.  
  213. public OnPlayerUpdate(playerid)
  214. {
  215. return 1;
  216. }
  217.  
  218. public OnPlayerStreamIn(playerid, forplayerid)
  219. {
  220. return 1;
  221. }
  222.  
  223. public OnPlayerStreamOut(playerid, forplayerid)
  224. {
  225. return 1;
  226. }
  227.  
  228. public OnVehicleStreamIn(vehicleid, forplayerid)
  229. {
  230. return 1;
  231. }
  232.  
  233. public OnVehicleStreamOut(vehicleid, forplayerid)
  234. {
  235. return 1;
  236. }
  237.  
  238. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  239. {
  240. if(dialogid == REGISTRO)
  241. {
  242. if(!response) return Kick(playerid);
  243. 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");
  244. if(strlen(inputtext))
  245. {
  246. new String[256];
  247. format(String, sizeof(String),CONTAS,Nome(playerid));
  248. DOF2_CreateFile(String);
  249. DOF2_SetString(String,"senha",inputtext);
  250. format(String, sizeof(String),"[INFO]: Você se registrou com a senha '%s'",inputtext);
  251. SendClientMessage(playerid, 0xFFFF00AA, String);
  252. PlayerPlaySound(playerid,1057,0.0,0.0,0.0);
  253. }
  254. }
  255.  
  256. if(dialogid == LOGIN)
  257. {
  258. if(!response) return Kick(playerid);
  259. if(!strlen(inputtext)) return ShowPlayerDialog(playerid, LOGIN, DIALOG_STYLE_INPUT,"Login","Você já tem uma conta.\nDigite sua senha para continuar:","Logar","Sair");
  260. new String[256];
  261. format(String, sizeof(String),String,"Senha");
  262. if(!strcmp(inputtext, DOF2_GetString(CONTAS, "senha"), false))
  263. {
  264. SpawnPlayer(playerid);
  265. PlayerPlaySound(playerid,1057,0.0,0.0,0.0);
  266. }
  267. else
  268. {
  269. ShowPlayerDialog(playerid, LOGIN, DIALOG_STYLE_INPUT,"Login","Você já tem uma conta.\nDigite sua senha para continuar:","Logar","Sair");
  270. SendClientMessage(playerid, 0xFF0000AA,"ERRO: Senha errada!");
  271. }
  272. }
  273. return 1;
  274. }
  275.  
  276. public OnPlayerClickPlayer(playerid, clickedplayerid, source)
  277. {
  278. return 1;
  279. }
  280.  
  281. //------------------------------------------------------------------------------
  282. stock Salvar(playerid)
  283. {
  284. new String[256];
  285. format(String, sizeof(String),CONTAS,Nome(playerid));
  286. DOF2_SetString(String,"senha",senha[playerid]);
  287. return 1;
  288. }
  289.  
  290. stock Carregar(playerid)
  291. {
  292. new String[256];
  293. format(String, sizeof(String),CONTAS,Nome(playerid));
  294. senha[playerid] = DOF2_SetString(String,"senha");
  295. return 1;
  296. }
  297. //------------------------------------------------------------------------------
  298. stock Nome(playerid)
  299. {
  300. new pname[MAX_PLAYER_NAME];
  301. GetPlayerName(playerid, pname, MAX_PLAYER_NAME);
  302. return pname;
  303. }
  304. //------------------------------------------------------------------------------
Advertisement
Add Comment
Please, Sign In to add comment