Advertisement
Guest User

Untitled

a guest
Aug 16th, 2014
41
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.65 KB | None | 0 0
  1. public OnPlayerRequestClass(playerid, classid)
  2. {
  3. SetPlayerPos(playerid, 2079.3750000,-3683.2011700,4.3381200);
  4. SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
  5. SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
  6. return 1;
  7. }
  8.  
  9. public OnPlayerConnect(playerid)
  10. {
  11. print("OnPlayerConnect callback is being called successfully.");
  12. new PLAYER_NAME[MAX_PLAYER_NAME];
  13. GetPlayerName(playerid, PLAYER_NAME, sizeof(PLAYER_NAME));
  14.  
  15. if(fexist(Path(playerid)))
  16. {
  17. INI_ParseFile(Path(playerid), "loadaccount_%s", .bExtra = true, .extra = playerid);
  18. ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "Login", "Welcome back. This account is registered. \nInsert your password to login to your account","Login","Quit");
  19. }
  20. else
  21. {
  22. ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD, "Registration", "Welcome! This account is not registered.\nEnter your own password to create a new account.","Register","Quit");
  23. }
  24. return 1;
  25. }
  26.  
  27. public OnPlayerDisconnect(playerid, reason)
  28. {
  29. SaveAccount(playerid);
  30. PLAYER_INFO[playerid][IS_LOGGEDIN] = false;
  31. PLAYER_INFO[playerid][NEW_REGISTRATION] = false;
  32. return 1;
  33. }
  34.  
  35. public OnPlayerSpawn(playerid)
  36. {
  37. if(PLAYER_INFO[playerid][NEW_REGISTRATION])
  38. {
  39. //Show class selection
  40. }
  41. else if(!PLAYER_INFO[playerid][NEW_REGISTRATION])
  42. {
  43. //Spawn player with the guns, skin, previous health, position, etc
  44. }
  45. return 1;
  46. }
  47.  
  48. public OnPlayerDeath(playerid, killerid, reason)
  49. {
  50. return 1;
  51. }
  52.  
  53. public OnVehicleSpawn(vehicleid)
  54. {
  55. return 1;
  56. }
  57.  
  58. public OnVehicleDeath(vehicleid, killerid)
  59. {
  60. return 1;
  61. }
  62.  
  63. public OnPlayerText(playerid, text[])
  64. {
  65. return 1;
  66. }
  67.  
  68. public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
  69. {
  70. return 1;
  71. }
  72.  
  73. public OnPlayerExitVehicle(playerid, vehicleid)
  74. {
  75. return 1;
  76. }
  77.  
  78. public OnPlayerStateChange(playerid, newstate, oldstate)
  79. {
  80. return 1;
  81. }
  82.  
  83. public OnPlayerEnterCheckpoint(playerid)
  84. {
  85. return 1;
  86. }
  87.  
  88. public OnPlayerLeaveCheckpoint(playerid)
  89. {
  90. return 1;
  91. }
  92.  
  93. public OnPlayerEnterRaceCheckpoint(playerid)
  94. {
  95. return 1;
  96. }
  97.  
  98. public OnPlayerLeaveRaceCheckpoint(playerid)
  99. {
  100. return 1;
  101. }
  102.  
  103. public OnRconCommand(cmd[])
  104. {
  105. return 1;
  106. }
  107.  
  108. public OnPlayerRequestSpawn(playerid)
  109. {
  110. return 1;
  111. }
  112.  
  113. public OnObjectMoved(objectid)
  114. {
  115. return 1;
  116. }
  117.  
  118. public OnPlayerObjectMoved(playerid, objectid)
  119. {
  120. return 1;
  121. }
  122.  
  123. public OnPlayerPickUpPickup(playerid, pickupid)
  124. {
  125. return 1;
  126. }
  127.  
  128. public OnVehicleMod(playerid, vehicleid, componentid)
  129. {
  130. return 1;
  131. }
  132.  
  133. public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
  134. {
  135. return 1;
  136. }
  137.  
  138. public OnVehicleRespray(playerid, vehicleid, color1, color2)
  139. {
  140. return 1;
  141. }
  142.  
  143. public OnPlayerSelectedMenuRow(playerid, row)
  144. {
  145. return 1;
  146. }
  147.  
  148. public OnPlayerExitedMenu(playerid)
  149. {
  150. return 1;
  151. }
  152.  
  153. public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
  154. {
  155. return 1;
  156. }
  157.  
  158. public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
  159. {
  160. return 1;
  161. }
  162.  
  163. public OnRconLoginAttempt(ip[], password[], success)
  164. {
  165. return 1;
  166. }
  167.  
  168. public OnPlayerUpdate(playerid)
  169. {
  170. return 1;
  171. }
  172.  
  173. public OnPlayerStreamIn(playerid, forplayerid)
  174. {
  175. return 1;
  176. }
  177.  
  178. public OnPlayerStreamOut(playerid, forplayerid)
  179. {
  180. return 1;
  181. }
  182.  
  183. public OnVehicleStreamIn(vehicleid, forplayerid)
  184. {
  185. return 1;
  186. }
  187.  
  188. public OnVehicleStreamOut(vehicleid, forplayerid)
  189. {
  190. return 1;
  191. }
  192.  
  193. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  194. {
  195. if(dialogid == DIALOG_REGISTER)
  196. {
  197. if(!response) return Kick(playerid);
  198. if(response)
  199. {
  200. if(!strlen(inputtext) || strlen(inputtext) < 6)
  201. {
  202. ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD,"Register","Welcome! This account is not registered.\nEnter your own password to create a new account.\nPlease enter a valid password (minimum 6 characters long).","Register","Quit");
  203. return 1;
  204. }
  205. new hashpass[129];
  206. WP_Hash(hashpass,sizeof(hashpass),inputtext);
  207. new INI:file = INI_Open(Path(playerid));
  208. INI_SetTag(file,"PLAYER DATA");
  209. INI_WriteString(file,"PASSSORD", hashpass);
  210. INI_WriteInt(file,"MONEY",0);
  211. INI_WriteInt(file,"SKIN",0);
  212. INI_WriteInt(file,"LEVEL",0);
  213. INI_WriteInt(file,"EXP",0);
  214. INI_WriteInt(file,"KILLS",0);
  215. INI_WriteInt(file,"LOGGED IN",0);
  216. INI_WriteInt(file,"FIRST CONNECTION",0);
  217. INI_Close(file);
  218.  
  219. PLAYER_INFO[playerid][IS_LOGGEDIN] = true;
  220. PLAYER_INFO[playerid][NEW_REGISTRATION] = true;
  221. return 1;
  222. }
  223. }
  224. if(dialogid == DIALOG_LOGIN)
  225. {
  226. if(!response) return Kick(playerid);
  227. if(response)
  228. {
  229. new hashpass[129];
  230. WP_Hash(hashpass,sizeof(hashpass),inputtext);
  231. if(!strcmp(hashpass, PLAYER_INFO[playerid][PASSWORD], false))
  232. {
  233. INI_ParseFile(Path(playerid),"loadaccount_%s",.bExtra = true, .extra = playerid);
  234. SetPlayerScore(playerid, PLAYER_INFO[playerid][LEVEL]);
  235. GivePlayerMoney(playerid, PLAYER_INFO[playerid][MONEY]);
  236. PLAYER_INFO[playerid][IS_LOGGEDIN] = true;
  237. }
  238. else
  239. {
  240. ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD,"Login","Welcome back. This account is registered. \nInsert the correct password to login to your account.","Login","Quit");//We will tell to them that they've entered an incorrect password
  241. return 1;
  242. }
  243. }
  244. }
  245. return 1;
  246. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement