Advertisement
Guest User

Untitled

a guest
Oct 28th, 2016
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.19 KB | None | 0 0
  1. #include <a_samp>
  2. #include <dini>
  3.  
  4. #define DIALOG_REGISTER 0
  5. #define DIALOG_REGISTERED 1
  6. #define DIALOG_LOGIN 2
  7. #define DIALOG_LOGGED 3
  8.  
  9. #define USER_FILE "Users/%s.ini"
  10.  
  11. new PlayerLogged[MAX_PLAYERS];
  12.  
  13. enum pInfo
  14. {
  15. pVisits,
  16. pKills,
  17. pDeaths
  18. }
  19. new PlayerInfo[MAX_PLAYERS][pInfo];
  20.  
  21. #if defined FILTERSCRIPT
  22.  
  23. public OnFilterScriptInit()
  24. {
  25. print("\n--------------------------------------");
  26. print(" Blank Filterscript by your name here");
  27. print("--------------------------------------\n");
  28. return 1;
  29. }
  30.  
  31. public OnFilterScriptExit()
  32. {
  33. return 1;
  34. }
  35.  
  36. #else
  37.  
  38. main()
  39. {
  40. print("\n----------------------------------");
  41. print(" Blank Gamemode by your name here");
  42. print("----------------------------------\n");
  43. }
  44.  
  45. #endif
  46.  
  47. public OnGameModeInit()
  48. {
  49. // Don't use these lines if it's a filterscript
  50. SetGameModeText("Blank Script");
  51. AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
  52. return 1;
  53. }
  54.  
  55. public OnGameModeExit()
  56. {
  57. return 1;
  58. }
  59.  
  60. public OnPlayerRequestClass(playerid, classid)
  61. {
  62. SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
  63. SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
  64. SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
  65. return 1;
  66. }
  67.  
  68. public OnPlayerConnect(playerid)
  69. {
  70. PlayerLogged[playerid] = 0;
  71.  
  72. new IP[16]; GetPlayerIp(playerid, IP, 16);
  73. new name[MAX_PLAYER_NAME], file[256], str[500];
  74. GetPlayerName(playerid, name, sizeof(name));
  75. format(file, sizeof(file), USER_FILE, name);
  76. if (!dini_Exists(file))
  77. {
  78. format(str, sizeof(str),"Konto {66FF00}%s {FFFFFF}nie jest zarejestrowane.\nWpisz poniżej hasło, aby się zarejestrować.", name);
  79. ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD, "Rejestracja", str, "Zarejestruj", "Anuluj");
  80. }
  81. if(fexist(file))
  82. {
  83. format(str, sizeof(str),"Konto {66FF00}%s {FFFFFF}jest już zarejestrowane.\nWpisz poniżej hasło, aby się zalogować.", name);
  84. ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "Logowanie", str, "Zaloguj", "Anuluj");
  85. }
  86. return 1;
  87. }
  88.  
  89. public OnPlayerDisconnect(playerid, reason)
  90. {
  91. return 1;
  92. }
  93.  
  94. public OnPlayerSpawn(playerid)
  95. {
  96. return 1;
  97. }
  98.  
  99. public OnPlayerDeath(playerid, killerid, reason)
  100. {
  101. return 1;
  102. }
  103.  
  104. public OnVehicleSpawn(vehicleid)
  105. {
  106. return 1;
  107. }
  108.  
  109. public OnVehicleDeath(vehicleid, killerid)
  110. {
  111. return 1;
  112. }
  113.  
  114. public OnPlayerText(playerid, text[])
  115. {
  116. return 1;
  117. }
  118.  
  119. public OnPlayerCommandText(playerid, cmdtext[])
  120. {
  121. if (strcmp("/mycommand", cmdtext, true, 10) == 0)
  122. {
  123. // Do something here
  124. return 1;
  125. }
  126. return 0;
  127. }
  128.  
  129. public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
  130. {
  131. return 1;
  132. }
  133.  
  134. public OnPlayerExitVehicle(playerid, vehicleid)
  135. {
  136. return 1;
  137. }
  138.  
  139. public OnPlayerStateChange(playerid, newstate, oldstate)
  140. {
  141. return 1;
  142. }
  143.  
  144. public OnPlayerEnterCheckpoint(playerid)
  145. {
  146. return 1;
  147. }
  148.  
  149. public OnPlayerLeaveCheckpoint(playerid)
  150. {
  151. return 1;
  152. }
  153.  
  154. public OnPlayerEnterRaceCheckpoint(playerid)
  155. {
  156. return 1;
  157. }
  158.  
  159. public OnPlayerLeaveRaceCheckpoint(playerid)
  160. {
  161. return 1;
  162. }
  163.  
  164. public OnRconCommand(cmd[])
  165. {
  166. return 1;
  167. }
  168.  
  169. public OnPlayerRequestSpawn(playerid)
  170. {
  171. return 1;
  172. }
  173.  
  174. public OnObjectMoved(objectid)
  175. {
  176. return 1;
  177. }
  178.  
  179. public OnPlayerObjectMoved(playerid, objectid)
  180. {
  181. return 1;
  182. }
  183.  
  184. public OnPlayerPickUpPickup(playerid, pickupid)
  185. {
  186. return 1;
  187. }
  188.  
  189. public OnVehicleMod(playerid, vehicleid, componentid)
  190. {
  191. return 1;
  192. }
  193.  
  194. public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
  195. {
  196. return 1;
  197. }
  198.  
  199. public OnVehicleRespray(playerid, vehicleid, color1, color2)
  200. {
  201. return 1;
  202. }
  203.  
  204. public OnPlayerSelectedMenuRow(playerid, row)
  205. {
  206. return 1;
  207. }
  208.  
  209. public OnPlayerExitedMenu(playerid)
  210. {
  211. return 1;
  212. }
  213.  
  214. public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
  215. {
  216. return 1;
  217. }
  218.  
  219. public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
  220. {
  221. return 1;
  222. }
  223.  
  224. public OnRconLoginAttempt(ip[], password[], success)
  225. {
  226. return 1;
  227. }
  228.  
  229. public OnPlayerUpdate(playerid)
  230. {
  231. return 1;
  232. }
  233.  
  234. public OnPlayerStreamIn(playerid, forplayerid)
  235. {
  236. return 1;
  237. }
  238.  
  239. public OnPlayerStreamOut(playerid, forplayerid)
  240. {
  241. return 1;
  242. }
  243.  
  244. public OnVehicleStreamIn(vehicleid, forplayerid)
  245. {
  246. return 1;
  247. }
  248.  
  249. public OnVehicleStreamOut(vehicleid, forplayerid)
  250. {
  251. return 1;
  252. }
  253.  
  254. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  255. {
  256. if(dialogid == DIALOG_REGISTER)
  257. {
  258. new IP[16]; GetPlayerIp(playerid, IP, 16);
  259. new name[MAX_PLAYER_NAME], file[256], string[1900];
  260. GetPlayerName(playerid, name, sizeof(name));
  261. format(file, sizeof(file), USER_FILE, name);
  262. if(!response) return Kick(playerid);
  263. if (!strlen(inputtext)) return
  264. format(string, sizeof(string),"Konto {66FF00}%s {FFFFFF}nie jest zarejestrowane.\nWpisz poniżej hasło, aby się zarejestrować.", name);
  265. ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD, "Rejestracja", string, "Zarejestruj", "Anuluj");
  266. dini_Create(file);
  267. dini_Set(file, "Name", name);
  268. dini_Set(file, "Password", inputtext);
  269. dini_Set(file, "IP", IP);
  270. dini_IntSet(file, "Visits", PlayerInfo[playerid][pVisits] = 1);
  271. dini_IntSet(file, "Money", GivePlayerMoney(playerid, 1));
  272. dini_IntSet(file, "Score", SetPlayerScore(playerid, 1));
  273. dini_IntSet(file, "Kills", PlayerInfo[playerid][pKills] = 0);
  274. dini_IntSet(file, "Deaths", PlayerInfo[playerid][pDeaths] = 0);
  275. format(string, sizeof(string),"Witaj %s twoje konto zostało zarejestrowane, a hasło do niego to %s\nZapaniętaj powyższe dane ponieważ będą potrzebne ci do zalogowania się.\n", name, inputtext);
  276. strcat(string, "\n");
  277. strcat(string, "{66FF00}Zakładając konto na serwerze automatycznie akceptujesz regulamin serwera oraz zobowiązujesz się do jego przestrzegania.\n");
  278. strcat(string, "\n");
  279. strcat(string, "{FF0000}1. {FFFFFF}Zakaz reklamowania stron oraz podawnia IP innych serwerów.\n");
  280. strcat(string, "{FF0000}2. {FFFFFF}Zakaz używania wszelkiego rodzaju modyfikacji oraz oprogramowań ułatwiających grę.\n");
  281. strcat(string, "{FF0000}3. {FFFFFF}Zakaz wykorzystywania błędów SA-MP oraz serwera na swoją korzyść i rozpowszechniania bez zgłoszenia administracji o błędzie.\n");
  282. strcat(string, "{FF0000}4. {FFFFFF}Zakaz tworzenia MultiKont.\n");
  283. strcat(string, "{FF0000}5. {FFFFFF}Zakaz ubliżania innym graczom.\n");
  284. strcat(string, "{FF0000}6. {FFFFFF}Zakaz spamowania na czacie.\n");
  285. strcat(string, "{FF0000}7. {FFFFFF}Zakaz nadmiernego używania wulgaryzmów.\n");
  286. strcat(string, "{FF0000}8. {FFFFFF}Zakaz stosowania gróźb wobec graczy jak i szantażu.\n");
  287. ShowPlayerDialog(playerid, DIALOG_REGISTERED, DIALOG_STYLE_MSGBOX, "Zarejestrowany", string, "Rozumiem", "");
  288. PlayerLogged[playerid] = 1;
  289. }
  290.  
  291. if(dialogid == DIALOG_LOGIN)
  292. {
  293. new name[MAX_PLAYER_NAME], file[256], string[500];
  294. GetPlayerName(playerid, name, sizeof(name));
  295. format(file, sizeof(file), USER_FILE, name);
  296. if(!response) return Kick(playerid);
  297. format(string, sizeof(string),"Konto %s jest już zarejestrowane.\nWpisz poniżej hasło, aby się zalogować.", name);
  298. if (!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "Logowanie", string, "Zaloguj", "Anuluj");
  299. if(strcmp(inputtext, dini_Get(file, "Password"), false))
  300. {
  301. Kick(playerid);
  302. }
  303. else
  304. {
  305. PlayerLogged[playerid] = 1;
  306. PlayerInfo[playerid][pVisits] = dini_Int(file, "Visits");
  307. GivePlayerMoney(playerid, dini_Int(file, "Money"));
  308. SetPlayerScore(playerid, dini_Int(file, "Score"));
  309. PlayerInfo[playerid][pKills] = dini_Int(file, "Kills");
  310. PlayerInfo[playerid][pDeaths] = dini_Int(file, "Deaths");
  311. PlayerInfo[playerid][pVisits] += 1;
  312. format(string, sizeof(string),"Witaj %s zostałeś zalogowany. Życzymy miłej gry!", name);
  313. ShowPlayerDialog(playerid, DIALOG_LOGGED, DIALOG_STYLE_MSGBOX, "Zalogowany", string, "Zamknij", "");
  314. }
  315. }
  316. return 1;
  317. }
  318.  
  319. public OnPlayerClickPlayer(playerid, clickedplayerid, source)
  320. {
  321. return 1;
  322. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement