Advertisement
Guest User

Untitled

a guest
Mar 14th, 2018
497
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.74 KB | None | 0 0
  1. /*============================================================================\\
  2. //===================Bacado Gaming============================================\\
  3. //===================Mod je radjen od 0=======================================\\
  4. //===================Skripter:PazzOnee========================================\\
  5. //===================Maper:PazzOnee===========================================\\
  6. //============================================================================*/
  7. #pragma tabsize 0
  8.  
  9. #include <a_samp>
  10. #include <YSI\y_ini>
  11. #include <YSI\y_commands>
  12. #include < float >
  13. #include <sscanf2>
  14. #include < streamer >
  15.  
  16. #define DIALOG_REGISTER 1
  17. #define DIALOG_LOGIN 2
  18.  
  19. #undef MAX_PLAYERS
  20. #define MAX_PLAYERS 50
  21. /////////BOJE///////////////////////
  22. #define BELA "{FFFFFF}"
  23. #define ZELENA "{6EF83C}"
  24. #define CRVENA "{F81414}"
  25. #define PLAVA "{2E9CD1}"
  26. #define ORANGE "{FF9500}"
  27. #define ZLATNA "{FFC50A}"
  28. #define SERVER "{AFE7FF}"
  29. #define SZELENA "{C9FFAB}"
  30. #define LJUB "{EE11EE}"
  31. #define SIVA "{C0C0C0}"
  32.  
  33. #define NALOZI "/Nalozi/%s.ini"
  34.  
  35. enum pInfo
  36. {
  37. pLozinka,
  38. pDzepNovac,
  39. pBankaNovac,
  40. pAdmin,
  41. pLevel
  42. }
  43. new PlayerInfo[MAX_PLAYERS][pInfo];
  44. new IgracUlogovan[MAX_PLAYERS];
  45. ///////////////////////////////////////////////////////
  46. forward UcitajKorisnika_data(playerid,name[],value[]);
  47. public UcitajKorisnika_data(playerid,name[],value[])
  48. {
  49. INI_Int("Lozinka",PlayerInfo[playerid][pLozinka]);
  50. INI_Int("DzepNovac",PlayerInfo[playerid][pDzepNovac]);
  51. INI_Int("BankaNovac",PlayerInfo[playerid][pBankaNovac]);
  52. INI_Int("Admin",PlayerInfo[playerid][pAdmin]);
  53. INI_Int("Level",PlayerInfo[playerid][pLevel]);
  54. return 1;
  55. }
  56. stock SacuvajKorisnika(playerid)
  57. {
  58. if(IgracUlogovan[playerid] == 1)
  59. {
  60. new INI:File = INI_Open(Korisnici(playerid));
  61. INI_SetTag(File,"data");
  62. INI_WriteInt(File,"DzepNovac",PlayerInfo[playerid][pDzepNovac]);
  63. INI_WriteInt(File,"BankaNovac",PlayerInfo[playerid][pBankaNovac]);
  64. INI_WriteInt(File,"Admin",PlayerInfo[playerid][pAdmin]);
  65. INI_WriteInt(File,"Level",PlayerInfo[playerid][pLevel]);
  66. INI_Close(File);
  67. }
  68. return 1;
  69. }
  70. stock KorisnickiRacun(playerid)
  71. {
  72. new string[128],playername[MAX_PLAYER_NAME];
  73. GetPlayerName(playerid,playername,sizeof(playername));
  74. format(string,sizeof(string),NALOZI,playername);
  75. return string;
  76. }
  77. stock udb_hash(buf[])
  78. {
  79. new length=strlen(buf);
  80. new s1 = 1;
  81. new s2 = 0;
  82. new n;
  83. for (n=0; n<length; n++)
  84. {
  85. s1 = (s1 + buf[n]) % 65521;
  86. s2 = (s2 + s1) % 65521;
  87. }
  88. return (s2 << 16) + s1;
  89. }
  90.  
  91. main()
  92. {
  93. print("\n----------------------------------");
  94. print(" Bacado Gaming RolePlay v0.1 ");
  95. print("----------------------------------\n");
  96. }
  97.  
  98.  
  99. public OnGameModeInit()
  100. {
  101. SetGameModeText("Bacado Gaming");
  102. AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
  103. return 1;
  104. }
  105.  
  106. public OnGameModeExit()
  107. {
  108. return 1;
  109. }
  110.  
  111. public OnPlayerRequestClass(playerid, classid)
  112. {
  113. return 1;
  114. }
  115.  
  116. public OnPlayerConnect(playerid)
  117. {
  118. IgracUlogovan[playerid] = 0;
  119. /////////////////////////////////////
  120. if(fexist(KorisnickiRacun(playerid)))
  121. {
  122. INI_ParseFile(KorisnickiRacun(playerid),"UcitajKorisnika_%s",.bExtra = true,.extra = playerid);
  123. ShowPlayerDialog(playerid,DIALOG_LOGIN,DIALOG_STYLE_INPUT,"LOGIN:","Unesite vasu lozinku da biste se ulogovali!","Login","Izlaz");
  124. }
  125. else
  126. {
  127. ShowPlayerDialog(playerid,DIALOG_REGISTER,DIALOG_STYLE_INPUT,"Register:",""ZELENA"Vas nalog ne postoji, molimo registrujte se!","Register","Izlaz");
  128. }
  129.  
  130. return 1;
  131. }
  132.  
  133. public OnPlayerDisconnect(playerid, reason)
  134. {
  135. new INI:File = INI_Open(KorisnickiRacun(playerid));
  136. INI_SetTag(File,"data");
  137. INI_WriteInt(File,"DzepNovac",GetPlayerMoney(playerid));
  138. INI_WriteInt(File,"BankaNovac",PlayerInfo[playerid][pBankaNovac]);
  139. INI_WriteInt(File,"Admin",PlayerInfo[playerid][pAdmin]);
  140. INI_WriteInt(File,"Level",PlayerInfo[playerid][pLevel]);
  141. INI_Close(File);
  142. return 1;
  143. }
  144.  
  145. public OnPlayerSpawn(playerid)
  146. {
  147. SetPlayerHealth(playerid, 100);
  148. return 1;
  149. }
  150.  
  151. public OnPlayerDeath(playerid, killerid, reason)
  152. {
  153. return 1;
  154. }
  155.  
  156. public OnVehicleSpawn(vehicleid)
  157. {
  158. return 1;
  159. }
  160.  
  161. public OnVehicleDeath(vehicleid, killerid)
  162. {
  163. return 1;
  164. }
  165.  
  166. public OnPlayerText(playerid, text[])
  167. {
  168. return 1;
  169. }
  170. public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
  171. {
  172. return 1;
  173. }
  174.  
  175. public OnPlayerExitVehicle(playerid, vehicleid)
  176. {
  177. return 1;
  178. }
  179.  
  180. public OnPlayerStateChange(playerid, newstate, oldstate)
  181. {
  182. return 1;
  183. }
  184.  
  185. public OnPlayerEnterCheckpoint(playerid)
  186. {
  187. return 1;
  188. }
  189.  
  190. public OnPlayerLeaveCheckpoint(playerid)
  191. {
  192. return 1;
  193. }
  194.  
  195. public OnPlayerEnterRaceCheckpoint(playerid)
  196. {
  197. return 1;
  198. }
  199.  
  200. public OnPlayerLeaveRaceCheckpoint(playerid)
  201. {
  202. return 1;
  203. }
  204.  
  205. public OnRconCommand(cmd[])
  206. {
  207. return 1;
  208. }
  209.  
  210. public OnPlayerRequestSpawn(playerid)
  211. {
  212. return 1;
  213. }
  214.  
  215. public OnObjectMoved(objectid)
  216. {
  217. return 1;
  218. }
  219.  
  220. public OnPlayerObjectMoved(playerid, objectid)
  221. {
  222. return 1;
  223. }
  224.  
  225. public OnPlayerPickUpPickup(playerid, pickupid)
  226. {
  227. return 1;
  228. }
  229.  
  230. public OnVehicleMod(playerid, vehicleid, componentid)
  231. {
  232. return 1;
  233. }
  234.  
  235. public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
  236. {
  237. return 1;
  238. }
  239.  
  240. public OnVehicleRespray(playerid, vehicleid, color1, color2)
  241. {
  242. return 1;
  243. }
  244.  
  245. public OnPlayerSelectedMenuRow(playerid, row)
  246. {
  247. return 1;
  248. }
  249.  
  250. public OnPlayerExitedMenu(playerid)
  251. {
  252. return 1;
  253. }
  254.  
  255. public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
  256. {
  257. return 1;
  258. }
  259.  
  260. public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
  261. {
  262. return 1;
  263. }
  264.  
  265. public OnRconLoginAttempt(ip[], password[], success)
  266. {
  267. return 1;
  268. }
  269.  
  270. public OnPlayerUpdate(playerid)
  271. {
  272. return 1;
  273. }
  274.  
  275. public OnPlayerStreamIn(playerid, forplayerid)
  276. {
  277. return 1;
  278. }
  279.  
  280. public OnPlayerStreamOut(playerid, forplayerid)
  281. {
  282. return 1;
  283. }
  284.  
  285. public OnVehicleStreamIn(vehicleid, forplayerid)
  286. {
  287. return 1;
  288. }
  289.  
  290. public OnVehicleStreamOut(vehicleid, forplayerid)
  291. {
  292. return 1;
  293. }
  294.  
  295. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  296. {
  297. switch(dialogid)
  298. {
  299. case DIALOG_REGISTER:
  300. {
  301. if(!response) return Kick(playerid);
  302. if(response)
  303. {
  304. if(!strlen(inputtext)) return ShowPlayerDialog(playerid,DIALOG_LOGIN,DIALOG_STYLE_INPUT,"LOGIN:","Netacna lozinka!","Login","Izlaz");
  305. new INI:File = INI_Open(KorisnickiRacun(playerid));
  306. INI_SetTag(File,"data");
  307. INI_WriteInt(File,"Lozinka",udb_hash(inputtext));
  308. INI_WriteInt(File,"DzepNovac",0);
  309. INI_WriteInt(File,"BankaNovac",0);
  310. INI_WriteInt(File,"Admin",0);
  311. INI_WriteInt(File,"Level",0);
  312. INI_Close(File);
  313. SetPlayerSkin(playerid,294);
  314. SetSpawnInfo(playerid, 0, 0, 1958.33, 1343.12, 15.36, 269.15, 0, 0, 0, 0, 0, 0);
  315. SpawnPlayer(playerid);
  316. }
  317. }
  318. case DIALOG_LOGIN:
  319. {
  320. if(!response) return Kick(playerid);
  321. if(response)
  322. {
  323. if(udb_hash(inputtext) == PlayerInfo[playerid][pLozinka])
  324. {
  325. INI_ParseFile(KorisnickiRacun(playerid),"UcitajKorisnika_%s",.bExtra = true,.extra = playerid);
  326. SetSpawnInfo(playerid, 0, 0, 1958.33, 1343.12, 15.36, 269.15, 0, 0, 0, 0, 0, 0);
  327. SetPlayerSkin(playerid,294);
  328. SpawnPlayer(playerid);
  329. GivePlayerMoney(playerid,PlayerInfo[playerid][pDzepNovac]);
  330. SetPlayerScore(playerid,PlayerInfo[playerid][pLevel]);
  331. SendClientMessage(playerid,-1,""ZELENA"Dobrodosao nazad na server, zelimo ti ugodnu igru!");
  332. }
  333. else
  334. {
  335. ShowPlayerDialog(playerid,DIALOG_LOGIN,DIALOG_STYLE_INPUT,"LOGIN:","Lozinka nije ispravna!",""ZELENA"Login",""CRVENA"Izlaz");
  336. }
  337. }
  338. }
  339. }
  340.  
  341. return 1;
  342. }
  343.  
  344. public OnPlayerCommandPerformed(playerid,cmdtext[],success)
  345. {
  346. if(!success) SendClientMessage(playerid,-1,""CRVENA"[Komanda ne postoji, postojace komande mozes videti na /help!]");
  347. return 1;
  348. }
  349.  
  350. public OnPlayerClickPlayer(playerid, clickedplayerid, source)
  351. {
  352. return 1;
  353. }
  354. /////////////////////////////////////////
  355. YCMD:fv(playerid,params[],help)
  356. {
  357. #pragma unused params
  358. if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid,-1, ""ZELENA"| BGaming | "CRVENA"Niste u vozilu!");
  359. RepairVehicle(GetPlayerVehicleID(playerid));
  360. SendClientMessage(playerid,-1,""ZELENA"| BGaming |"CRVENA" Vozilo Popravljeno!");
  361. return 1;
  362. }
  363. YCMD:flip(playerid, params[], help)
  364. {
  365. new VehicleID, Float:CX, Float:CY, Float:CZ, Float:CA;
  366. GetPlayerPos(playerid, CX, CY, CZ);
  367. VehicleID = GetPlayerVehicleID(playerid);
  368. SetVehiclePos(VehicleID, CX, CY, CZ);
  369. GetVehicleZAngle(VehicleID, CA);
  370. SetVehicleZAngle(VehicleID, CA);
  371. RepairVehicle(GetPlayerVehicleID(playerid));
  372. return 1;
  373. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement