Guest User

Untitled

a guest
Oct 7th, 2017
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.94 KB | None | 0 0
  1. // This is a comment
  2. // uncomment the line below if you want to write a filterscript
  3. //#define FILTERSCRIPT
  4.  
  5. #include <a_samp>
  6. #include <a_objects>
  7. #include <streamer>
  8. #include <YSI\y_ini>
  9. #include <YSI\y_iterate>
  10. #include <utils>
  11. #include <zcmd>
  12.  
  13. #pragma unused IsNumeric
  14. #pragma unused ReturnUser
  15.  
  16. #define D_REGISTER 1
  17. #define D_LOGIN 2
  18. #define D_SREGISTER 3
  19. #define D_EMAIL 4
  20. #define D_COUNTRY 5
  21. #define D_SEX 6
  22. #define D_AGE 7
  23.  
  24. #define SCM SendClientMessage
  25. #define SCMTA SendClientMessageToAll
  26. #define SPD ShowPlayerDialog
  27. #define IPI INVALID_PLAYER_ID
  28. #define DSI DIALOG_STYLE_INPUT
  29. #define DSM DIALOG_STYLE_MSGBOX
  30. #define DSL DIALOG_STYLE_LIST
  31. #define DSP DIALOG_STYLE_PASSWORD
  32.  
  33. #define F_PLAYERS "Server/Players/%s.ini"
  34.  
  35. native WP_Hash(buffer[],len,const str[]);
  36.  
  37. enum PlayerInfo
  38. {
  39. Pass[129],
  40. Email,
  41. Country,
  42. Sex,
  43. Age
  44. }
  45. new pInfo[MAX_PLAYERS][PlayerInfo];
  46.  
  47. stock F_PLAYERS(playerid)
  48. {
  49. new str[128],name[MAX_PLAYER_NAME];
  50. GetPlayerName(playerid,name,sizeof(name));
  51. format(str,sizeof(str),UserPath,name);
  52. return str;
  53. }
  54.  
  55. forward loadaccount_user(playerid, name[], value[]);
  56.  
  57. public loadaccount_user(playerid, name[], value[])
  58. {
  59. INI_String("Password", pInfo[playerid][Pass],129);
  60. INI_Int("Email",pInfo[playerid][D_EMAIL]);
  61. INI_Int("Counrty",pInfo[playerid][D_COUNTRY]);
  62. INI_Int("Sex",pInfo[playerid][D_SEX]);
  63. INI_Int("Age",pInfo[playerid][D_AGE]);
  64. return 1;
  65. }
  66.  
  67. main()
  68. {
  69. print("\n----------------------------------");
  70. print(" Blank Gamemode by your name here");
  71. print("----------------------------------\n");
  72. }
  73.  
  74.  
  75. public OnGameModeInit()
  76. {
  77. SetGameModeText("xInsanity | v1.0.0 | xLeafyz.");
  78. AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
  79. return 1;
  80. }
  81.  
  82. public OnGameModeExit()
  83. {
  84. return 1;
  85. }
  86.  
  87. public OnPlayerRequestClass(playerid, classid)
  88. {
  89. SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
  90. SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
  91. SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
  92. return 1;
  93. }
  94.  
  95. public OnPlayerConnect(playerid)
  96. {
  97. new name[MAX_PLAYER_NAME];
  98. GetPlayerName(playerid,name,sizeof(name));
  99. if(fexist(F_PLAYERS(playerid)))
  100. {
  101. INI_ParseFile(Path(playerid),"loadaccount_%s", .bExtra = true, .extra = playerid);
  102. SPD(playerid,D_LOGIN,DSI,"Login","Welcome back. This account is registered. \nInsert your password to login to your account","Login","Exit");
  103. }
  104. else
  105. {
  106. SPD(playerid,D_REGISTER,DSI,"Register","Welcome! This account is not registered.\nEnter your own password to create a new account.","Register","Exit");
  107. return 1;
  108. }
  109. return 1;
  110. }
  111.  
  112. public OnPlayerDisconnect(playerid, reason)
  113. {
  114. new INI:file = INI_Open(F_PLAYERS(playerid));
  115. INI_SetTag(file,"Player's Data");
  116. INI_WriteInt(file,"Email",pInfo[playerid][Email]);
  117. INI_WriteInt(file,"Country",pInfo[playerid][Country]);
  118. INI_WriteInt(file,"Sex",pInfo[playerid][Sex]);
  119. INI_WriteInt(file,"Age",pInfo[playerid][Age]);
  120. INI_Close(file);
  121. return 1;
  122. }
  123.  
  124. public OnPlayerSpawn(playerid)
  125. {
  126. return 1;
  127. }
  128.  
  129. public OnPlayerDeath(playerid, killerid, reason)
  130. {
  131. return 1;
  132. }
  133.  
  134. public OnVehicleSpawn(vehicleid)
  135. {
  136. return 1;
  137. }
  138.  
  139. public OnVehicleDeath(vehicleid, killerid)
  140. {
  141. return 1;
  142. }
  143.  
  144. public OnPlayerText(playerid, text[])
  145. {
  146. return 1;
  147. }
  148.  
  149. public OnPlayerCommandText(playerid, cmdtext[])
  150. {
  151. if (strcmp("/mycommand", cmdtext, true, 10) == 0)
  152. {
  153. // Do something here
  154. return 1;
  155. }
  156. return 0;
  157. }
  158.  
  159. public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
  160. {
  161. return 1;
  162. }
  163.  
  164. public OnPlayerExitVehicle(playerid, vehicleid)
  165. {
  166. return 1;
  167. }
  168.  
  169. public OnPlayerStateChange(playerid, newstate, oldstate)
  170. {
  171. return 1;
  172. }
  173.  
  174. public OnPlayerEnterCheckpoint(playerid)
  175. {
  176. return 1;
  177. }
  178.  
  179. public OnPlayerLeaveCheckpoint(playerid)
  180. {
  181. return 1;
  182. }
  183.  
  184. public OnPlayerEnterRaceCheckpoint(playerid)
  185. {
  186. return 1;
  187. }
  188.  
  189. public OnPlayerLeaveRaceCheckpoint(playerid)
  190. {
  191. return 1;
  192. }
  193.  
  194. public OnRconCommand(cmd[])
  195. {
  196. return 1;
  197. }
  198.  
  199. public OnPlayerRequestSpawn(playerid)
  200. {
  201. return 1;
  202. }
  203.  
  204. public OnObjectMoved(objectid)
  205. {
  206. return 1;
  207. }
  208.  
  209. public OnPlayerObjectMoved(playerid, objectid)
  210. {
  211. return 1;
  212. }
  213.  
  214. public OnPlayerPickUpPickup(playerid, pickupid)
  215. {
  216. return 1;
  217. }
  218.  
  219. public OnVehicleMod(playerid, vehicleid, componentid)
  220. {
  221. return 1;
  222. }
  223.  
  224. public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
  225. {
  226. return 1;
  227. }
  228.  
  229. public OnVehicleRespray(playerid, vehicleid, color1, color2)
  230. {
  231. return 1;
  232. }
  233.  
  234. public OnPlayerSelectedMenuRow(playerid, row)
  235. {
  236. return 1;
  237. }
  238.  
  239. public OnPlayerExitedMenu(playerid)
  240. {
  241. return 1;
  242. }
  243.  
  244. public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
  245. {
  246. return 1;
  247. }
  248.  
  249. public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
  250. {
  251. return 1;
  252. }
  253.  
  254. public OnRconLoginAttempt(ip[], password[], success)
  255. {
  256. return 1;
  257. }
  258.  
  259. public OnPlayerUpdate(playerid)
  260. {
  261. return 1;
  262. }
  263.  
  264. public OnPlayerStreamIn(playerid, forplayerid)
  265. {
  266. return 1;
  267. }
  268.  
  269. public OnPlayerStreamOut(playerid, forplayerid)
  270. {
  271. return 1;
  272. }
  273.  
  274. public OnVehicleStreamIn(vehicleid, forplayerid)
  275. {
  276. return 1;
  277. }
  278.  
  279. public OnVehicleStreamOut(vehicleid, forplayerid)
  280. {
  281. return 1;
  282. }
  283.  
  284. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  285. {
  286. if(dialogid == D_REGISTER)
  287. {
  288. if(!response) return Kick(playerid);
  289. if(response)
  290. {
  291. if(!strlen(inputtext))
  292. {
  293. SPD(playerid,D_REGISTER,DSI,"Register","Welcome! This account is not registered.\nEnter your own password to create a new account.\nPlease enter the password!","Next","Exit");
  294. SPD(playerid,D_EMAIL,DSI,"Register","Welcome! This ssd is not registered.\nEnter your own password to create a new account.\nPlease enter the password!","Next","Exit");
  295. SPD(playerid,D_COUNTRY,DSI,"Register","Welcome! This account is not registered.\nEnter your own password to create a new account.\nPlease enter the password!","Next","Exit");
  296. SPD(playerid,D_SEX,DSI,"Register","Welcome! This account is not registered.\nEnter your own password to create a new account.\nPlease enter the password!","Next","Exit");
  297. SPD(playerid,D_AGE,DSI,"Register","Welcome! This account is not registered.\nEnter your own password to create a new account.\nPlease enter the password!","Next","Exit");
  298. return 1;
  299. }
  300.  
  301. new hashpass[129];
  302. WP_Hash(hashpass,sizeof(hashpass),inputtext);
  303. new INI:file = INI_Open(F_PLAYERS(playerid));
  304. INI_SetTag(file,"Player's Data");
  305. INI_WriteString(file,"Password",hashpass);
  306. INI_WriteInt(file,"Email",0);
  307. INI_WriteInt(file,"Country",0);
  308. INI_WriteInt(file,"Sex",0);
  309. INI_WriteInt(file,"Age",0);
  310. INI_Close(file);
  311. SCM(playerid,-1,"You have been successfully registered");
  312. return 1;
  313. }
  314. }
  315. if(dialogid == D_LOGIN)
  316. {
  317. if(!response) return Kick(playerid);
  318. if(response)
  319. {
  320. new hashpass[129];
  321. WP_Hash(hashpass,sizeof(hashpass),inputtext);
  322. if(!strcmp(hashpass, pInfo[playerid][Pass], false))
  323. {
  324. INI_ParseFile(F_PLAYERS(playerid),"loadaccount_%s",.bExtra = true, .extra = playerid);
  325. SetPlayerScore(playerid,pInfo[playerid][Scores]);
  326. GivePlayerMoney(playerid,pInfo[playerid][Money]);
  327. SCM(playerid,-1,"Welcome back! You have successfully logged in");
  328. }
  329. else
  330. {
  331. SPD(playerid,D_LOGIN,DSI,"Login","Welcome back. This account is registered. \nInsert your password to login to your account.\nIncorrect password!","Login","Quit");//We will tell to them that they've entered an incorrect password
  332. return 1;
  333. }
  334. }
  335. }
  336. return 1;
  337. }
  338.  
  339. public OnPlayerClickPlayer(playerid, clickedplayerid, source)
  340. {
  341. return 1;
  342. }
Add Comment
Please, Sign In to add comment