Guest User

Mod 0d o

a guest
Feb 2nd, 2015
310
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.82 KB | None | 0 0
  1. //============================================================================//
  2. //============================================================================//
  3. //============================================================================//
  4. //============================================================================//
  5. // MOJ PRVI GAMEMOD OD 0 //
  6. // SKRIPTER : NENAC //
  7. // MAPER : NEDAC //
  8. // ZASLUGE : BS-FORUM //
  9. // ZBSAMP-FORMU //
  10. //============================================================================//
  11. //============================================================================//
  12. //============================================================================//
  13. //============================================================================//
  14.  
  15.  
  16. #include <a_samp>
  17. #include <YSI\y_ini>
  18. #include <YSI\y_commands>
  19. #include <sscanf2>
  20. #include <streamer>
  21. #include <foreach>
  22.  
  23.  
  24. #undef MAX_PLAYERS
  25. #define MAX_PLAYERS 50
  26. #define MAX_ORGANIZACIJA 7
  27.  
  28.  
  29. #define SACUVAJ_IGRACA "Igraci/%s.ini"
  30.  
  31.  
  32. #define DIALOG_PRIJAVA 1
  33. #define DIALOG_REGISTRACIJA 2
  34. #define DIALOG_SPOL 3
  35. #define DIALOG_GODINE 4
  36. #define DIALOG_EMAIL 5
  37. #define DIALOG_DRZAVA 6
  38.  
  39.  
  40. #define IMESERVERA "4-GAME ROLEPLAY"
  41. #define VERZIJAMODA "Beta"
  42. #define MAPASERVERA "Los Santos"
  43. #define STRANICASERVERA "www.izradi.com"
  44. #define SERVER_SKRACENICA "4-GAME RPG"
  45.  
  46.  
  47. #define SCM SendClientMessage
  48. #define SPD ShowPlayerDialog
  49.  
  50.  
  51.  
  52. new
  53. ServerStartCount;
  54.  
  55.  
  56. //=============================ENUM's===========================================
  57. enum pInfo
  58. {
  59. pPass[100],
  60. pSpol,
  61. pGodine,
  62. pEmail,
  63. pDrzava
  64. };
  65. new PlayerInfo[MAX_PLAYERS][pInfo];
  66.  
  67.  
  68. main()
  69. {
  70. print("\n----------------------------------");
  71. print(" "IMESERVERA"");
  72. printf("Server je ucitan za %dms", GetTickCount()-ServerStartCount);
  73. print("----------------------------------\n");
  74. }
  75.  
  76. public OnGameModeInit()
  77. {
  78. ServerStartCount = GetTickCount();
  79. SetGameModeText(VERZIJAMODA);
  80. SendRconCommand("mapname "MAPASERVERA"");
  81. SendRconCommand("hostname "IMESERVERA"");
  82. SendRconCommand("weburl "STRANICASERVERA"");
  83. AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
  84. return 1;
  85. }
  86.  
  87. public OnGameModeExit()
  88. {
  89. return 1;
  90. }
  91.  
  92. public OnPlayerRequestClass(playerid, classid)
  93. {
  94. SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
  95. SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
  96. SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
  97. return 1;
  98. }
  99.  
  100. public OnPlayerConnect(playerid)
  101. {
  102. if(fexist(UserPath(playerid)))
  103. {
  104. INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
  105. SPD(playerid, DIALOG_PRIJAVA, DIALOG_STYLE_INPUT,"Login","Upisite lozinku za da se logujete.","Login","Nazad");
  106. }
  107. else
  108. {
  109. SPD(playerid, DIALOG_REGISTRACIJA, DIALOG_STYLE_INPUT,"Registracija.","Upisite lozinku da se registrujete.","Register","Quit");
  110. }
  111. return 1;
  112. }
  113.  
  114. public OnPlayerDisconnect(playerid, reason)
  115. {
  116. new INI:File = INI_Open(UserPath(playerid));
  117. INI_SetTag(File,"data");
  118. INI_WriteInt(File,"Spol",PlayerInfo[playerid][pSpol]);
  119. INI_WriteInt(File,"Godine",PlayerInfo[playerid][pGodine]);
  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. return 1;
  152. }
  153.  
  154. public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
  155. {
  156. return 1;
  157. }
  158.  
  159. public OnPlayerExitVehicle(playerid, vehicleid)
  160. {
  161. return 1;
  162. }
  163.  
  164. public OnPlayerStateChange(playerid, newstate, oldstate)
  165. {
  166. return 1;
  167. }
  168.  
  169. public OnPlayerEnterCheckpoint(playerid)
  170. {
  171. return 1;
  172. }
  173.  
  174. public OnPlayerLeaveCheckpoint(playerid)
  175. {
  176. return 1;
  177. }
  178.  
  179. public OnPlayerEnterRaceCheckpoint(playerid)
  180. {
  181. return 1;
  182. }
  183.  
  184. public OnPlayerLeaveRaceCheckpoint(playerid)
  185. {
  186. return 1;
  187. }
  188.  
  189. public OnRconCommand(cmd[])
  190. {
  191. return 1;
  192. }
  193.  
  194. public OnPlayerRequestSpawn(playerid)
  195. {
  196. return 1;
  197. }
  198.  
  199. public OnObjectMoved(objectid)
  200. {
  201. return 1;
  202. }
  203.  
  204. public OnPlayerObjectMoved(playerid, objectid)
  205. {
  206. return 1;
  207. }
  208.  
  209. public OnPlayerPickUpPickup(playerid, pickupid)
  210. {
  211. return 1;
  212. }
  213.  
  214. public OnVehicleMod(playerid, vehicleid, componentid)
  215. {
  216. return 1;
  217. }
  218.  
  219. public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
  220. {
  221. return 1;
  222. }
  223.  
  224. public OnVehicleRespray(playerid, vehicleid, color1, color2)
  225. {
  226. return 1;
  227. }
  228.  
  229. public OnPlayerSelectedMenuRow(playerid, row)
  230. {
  231. return 1;
  232. }
  233.  
  234. public OnPlayerExitedMenu(playerid)
  235. {
  236. return 1;
  237. }
  238.  
  239. public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
  240. {
  241. return 1;
  242. }
  243.  
  244. public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
  245. {
  246. return 1;
  247. }
  248.  
  249. public OnRconLoginAttempt(ip[], password[], success)
  250. {
  251. return 1;
  252. }
  253.  
  254. public OnPlayerUpdate(playerid)
  255. {
  256. return 1;
  257. }
  258.  
  259. public OnPlayerStreamIn(playerid, forplayerid)
  260. {
  261. return 1;
  262. }
  263.  
  264. public OnPlayerStreamOut(playerid, forplayerid)
  265. {
  266. return 1;
  267. }
  268.  
  269. public OnVehicleStreamIn(vehicleid, forplayerid)
  270. {
  271. return 1;
  272. }
  273.  
  274. public OnVehicleStreamOut(vehicleid, forplayerid)
  275. {
  276. return 1;
  277. }
  278.  
  279. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  280. {
  281. if(dialogid == DIALOG_REGISTRACIJA)
  282. {
  283. if (!response) return Kick(playerid);
  284. if(response)
  285. {
  286. if(!strlen(inputtext)) return SPD(playerid, DIALOG_REGISTRACIJA, DIALOG_STYLE_PASSWORD, "Registriranje...","Vnesovte pogresna lozinka.\nVnesete lozinka da se registrirate.","Register","Quit");
  287. new INI:File = INI_Open(UserPath(playerid));
  288. INI_SetTag(File,"data");
  289. INI_WriteString(File,"Password", inputtext);
  290. INI_Close(File);
  291. SPD(playerid, DIALOG_SPOL, DIALOG_STYLE_MSGBOX,"Informacije","Koji ste spol?.","Musko","Zensko");
  292.  
  293. }
  294. }
  295. if(dialogid == DIALOG_PRIJAVA)
  296. {
  297. if(!response) return Kick(playerid);
  298. if(response)
  299. {
  300. if(!strcmp(inputtext, PlayerInfo[playerid][pPass], false))
  301. {
  302. INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
  303. SpawnPlayer(playerid);
  304. }
  305. else
  306. {
  307. SPD(playerid, DIALOG_PRIJAVA, DIALOG_STYLE_PASSWORD,"Login","Unesena lozinka netacna.\nUnesite tacnu za logiranje.","Login","Quit");
  308.  
  309. }
  310. }
  311. }
  312. if(dialogid == DIALOG_SPOL)
  313. {
  314. if(!response)
  315. {
  316. PlayerInfo[playerid][pSpol] = 2;
  317. new INI:File = INI_Open(UserPath(playerid));
  318. INI_SetTag(File,"data");
  319. INI_WriteInt(File,"Spol", 2);
  320. INI_Close(File);
  321. SPD(playerid, DIALOG_GODINE, DIALOG_STYLE_INPUT, "Godine", "Koliko imate godina??", "Dalje", "Izlaz");
  322. }
  323. if(response)
  324. {
  325. PlayerInfo[playerid][pSpol] = 1;
  326. new INI:File = INI_Open(UserPath(playerid));
  327. INI_SetTag(File,"data");
  328. INI_WriteInt(File,"Spol", 1);
  329. INI_Close(File);
  330. SPD(playerid, DIALOG_GODINE, DIALOG_STYLE_INPUT, "Godine", "Koliko imate godina??", "Dalje", "Izlaz");
  331. }
  332. }
  333. if(dialogid == DIALOG_GODINE)
  334. {
  335. if(response)
  336. {
  337. new INI:File = INI_Open(UserPath(playerid));
  338. INI_SetTag(File,"data");
  339. INI_WriteString(File, "Godine", inputtext);
  340. INI_Close(File);
  341. // SetSpawnInfo(playerid, 0, 0, 1219.4819,-1813.7813,16.5938,89.5090, 0, 0, 0, 0, 0, 0 );
  342. // SpawnPlayer(playerid);
  343. SPD(playerid, DIALOG_EMAIL, DIALOG_STYLE_INPUT, "Email", "Unesite vašu Email adresu", "Dalje", "Izlaz");
  344. }
  345. if(!response)
  346. {
  347. Kick(playerid);
  348. }
  349. }
  350. if(dialogid == DIALOG_EMAIL)
  351. {
  352. if(response)
  353. {
  354. new INI:File = INI_Open(UserPath(playerid));
  355. INI_SetTag(File,"data");
  356. INI_WriteString(File, "Email", inputtext);
  357. INI_Close(File);
  358. SPD(playerid, DIALOG_DRZAVA, DIALOG_STYLE_INPUT, "Drzava", "Unesite ime državu iz koje dolazite", "Dalje", "Izlaz");
  359. }
  360. if(!response)
  361. {
  362. Kick(playerid);
  363. }
  364. }
  365. if(dialogid == DIALOG_DRZAVA)
  366. {
  367. if(response)
  368. {
  369. new INI:File = INI_Open(UserPath(playerid));
  370. INI_SetTag(File,"data");
  371. INI_WriteString(File, "Drzava", inputtext);
  372. INI_Close(File);
  373. SetSpawnInfo(playerid, 0, 0, 1219.4819,-1813.7813,16.5938,89.5090, 0, 0, 0, 0, 0, 0 );
  374. SpawnPlayer(playerid);
  375. }
  376. if(!response)
  377. {
  378. Kick(playerid);
  379. }
  380. }
  381. return 1;
  382. }
  383.  
  384. public OnPlayerClickPlayer(playerid, clickedplayerid, source)
  385. {
  386. return 1;
  387. }
  388.  
  389.  
  390. stock UserPath(playerid)
  391. {
  392. new string[128], playername[MAX_PLAYER_NAME];
  393. GetPlayerName(playerid, playername, sizeof(playername));
  394. format(string, sizeof(string), SACUVAJ_IGRACA, playername);
  395. return string;
  396. }
  397.  
  398.  
  399. forward LoadUser_data(playerid,name[],value[]);
  400. public LoadUser_data(playerid,name[],value[])
  401. {
  402. INI_String("Password", PlayerInfo[playerid][pPass], 100);
  403. INI_Int("Spol", PlayerInfo[playerid][pSpol]);
  404. INI_Int("Godine", PlayerInfo[playerid][pGodine]);
  405. INI_Int("Email", PlayerInfo[playerid][pEmail]);
  406. INI_Int("Država", PlayerInfo[playerid][pDrzava]);
  407. return 1;
  408. }
Advertisement
Add Comment
Please, Sign In to add comment