Guest User

Untitled

a guest
May 26th, 2014
293
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 12.16 KB | None | 0 0
  1. //==============================================================================
  2. /*
  3. -New Life RolePlay
  4. -Skripter Joe
  5. -Maper Niko
  6. -Forum www.newlife-samp.com
  7. */
  8. //==============================================================================
  9. #include <a_samp>
  10. #include <YSI\y_ini>
  11. #include < foreach >
  12. //===============================Define boje====================================
  13. #define BELA            "{FFFFFF}"
  14. #define SPLAVA          "{00C0FF}"
  15. #define CRVENA          "{F81414}"
  16. #define SIVA            "{C0C0C0}"
  17. #define PROX            0xC2A2DAAA
  18. //==============================================================================
  19. //==============================Define dialozi==================================
  20. #define DIALOG_REGISTER 1
  21. #define DIALOG_LOGIN 2
  22. //==================================Define======================================
  23. #define SCM    SendClientMessage
  24. #define SCMTA  SendClientMessageToAll
  25. #define SPD    ShowPlayerDialog
  26. #define DSL    DIALOG_STYLE_LIST
  27. #define DSB    DIALOG_STYLE_MSGBOX
  28. #define DSI    DIALOG_STYLE_INPUT
  29. //==================================Define======================================
  30. #define PATH "/Korisnici/%s.ini"
  31. enum pInfo
  32. {
  33.     pLozinka,
  34.     pNovac,
  35.     pUbistva,
  36.     pLevel,
  37.     pSmrti
  38. };
  39. new PlayerInfo[MAX_PLAYERS][pInfo];
  40. //==============================================================================
  41. new ZabranjeneReci[][] =
  42. {
  43.     "CroHerze","Balkan Underground","Balkan-Underground","YUB","Yunited Balkan","YunitedBalkan",
  44.     "Yunited-Balkan","Y-U-B","Y.U.B","Dream World","Dream-World","DreamWorld","DW","City Of Angels","City-Of-Angels","CityOfAngels",
  45.     "Faction Game","Faction-Game","FactionGame","NooBot","Balkan Extazy","Balkan-Extazy","Balkan.Extazy","BE","adm","srv","193.112",":7777","123","691","91",
  46.     "46.4","46","78.112.","svr","srw","admin","NB","Global-Gaming","GG","Global Gaming","GlobalGaming","Paun","Deity","server","GH",
  47.     "Ghetto Hard","Ghetto","Srbija RP","Elitez","Balkan Elitez","moj srw","moj server","Kurac","kurac","Picka","picka","Sisa","sisa"
  48. };
  49. //==============================================================================
  50. main()
  51. {
  52.     print("|==============================================|");
  53.     print("|             New Life RolePlay                |");
  54.     print("|                  NL:RP                       |");
  55.     print("|              GameMode By Joe                 |");
  56.     print("|        Forum: www.newlife-samp.com           |");
  57.     print("|==============================================|");
  58. }
  59.  
  60.  
  61. public OnGameModeInit()
  62. {
  63. //=======================Podesavanja i Varijable================================
  64.     SetGameModeText("© NL:RP v1.0 By Joe");
  65.     SendRconCommand("mapname Beograd");
  66.     SendRconCommand("weburl www.newlife-samp.com");
  67.     AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
  68. //==============================================================================
  69.     return 1;
  70. }
  71.  
  72. public OnPlayerRequestClass(playerid, classid)
  73. {
  74.     SetSpawnInfo(playerid, 0, 0, 1958.33, 1343.12, 15.36, 269.15, 0, 0, 0, 0, 0, 0);// Ovde stavite koordinate svog spawna
  75.     SpawnPlayer(playerid);
  76.     return 1;
  77. }
  78.  
  79. public OnPlayerConnect(playerid)
  80. {
  81.         if(fexist(UserPath(playerid)))
  82.     {
  83.         INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
  84.         ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,"Login","‚"BELA"_________________________________________________________\n\n"BELA"Dobrodosao/la na "SPLAVA"New Life RolePlay\n\n"BELA"Vi imate "SPLAVA"registrovan account "BELA"molimo vas da se ulogujete.\n\n"BELA"Vasu lozinku upisite u polje ispod.\n\n"BELA"Zelimo vam ugodnu igru na nasem serveru.\n\n"BELA"_________________________________________________________","Login","Exit");
  85.     }
  86.     else
  87.     {
  88.         ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT,"Registracija",""BELA"_________________________________________________________\n\n"BELA"Dobrodosao/la na "SPLAVA"New Life RolePlay\n\n"BELA"Vi nemate "CRVENA"registrovan account "BELA"molimo vas da se registrujete.\n\n"BELA"Vasu lozinku upisite u polje ispod.\n\n"BELA"Zelimo vam ugodnu igru na nasem serveru.\n\n"BELA"_________________________________________________________","Registruj se","Exit");
  89.     }
  90.     return 1;
  91. }
  92.  
  93. public OnPlayerDisconnect(playerid, reason)
  94. {
  95.     new INI:File = INI_Open(UserPath(playerid));
  96.     INI_SetTag(File,"data");
  97.     INI_WriteInt(File,"Novac",GetPlayerMoney(playerid));
  98.     INI_WriteInt(File,"Ubistva",PlayerInfo[playerid][pUbistva]);
  99.     INI_WriteInt(File,"Smrti",PlayerInfo[playerid][pSmrti]);
  100.     INI_WriteInt(File,"Level",PlayerInfo[playerid][pLevel]);
  101.     INI_Close(File);
  102. //==============================================================================
  103.     new rstring[120];
  104.     switch(reason)
  105.     {
  106.         case 0: format(rstring, sizeof(rstring), ""SIVA"(( %s je izasao sa servera... (crash) ))", GetName(playerid));
  107.         case 1: format(rstring, sizeof(rstring), ""SIVA"(( %s je izasao sa servera... ))", GetName(playerid));
  108.         case 2: format(rstring, sizeof(rstring), ""SIVA"(( %s je izasao sa servera "CRVENA"(KICK/BAN)"SIVA"... ))", GetName(playerid));
  109.     }
  110.     ProxDetector(30.0, playerid, rstring,PROX,PROX,PROX,PROX,PROX);
  111. //==============================================================================
  112.     return 1;
  113. }
  114.  
  115. public OnPlayerSpawn(playerid)
  116. {
  117.     return 1;
  118. }
  119.  
  120. public OnPlayerDeath(playerid, killerid, reason)
  121. {
  122.     PlayerInfo[killerid][pUbistva]++;
  123.     PlayerInfo[playerid][pSmrti]++;
  124.     return 1;
  125. }
  126.  
  127. public OnVehicleSpawn(vehicleid)
  128. {
  129.     return 1;
  130. }
  131.  
  132. public OnVehicleDeath(vehicleid, killerid)
  133. {
  134.     return 1;
  135. }
  136.  
  137. public OnPlayerText(playerid, text[])
  138. {
  139.     for(new words; words < sizeof(ZabranjeneReci); words++)
  140.     {
  141.         if(strfind(text,ZabranjeneReci[words],true) != -1 ) { SCM(playerid,-1,"[NL:RP]: "CRVENA"Rjec ta je zabranjena nemozete je pisati!"); return 0; }
  142.     }
  143.     return 1;
  144. }
  145. public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
  146. {
  147.     return 1;
  148. }
  149.  
  150. public OnPlayerExitVehicle(playerid, vehicleid)
  151. {
  152.     return 1;
  153. }
  154.  
  155. public OnPlayerStateChange(playerid, newstate, oldstate)
  156. {
  157.     return 1;
  158. }
  159.  
  160. public OnPlayerEnterCheckpoint(playerid)
  161. {
  162.     return 1;
  163. }
  164.  
  165. public OnPlayerLeaveCheckpoint(playerid)
  166. {
  167.     return 1;
  168. }
  169.  
  170. public OnPlayerEnterRaceCheckpoint(playerid)
  171. {
  172.     return 1;
  173. }
  174.  
  175. public OnPlayerLeaveRaceCheckpoint(playerid)
  176. {
  177.     return 1;
  178. }
  179.  
  180. public OnRconCommand(cmd[])
  181. {
  182.     return 1;
  183. }
  184.  
  185. public OnPlayerRequestSpawn(playerid)
  186. {
  187.     return 1;
  188. }
  189.  
  190. public OnObjectMoved(objectid)
  191. {
  192.     return 1;
  193. }
  194.  
  195. public OnPlayerObjectMoved(playerid, objectid)
  196. {
  197.     return 1;
  198. }
  199.  
  200. public OnPlayerPickUpPickup(playerid, pickupid)
  201. {
  202.     return 1;
  203. }
  204.  
  205. public OnVehicleMod(playerid, vehicleid, componentid)
  206. {
  207.     return 1;
  208. }
  209.  
  210. public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
  211. {
  212.     return 1;
  213. }
  214.  
  215. public OnVehicleRespray(playerid, vehicleid, color1, color2)
  216. {
  217.     return 1;
  218. }
  219.  
  220. public OnPlayerSelectedMenuRow(playerid, row)
  221. {
  222.     return 1;
  223. }
  224.  
  225. public OnPlayerExitedMenu(playerid)
  226. {
  227.     return 1;
  228. }
  229.  
  230. public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
  231. {
  232.     return 1;
  233. }
  234.  
  235. public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
  236. {
  237.     return 1;
  238. }
  239.  
  240. public OnRconLoginAttempt(ip[], password[], success)
  241. {
  242.     return 1;
  243. }
  244.  
  245. public OnPlayerUpdate(playerid)
  246. {
  247.     return 1;
  248. }
  249.  
  250. public OnPlayerStreamIn(playerid, forplayerid)
  251. {
  252.     return 1;
  253. }
  254.  
  255. public OnPlayerStreamOut(playerid, forplayerid)
  256. {
  257.     return 1;
  258. }
  259.  
  260. public OnVehicleStreamIn(vehicleid, forplayerid)
  261. {
  262.     return 1;
  263. }
  264.  
  265. public OnVehicleStreamOut(vehicleid, forplayerid)
  266. {
  267.     return 1;
  268. }
  269.  
  270. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  271. {
  272.     switch(dialogid)
  273.     {
  274.     case DIALOG_REGISTER:
  275.     {
  276.     if(!response) return Kick(playerid);
  277.     if(response)
  278.     {
  279.     if(!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, "Registracija",""BELA"Ukucali ste pogresnu lozinku.\n\n"BELA"Ukucajte ispravnu lozinku da bi se registrovali.","Registruj se","Exit");
  280.     new INI:File = INI_Open(UserPath(playerid));
  281.     INI_SetTag(File,"data");
  282.     INI_WriteInt(File,"Lozinka",udb_hash(inputtext));
  283.     INI_WriteInt(File,"Novac",0);
  284.     INI_WriteInt(File,"Ubistva",0);
  285.     INI_WriteInt(File,"Smrti",0);
  286.     INI_WriteInt(File,"Level",0);
  287.     INI_Close(File);
  288.     SetSpawnInfo(playerid, 0, 0, 1958.33, 1343.12, 15.36, 269.15, 0, 0, 0, 0, 0, 0);// Ovde stavite koordinate svog spawna
  289.     SpawnPlayer(playerid);
  290.     }
  291.     }
  292.     case DIALOG_LOGIN:
  293.     {
  294.     if(!response) return Kick(playerid);
  295.     if(response)
  296.     {
  297.     if(udb_hash(inputtext) == PlayerInfo[playerid][pLozinka])
  298.     {
  299.     INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
  300.     GivePlayerMoney(playerid, PlayerInfo[playerid][pNovac]);
  301.     }
  302.     else
  303.     {
  304.     ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,"Login",""BELA"Ukucali ste pogresnu lozinku.\n\n"BELA"Ukucajte ispravnu lozinku da bi se ulogovali.","Login","Exit");
  305.     }
  306.     return 1;
  307.     }
  308.     }
  309.     }
  310.     return 1;
  311. }
  312.  
  313. public OnPlayerClickPlayer(playerid, clickedplayerid, source)
  314. {
  315.     return 1;
  316. }
  317. //=================================Stockovi=====================================
  318. stock UserPath(playerid)
  319. {
  320.     new string[128],playername[MAX_PLAYER_NAME];
  321.     GetPlayerName(playerid,playername,sizeof(playername));
  322.     format(string,sizeof(string),PATH,playername);
  323.     return string;
  324. }
  325. stock udb_hash(buf[])
  326. {
  327.     new length=strlen(buf);
  328.     new s1 = 1;
  329.     new s2 = 0;
  330.     new n;
  331.     for (n=0; n<length; n++)
  332.     {
  333.         s1 = (s1 + buf[n]) % 65521;
  334.         s2 = (s2 + s1)     % 65521;
  335.     }
  336.     return (s2 << 16) + s1;
  337. }
  338. //==============================================================================
  339. forward LoadUser_data(playerid,name[],value[]);
  340. public LoadUser_data(playerid,name[],value[])
  341. {
  342.     INI_Int("Lozinka",PlayerInfo[playerid][pLozinka]);
  343.     INI_Int("Novac",PlayerInfo[playerid][pNovac]);
  344.     INI_Int("Ubistva",PlayerInfo[playerid][pUbistva]);
  345.     INI_Int("Smrti",PlayerInfo[playerid][pSmrti]);
  346.     INI_Int("Level",PlayerInfo[playerid][pLevel]);
  347.     return 1;
  348. }
  349. //==============================================================================
  350. forward ProxDetector(Float:radi, playerid, string[],col1,col2,col3,col4,col5);
  351. public ProxDetector(Float:radi, playerid, string[],col1,col2,col3,col4,col5)
  352. {
  353.     if(IsPlayerConnected(playerid))
  354.     {
  355.         new Float:posx, Float:posy, Float:posz;
  356.         new Float:oldposx, Float:oldposy, Float:oldposz;
  357.         new Float:tempposx, Float:tempposy, Float:tempposz;
  358.         GetPlayerPos(playerid, oldposx, oldposy, oldposz);
  359.         foreach(Player,i)
  360.         {
  361.             if(IsPlayerConnected(i))
  362.             {
  363.                 if(GetPlayerVirtualWorld(playerid) == GetPlayerVirtualWorld(i))
  364.                 {
  365.                     GetPlayerPos(i, posx, posy, posz);
  366.                     tempposx = (oldposx -posx);
  367.                     tempposy = (oldposy -posy);
  368.                     tempposz = (oldposz -posz);
  369.                     if (((tempposx < radi/16) && (tempposx > -radi/16)) && ((tempposy < radi/16) && (tempposy > -radi/16)) && ((tempposz < radi/16) && (tempposz > -radi/16)))
  370.                     {
  371.                         SendClientMessage(i, col1, string);
  372.                     }
  373.                     else if (((tempposx < radi/8) && (tempposx > -radi/8)) && ((tempposy < radi/8) && (tempposy > -radi/8)) && ((tempposz < radi/8) && (tempposz > -radi/8)))
  374.                     {
  375.                         SendClientMessage(i, col2, string);
  376.                     }
  377.                     else if (((tempposx < radi/4) && (tempposx > -radi/4)) && ((tempposy < radi/4) && (tempposy > -radi/4)) && ((tempposz < radi/4) && (tempposz > -radi/4)))
  378.                     {
  379.                         SendClientMessage(i, col3, string);
  380.                     }
  381.                     else if (((tempposx < radi/2) && (tempposx > -radi/2)) && ((tempposy < radi/2) && (tempposy > -radi/2)) && ((tempposz < radi/2) && (tempposz > -radi/2)))
  382.                     {
  383.                         SendClientMessage(i, col4, string);
  384.                     }
  385.                     else if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
  386.                     {
  387.                         SendClientMessage(i, col5, string);
  388.                     }
  389.             }   }
  390.         }
  391.     }
  392.     return 1;
  393. }
  394. //==============================================================================
  395. IsNumeric(const string[])
  396. {
  397.     for (new i = 0, j = strlen(string); i < j; i++)
  398.     {
  399.         if (string[i] > '9' || string[i] < '0') return 0;
  400.     }
  401.     return 1;
  402. }
  403. //==============================================================================
  404. stock GetName(playerid)
  405. {
  406.     new name[MAX_PLAYER_NAME];
  407.     GetPlayerName(playerid, name, sizeof(name));
  408.     return name;
  409. }
  410. //==============================================================================
Advertisement
Add Comment
Please, Sign In to add comment