Advertisement
Guest User

Untitled

a guest
Jan 31st, 2016
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.62 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 <Dini>
  7. #include <dutils>
  8.  
  9. #define LIGHTBLUE "{00CED1}"
  10. #define ALB "{ffffff}"
  11. #define RED "{F81414}"
  12. #define GREEN "{00FF22}"
  13. #define COLOR_GREY 0xAFAFAFAA
  14.  
  15. #pragma unused ret_memcpy
  16. #pragma unused strtok
  17.  
  18. forward OnPlayerLogin(playerid,password[]);
  19. forward OnPlayerUpdate(playerid);
  20. forward OnPlayerRegister(playerid, password[]);
  21.  
  22.  
  23.  
  24. enum pInfo
  25. {
  26. pPass,
  27. pAdmin,
  28. pVip,
  29. pLevel,
  30. pCash,
  31. pKills,
  32. pDeaths,
  33. pLottoNr
  34. };
  35.  
  36. new PlayerInfo[MAX_PLAYERS][pInfo];
  37.  
  38. new gPlayerLogged[MAX_PLAYERS];
  39. new gPlayerLogTries[MAX_PLAYERS];
  40. new gPlayerAccount[MAX_PLAYERS];
  41. new Typed[MAX_PLAYERS][64];
  42.  
  43.  
  44. main()
  45. {
  46. print("\n----------------------------------");
  47. print(" Blank Gamemode by your name here");
  48. print("----------------------------------\n");
  49. }
  50.  
  51.  
  52.  
  53. public OnGameModeInit()
  54. {
  55. return 1;
  56. }
  57.  
  58. public OnGameModeExit()
  59. {
  60. return 1;
  61. }
  62.  
  63. public OnPlayerRequestClass(playerid, classid)
  64. {
  65. ShowPlayerDialog(playerid,1234, DIALOG_STYLE_MSGBOX,""GREEN"Reguli",""ALB"Nu folosi un limbaj vulgar!\n"ALB"Nu face reclama altor servere\n"ALB"Nu iti da id-ul pe chat","Accept","Refuz");
  66. SetPlayerCameraPos(playerid, 1890.1014,-1194.7969,25.8091);
  67. SetPlayerCameraLookAt(playerid, 1933.4393,-1196.2479,18.8163);
  68. return 1;
  69. }
  70.  
  71.  
  72.  
  73. public OnPlayerConnect(playerid)
  74. {
  75. new string[128];
  76. new plname[MAX_PLAYER_NAME];
  77. GetPlayerName(playerid, plname, sizeof(plname));
  78. PlayerInfo[playerid][pAdmin] = 0;
  79. PlayerInfo[playerid][pVip] = 0;
  80. PlayerInfo[playerid][pLevel] = 0;
  81. PlayerInfo[playerid][pCash] = 0;
  82. PlayerInfo[playerid][pKills] = 0;
  83. PlayerInfo[playerid][pDeaths] = 0;
  84. PlayerInfo[playerid][pLottoNr] = 0;
  85. format(string, sizeof(string), "Users/%s.ini", plname);
  86. if(dini_Exists(string))
  87. {
  88. gPlayerAccount[playerid] = 1;
  89. }
  90. else
  91. {
  92. gPlayerAccount[playerid] = 0;
  93. }
  94. return 1;
  95. }
  96.  
  97. public OnPlayerDisconnect(playerid, reason)
  98. {
  99. return 1;
  100. }
  101.  
  102.  
  103. public OnPlayerRegister(playerid, password[])
  104. {
  105. if(IsPlayerConnected(playerid))
  106. {
  107. new file[64];
  108. new playername3[MAX_PLAYER_NAME];
  109. GetPlayerName(playerid, playername3, sizeof(playername3));
  110. format(file, sizeof(file), "Users/%s.ini", playername3);
  111.  
  112. if(dini_Exists(file))
  113. {
  114. return SendClientMessage(playerid,COLOR_GREY,"This account is already registered.");
  115. }
  116. else
  117. {
  118. dini_Create(file);
  119. new password2 = num_hash(password);
  120. PlayerInfo[playerid][pPass] = password2;
  121. dini_IntSet(file, "Password",password2);
  122. dini_IntSet(file, "AdminLevel",PlayerInfo[playerid][pAdmin]);
  123. dini_IntSet(file, "VipLevel",PlayerInfo[playerid][pVip]);
  124. dini_IntSet(file, "Level",PlayerInfo[playerid][pLevel]);
  125. dini_IntSet(file, "Cash",PlayerInfo[playerid][pCash]);
  126. dini_IntSet(file, "Kills",PlayerInfo[playerid][pKills]);
  127. dini_IntSet(file, "Deaths",PlayerInfo[playerid][pDeaths]);
  128. dini_IntSet(file, "LottoNr",PlayerInfo[playerid][pLottoNr]);
  129. ShowPlayerDialog(playerid, 1245, DIALOG_STYLE_INPUT,""ALB"Bun Venit",""ALB"Cont inregistrat cu succes!\n"ALB"Scrie parola ta mai jos pentru a te loga","Log-in","Quit");
  130. }
  131. }
  132. return 1;
  133. }
  134.  
  135. public OnPlayerLogin(playerid,password[])
  136. {
  137. new string2[64];
  138. new playername3[MAX_PLAYER_NAME];
  139. GetPlayerName(playerid, playername3, sizeof(playername3));
  140.  
  141. format(string2, sizeof(string2), "Users/%s.ini", playername3);
  142.  
  143. if (dini_Exists(string2))
  144. {
  145. new password2 = num_hash(password);
  146. if(dini_Int(string2,"Password") == password2)
  147. {
  148. PlayerInfo[playerid][pPass] = dini_Int(string2,"Password");
  149. PlayerInfo[playerid][pAdmin] = dini_Int(string2,"AdminLevel");
  150. PlayerInfo[playerid][pVip] = dini_Int(string2,"VipLevel");
  151. PlayerInfo[playerid][pLevel] = dini_Int(string2,"Level");
  152. PlayerInfo[playerid][pCash] = dini_Int(string2,"Cash");
  153. PlayerInfo[playerid][pKills] = dini_Int(string2,"Kills");
  154. PlayerInfo[playerid][pDeaths] = dini_Int(string2,"Deaths");
  155. PlayerInfo[playerid][pLottoNr] = dini_Int(string2,"LottoNr");
  156. }
  157. else
  158. {
  159. gPlayerLogTries[playerid] += 1;
  160. ShowPlayerDialog(playerid, 1245, DIALOG_STYLE_INPUT,""ALB"Mai incearca!",""ALB"Ai introdus o parola gresita\n"ALB"Scrie-ti parola pentru a te loga!","Log-in","Quit");
  161. if(gPlayerLogTries[playerid] == 3) { Kick(playerid); }
  162. return 1;
  163. }
  164. }
  165. return 1;
  166. }
  167.  
  168. public OnPlayerSpawn(playerid)
  169. {
  170. return 1;
  171. }
  172.  
  173. public OnPlayerDeath(playerid, killerid, reason)
  174. {
  175. return 1;
  176. }
  177.  
  178. public OnVehicleSpawn(vehicleid)
  179. {
  180. return 1;
  181. }
  182.  
  183. public OnVehicleDeath(vehicleid, killerid)
  184. {
  185. return 1;
  186. }
  187.  
  188. public OnPlayerText(playerid, text[])
  189. {
  190. return 1;
  191. }
  192.  
  193. public OnPlayerCommandText(playerid, cmdtext[])
  194. {
  195. if (strcmp("/mycommand", cmdtext, true, 10) == 0)
  196. {
  197. // Do something here
  198. return 1;
  199. }
  200. return 0;
  201. }
  202.  
  203. public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
  204. {
  205. return 1;
  206. }
  207.  
  208. public OnPlayerExitVehicle(playerid, vehicleid)
  209. {
  210. return 1;
  211. }
  212.  
  213. public OnPlayerStateChange(playerid, newstate, oldstate)
  214. {
  215. return 1;
  216. }
  217.  
  218. public OnPlayerEnterCheckpoint(playerid)
  219. {
  220. return 1;
  221. }
  222.  
  223. public OnPlayerLeaveCheckpoint(playerid)
  224. {
  225. return 1;
  226. }
  227.  
  228. public OnPlayerEnterRaceCheckpoint(playerid)
  229. {
  230. return 1;
  231. }
  232.  
  233. public OnPlayerLeaveRaceCheckpoint(playerid)
  234. {
  235. return 1;
  236. }
  237.  
  238. public OnRconCommand(cmd[])
  239. {
  240. return 1;
  241. }
  242.  
  243. public OnPlayerRequestSpawn(playerid)
  244. {
  245. return 1;
  246. }
  247.  
  248. public OnObjectMoved(objectid)
  249. {
  250. return 1;
  251. }
  252.  
  253. public OnPlayerObjectMoved(playerid, objectid)
  254. {
  255. return 1;
  256. }
  257.  
  258. public OnPlayerPickUpPickup(playerid, pickupid)
  259. {
  260. return 1;
  261. }
  262.  
  263. public OnVehicleMod(playerid, vehicleid, componentid)
  264. {
  265. return 1;
  266. }
  267.  
  268. public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
  269. {
  270. return 1;
  271. }
  272.  
  273. public OnVehicleRespray(playerid, vehicleid, color1, color2)
  274. {
  275. return 1;
  276. }
  277.  
  278. public OnPlayerSelectedMenuRow(playerid, row)
  279. {
  280. return 1;
  281. }
  282.  
  283. public OnPlayerExitedMenu(playerid)
  284. {
  285. return 1;
  286. }
  287.  
  288. public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
  289. {
  290. return 1;
  291. }
  292.  
  293. public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
  294. {
  295. return 1;
  296. }
  297.  
  298. public OnRconLoginAttempt(ip[], password[], success)
  299. {
  300. return 1;
  301. }
  302. public OnPlayerUpdate(playerid)
  303. {
  304. if(IsPlayerConnected(playerid))
  305. {
  306. if(gPlayerLogged[playerid] == 1)
  307. {
  308. new string3[64];
  309. new playername3[MAX_PLAYER_NAME];
  310. GetPlayerName(playerid, playername3, sizeof(playername3));
  311. format(string3, sizeof(string3), "Users/%s.ini", playername3);
  312.  
  313. dini_IntSet(string3, "Password",PlayerInfo[playerid][pPass]);
  314. dini_IntSet(string3, "AdminLevel",PlayerInfo[playerid][pAdmin]);
  315. dini_IntSet(string3, "VipLevel",PlayerInfo[playerid][pVip]);
  316. dini_IntSet(string3, "Level",PlayerInfo[playerid][pLevel]);
  317. dini_IntSet(string3, "Cash",PlayerInfo[playerid][pCash]);
  318. dini_IntSet(string3, "Kills",PlayerInfo[playerid][pKills]);
  319. dini_IntSet(string3, "Deaths",PlayerInfo[playerid][pDeaths]);
  320. dini_IntSet(string3, "LottoNr",PlayerInfo[playerid][pLottoNr]);
  321. }
  322. }
  323. return 1;
  324. }
  325.  
  326. public OnPlayerStreamIn(playerid, forplayerid)
  327. {
  328. return 1;
  329. }
  330.  
  331. public OnPlayerStreamOut(playerid, forplayerid)
  332. {
  333. return 1;
  334. }
  335.  
  336. public OnVehicleStreamIn(vehicleid, forplayerid)
  337. {
  338. return 1;
  339. }
  340.  
  341. public OnVehicleStreamOut(vehicleid, forplayerid)
  342. {
  343. return 1;
  344. }
  345.  
  346. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  347. {
  348. if(dialogid == 1234)
  349. {
  350. if(response)
  351. {
  352. new playername[MAX_PLAYER_NAME];
  353. GetPlayerName(playerid, playername, sizeof(playername));
  354. new string[64];
  355. format(string, sizeof(string), "Users/%s.ini", playername);
  356. if (dini_Exists(string))
  357. {
  358. ShowPlayerDialog(playerid, 1245, DIALOG_STYLE_INPUT,""ALB"Bun venit. Te rugam sa te loghezi.",""ALB"Scrie parola ta aici pentru a te loga","Log-in","Quit");
  359. }
  360. else
  361. {
  362. ShowPlayerDialog(playerid, 1246, DIALOG_STYLE_INPUT,""ALB"Te rugam sa te inregistrezi!",""ALB"Scrie parola ta aici pentru a te inregistra.","Register","Quit");
  363. }
  364. }
  365. else
  366. {
  367. SendClientMessage(playerid, COLOR_GREY,"*Ai refuzat. Trebuie sa accepti regulile pentru a juca");
  368. Kick(playerid);
  369. }
  370. }
  371. if(dialogid == 1245)
  372. {
  373. if(response)
  374. {
  375. strmid(Typed[playerid], inputtext, 0, strlen(inputtext), 255);
  376. if(!strcmp(Typed[playerid], "None", true))
  377. {
  378. ShowPlayerDialog(playerid, 1245, DIALOG_STYLE_INPUT,""ALB"Incerca din nou.",""ALB"Nu ai introdus o parola!\n"ALB"Scrie-ti parola mai jos pentru a te inregistra","Log-in","Quit");
  379. }
  380. else
  381. {
  382. OnPlayerLogin(playerid, inputtext);
  383. }
  384. }
  385. else
  386. {
  387. Kick(playerid);
  388. }
  389. }
  390. if(dialogid == 1246)
  391. {
  392. if(response == 1)
  393. {
  394. new sendername[MAX_PLAYER_NAME];
  395. GetPlayerName(playerid, sendername, sizeof(sendername));
  396. new string[512];
  397. format(string, sizeof(string),""ALB"Nume: "LIGHTBLUE"%s\n"ALB"Parola: "LIGHTBLUE"%s,\n"ALB"Bani: "LIGHTBLUE"10000\n"ALB"Scor: "LIGHTBLUE"1",sendername,inputtext);
  398. ShowPlayerDialog(playerid, 1242, DIALOG_STYLE_MSGBOX, ""LIGHTBLUE"Te-ai inregistrat cu succes",string,"Ok","");
  399. GivePlayerMoney(playerid, 10000);
  400. SetPlayerScore(playerid, 1);
  401. OnPlayerRegister(playerid, inputtext);
  402. }
  403. else
  404. {
  405. Kick(playerid);
  406. }
  407. }
  408. return 1;
  409. }
  410.  
  411. public OnPlayerClickPlayer(playerid, clickedplayerid, source)
  412. {
  413. return 1;
  414. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement