gargy001

Skripta

Jun 26th, 2014
246
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 11.35 KB | None | 0 0
  1. /* Crystal LifeRolePlay
  2. Scripter: Dino Delkic
  3. Maper: Refik Bacic
  4. */
  5.  
  6. #include <a_samp>
  7. #include <YSI\y_ini>
  8. #include <zcmd>
  9. #include <sscanf2>
  10. #include <streamer>
  11.  
  12. #define DIALOG_REGISTER 1
  13. #define DIALOG_LOGIN 2
  14.  
  15. #define PATH "/Users/%s.ini"
  16.  
  17. #define COL_WHITE "{FFFFFF}"
  18. #define COL_RED "{F81414}"
  19. #define COL_GREEN "{00FF22}"
  20. #define COL_LIGHTBLUE "{00CED1}"
  21. #define COLOR_FADE1 0xE6E6E6E6
  22. #define COLOR_FADE2 0xC8C8C8C8
  23. #define COLOR_FADE3 0xAAAAAAAA
  24. #define COLOR_FADE4 0x8C8C8C8C
  25. #define COLOR_FADE5 0x6E6E6E6E
  26. #define COLOR_PURPLE 0xC2A2DAAA
  27. #define COLOR_GREY 0xAFAFAFAA
  28. #define COLOR_SYNTAX 0xFFFFFFFF
  29.  
  30. #define SCM SendClientMessage
  31. #define SPD ShowPlayerDialog
  32. #define SPC SetPlayerCheckpoint
  33. #define DPC DisablePlayerCheckpoint
  34.  
  35. /* new */
  36. new BigEar[MAX_PLAYERS];
  37. enum pInfo
  38. {
  39. pPass,
  40. pNovac,
  41. pAdmin,
  42. pGodine,
  43. pZemlja,
  44. pPosao
  45. }
  46.  
  47. new PlayerInfo[MAX_PLAYERS][pInfo];
  48.  
  49. forward LoadUser_data(playerid,name[],value[]);
  50. public LoadUser_data(playerid,name[],value[])
  51. {
  52. INI_Int("Password",PlayerInfo[playerid][pPass]);
  53. INI_Int("Novac",PlayerInfo[playerid][pNovac]);
  54. INI_Int("Admin",PlayerInfo[playerid][pAdmin]);
  55. INI_Int("Godine",PlayerInfo[playerid][pGodine]);
  56. INI_Int("Zemlja",PlayerInfo[playerid][pZemlja]);
  57. return 1;
  58. }
  59.  
  60. stock UserPath(playerid)
  61. {
  62. new string[128],playername[MAX_PLAYER_NAME];
  63. GetPlayerName(playerid,playername,sizeof(playername));
  64. format(string,sizeof(string),PATH,playername);
  65. return string;
  66. }
  67.  
  68. /*Credits to Dracoblue*/
  69. stock udb_hash(buf[]) {
  70. new length=strlen(buf);
  71. new s1 = 1;
  72. new s2 = 0;
  73. new n;
  74. for (n=0; n<length; n++)
  75. {
  76. s1 = (s1 + buf[n]) % 65521;
  77. s2 = (s2 + s1) % 65521;
  78. }
  79. return (s2 << 16) + s1;
  80. }
  81.  
  82. main()
  83. {
  84. print("\n---------------------------------------");
  85. print(" Crystal Lide Roleplay ");
  86. print(" By Dino ");
  87. print("-----------------------------------------\n");
  88. }
  89. public OnGameModeExit()
  90. {
  91. return 1;
  92. }
  93.  
  94. public OnPlayerRequestClass(playerid, classid)
  95. {
  96. return 1;
  97. }
  98.  
  99. public OnPlayerConnect(playerid)
  100. {
  101. /* Reg/log sistem */
  102. if(fexist(UserPath(playerid)))
  103. {
  104. INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
  105. ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,""COL_WHITE"Login",""COL_WHITE"Upisite svoj password da se ulogujete.","Login","Odustani");
  106. }
  107. else
  108. {
  109. ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT,""COL_WHITE"Registracija",""COL_WHITE"Upisite password da se registrujete.","Register","Odustani");
  110. }
  111. /* Poslovi */
  112.  
  113. public OnPlayerDisconnect(playerid, reason)
  114. {
  115. new INI:File = INI_Open(UserPath(playerid));
  116. INI_SetTag(File,"data");
  117. INI_WriteInt(File,"Novac",GetPlayerMoney(playerid));
  118. INI_WriteInt(File,"Admin",PlayerInfo[playerid][pAdmin]);
  119. INI_WriteInt(File,"Godine",PlayerInfo[playerid][pGodine]);
  120. INI_WriteInt(File,"Zemlja",PlayerInfo[playerid][pZemlja]);
  121. INI_WriteInt(File,"Posao",PlayerInfo[playerid][pPosao]);
  122. INI_Close(File);
  123. return 1;
  124. }
  125.  
  126. public OnPlayerSpawn(playerid)
  127. {
  128. return 1;
  129. }
  130.  
  131. public OnPlayerDeath(playerid, killerid, reason)
  132. {
  133. return 1;
  134. }
  135.  
  136. public OnVehicleSpawn(vehicleid)
  137. {
  138. return 1;
  139. }
  140.  
  141. public OnVehicleDeath(vehicleid, killerid)
  142. {
  143. return 1;
  144. }
  145.  
  146. public OnPlayerText(playerid, text[])
  147. {
  148. return 1;
  149. }
  150.  
  151. public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
  152. {
  153. return 1;
  154. }
  155.  
  156. public OnPlayerExitVehicle(playerid, vehicleid)
  157. {
  158. return 1;
  159. }
  160.  
  161. public OnPlayerLeaveCheckpoint(playerid)
  162. {
  163. return 1;
  164. }
  165.  
  166. public OnPlayerEnterRaceCheckpoint(playerid)
  167. {
  168. return 1;
  169. }
  170.  
  171. public OnPlayerLeaveRaceCheckpoint(playerid)
  172. {
  173. return 1;
  174. }
  175.  
  176. public OnRconCommand(cmd[])
  177. {
  178. return 1;
  179. }
  180.  
  181. public OnPlayerRequestSpawn(playerid)
  182. {
  183. return 1;
  184. }
  185.  
  186. public OnObjectMoved(objectid)
  187. {
  188. return 1;
  189. }
  190.  
  191. public OnPlayerObjectMoved(playerid, objectid)
  192. {
  193. return 1;
  194. }
  195.  
  196. public OnPlayerPickUpPickup(playerid, pickupid)
  197. {
  198. return 1;
  199. }
  200.  
  201. public OnVehicleMod(playerid, vehicleid, componentid)
  202. {
  203. return 1;
  204. }
  205.  
  206. public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
  207. {
  208. return 1;
  209. }
  210.  
  211. public OnVehicleRespray(playerid, vehicleid, color1, color2)
  212. {
  213. return 1;
  214. }
  215.  
  216. public OnPlayerSelectedMenuRow(playerid, row)
  217. {
  218. return 1;
  219. }
  220.  
  221. public OnPlayerExitedMenu(playerid)
  222. {
  223. return 1;
  224. }
  225.  
  226. public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
  227. {
  228. return 1;
  229. }
  230.  
  231. public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
  232. {
  233. return 1;
  234. }
  235.  
  236. public OnRconLoginAttempt(ip[], password[], success)
  237. {
  238. return 1;
  239. }
  240.  
  241. public OnPlayerUpdate(playerid)
  242. {
  243. return 1;
  244. }
  245.  
  246. public OnPlayerStreamIn(playerid, forplayerid)
  247. {
  248. return 1;
  249. }
  250.  
  251. public OnPlayerStreamOut(playerid, forplayerid)
  252. {
  253. return 1;
  254. }
  255.  
  256. public OnVehicleStreamIn(vehicleid, forplayerid)
  257. {
  258. return 1;
  259. }
  260.  
  261. public OnVehicleStreamOut(vehicleid, forplayerid)
  262. {
  263. return 1;
  264. }
  265.  
  266. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  267. {
  268. switch( dialogid )
  269. {
  270. case DIALOG_REGISTER:
  271. {
  272. if (!response) return Kick(playerid);
  273. if(response)
  274. {
  275. if(!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, ""COL_WHITE"Registracija",""COL_RED"Ukucali ste pogresan password.\n"COL_WHITE"Upisite password da registrujete vas racun.","Register","Quit");
  276. new INI:File = INI_Open(UserPath(playerid));
  277. INI_SetTag(File,"data");
  278. INI_WriteInt(File,"Password",udb_hash(inputtext));
  279. INI_WriteInt(File,"Novac",0);
  280. INI_WriteInt(File,"Admin",0);
  281. INI_WriteInt(File,"Zemlja",0);
  282. INI_WriteInt(File,"Godine",0);
  283. INI_WriteInt(File,"Posao",0);
  284. INI_Close(File);
  285.  
  286. SetSpawnInfo(playerid, 0, 0, );
  287. SpawnPlayer(playerid);
  288. }
  289. }
  290.  
  291. case DIALOG_LOGIN:
  292. {
  293. if ( !response ) return Kick ( playerid );
  294. if( response )
  295. {
  296. if(udb_hash(inputtext) == PlayerInfo[playerid][pPass])
  297. {
  298. INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
  299. GivePlayerMoney(playerid, PlayerInfo[playerid][pNovac]);
  300. SetSpawnInfo(playerid, 0, 0, 821.7203, -1342.0150, 13.5196, 93.1352, 0, 0, 0, 0, 0, 0);
  301. SpawnPlayer(playerid);
  302. }
  303. else
  304. {
  305. ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,""COL_WHITE"Login",""COL_RED"Ukucali ste pogresan password\n"COL_WHITE"Upisite password da se ulogujete.","Login","Izlaz");
  306. }
  307. return 1;
  308. }
  309. }
  310.  
  311.  
  312. public OnPlayerClickPlayer(playerid, clickedplayerid, source)
  313. {
  314. return 1;
  315. }
  316.  
  317. stock ProxDetector(Float:radi, playerid, string[],col1,col2,col3,col4,col5)
  318. {
  319. if(IsPlayerConnected(playerid))
  320. {
  321. new Float:posx, Float:posy, Float:posz;
  322. new Float:oldposx, Float:oldposy, Float:oldposz;
  323. new Float:tempposx, Float:tempposy, Float:tempposz;
  324. new invehicle[MAX_PLAYERS];
  325. new virtualworld = GetPlayerVirtualWorld(playerid);
  326. new interior = GetPlayerInterior(playerid);
  327. new vehicleid = GetPlayerVehicleID(playerid);
  328. new ivehicleid;
  329. if(vehicleid)
  330. {
  331. GetVehiclePos(vehicleid,oldposx,oldposy,oldposz);
  332. }
  333. else
  334. {
  335. GetPlayerPos(playerid, oldposx, oldposy, oldposz);
  336. vehicleid = GetPlayerVehicleID(playerid);
  337. }
  338. for(new i = 0; i < MAX_PLAYERS; i++)
  339. {
  340. if(IsPlayerConnected(i))
  341. {
  342. if(!BigEar[i])
  343. {
  344. if(GetPlayerVirtualWorld(i) == virtualworld)
  345. {
  346. if((GetPlayerInterior(i) == interior))
  347. {
  348. if(vehicleid)
  349. {
  350. if(IsPlayerInVehicle(i,vehicleid)) invehicle[i] = 1;
  351. }
  352. if(!invehicle[i])
  353. {
  354. if(IsPlayerInAnyVehicle(i))
  355. {
  356. ivehicleid = GetPlayerVehicleID(i);
  357. GetVehiclePos(ivehicleid,posx,posy,posz);
  358. }
  359. else
  360. {
  361. GetPlayerPos(i,posx,posy,posz);
  362. }
  363. tempposx = (oldposx -posx);
  364. tempposy = (oldposy -posy);
  365. tempposz = (oldposz -posz);
  366. if (((tempposx < radi/16) && (tempposx > -radi/16)) && ((tempposy < radi/16) && (tempposy > -radi/16)) && ((tempposz < radi/16) && (tempposz > -radi/16))) SCM(i, col1, string);
  367. else if (((tempposx < radi/8) && (tempposx > -radi/8)) && ((tempposy < radi/8) && (tempposy > -radi/8)) && ((tempposz < radi/8) && (tempposz > -radi/8))) SCM(i, col2, string);
  368. else if (((tempposx < radi/4) && (tempposx > -radi/4)) && ((tempposy < radi/4) && (tempposy > -radi/4)) && ((tempposz < radi/4) && (tempposz > -radi/4))) SCM(i, col3, string);
  369. else if (((tempposx < radi/2) && (tempposx > -radi/2)) && ((tempposy < radi/2) && (tempposy > -radi/2)) && ((tempposz < radi/2) && (tempposz > -radi/2))) SCM(i, col4, string);
  370. else if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi))) SCM(i, col5, string);
  371. }
  372. else SCM(i, col1, string);
  373. }
  374. }
  375. }
  376. else SCM(i, col1, string);
  377. }
  378. }
  379. }
  380. return 1;
  381. }
  382.  
  383. stock PlayerName(playerid)
  384. {
  385. new name[MAX_PLAYER_NAME];
  386. GetPlayerName(playerid, name, sizeof(name));
  387. return name;
  388. }
  389.  
  390. /* ------------------Komande-------------------- */
  391. /* Osnovne RP komande*/
  392.  
  393. CMD:b(playerid,params[])
  394. {
  395. if(isnull(params)) return SCM(playerid, COLOR_SYNTAX,"[CMD]: /b [lokalni ooc chat]");
  396. new sendername[MAX_PLAYER_NAME], string[128];
  397. GetPlayerName(playerid,sendername,sizeof(sendername));
  398. sendername[strfind(sendername,"_")] = ' ';
  399. format(string, sizeof(string), "((%s: %s ))", sendername, params);
  400. ProxDetector(30.0, playerid, string, COLOR_FADE1, COLOR_FADE2, COLOR_FADE3, COLOR_FADE4, COLOR_FADE5);
  401. return 1;
  402. }
  403.  
  404. CMD:s(playerid,params[])
  405. {
  406. if(isnull(params)) return SCM(playerid, COLOR_SYNTAX,"[CMD]: /s [glasno]");
  407. new sendername[MAX_PLAYER_NAME], string[128];
  408. GetPlayerName(playerid, sendername, sizeof(sendername));
  409. format(string, sizeof(string), "%s se dere: %s!!", sendername, params);
  410. ProxDetector(60.0, playerid, string, COLOR_FADE1, COLOR_FADE2, COLOR_FADE3, COLOR_FADE4, COLOR_FADE5);
  411. return 1;
  412. }
  413.  
  414. CMD:l(playerid,params[])
  415. {
  416. if(isnull(params)) return SCM(playerid, COLOR_SYNTAX,"[CMD]:/l [tiho]");
  417. new sendername[MAX_PLAYER_NAME], string[128];
  418. GetPlayerName(playerid,sendername,sizeof(sendername));
  419. sendername[strfind(sendername,"_")] = ' ';
  420. format(string,sizeof(string), "%s :[Tiho] %s", sendername, params);
  421. ProxDetector(3.0, playerid, string,COLOR_FADE1,COLOR_FADE2,COLOR_FADE3,COLOR_FADE4,COLOR_FADE5);
  422. return 1;
  423. }
  424.  
  425. CMD:me(playerid, params[])
  426. {
  427. new name[MAX_PLAYER_NAME], str[128];
  428. GetPlayerName(playerid, name, sizeof(name));
  429. if(isnull(params))
  430. return SCM(playerid,COLOR_SYNTAX -1,"[CMD]: /me [akcija]");
  431. format(str,sizeof(str),"*%s %s",name, params);
  432. ProxDetector(30.0, playerid, str, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
  433. return 1;
  434. }
Advertisement
Add Comment
Please, Sign In to add comment