Guest User

GM nujokams

a guest
Nov 29th, 2014
392
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 14.39 KB | None | 0 0
  1. //define
  2. #define LIGHTBLUE 0x33CCFFAA
  3. #define RED 0xAA3333AA
  4. #define GREY 0xAFAFAFAA
  5. #define YELLOW 0xFFFF00AA
  6. #define PINK 0xFF66FFAA
  7. #define BLUE 0x0000BBAA
  8. #define WHITE 0xFFFFFFAA
  9. #define DARKRED 0x660000AA
  10. #define ORANGE 0xFF9900AA
  11. #define BRIGHTRED 0xFF0000AA
  12. #define INDIGO 0x4B00B0AA
  13. #define VIOLET 0x9955DEEE
  14. #define LIGHTRED 0xFF99AADD
  15. #define SEAGREEN 0x00EEADDF
  16. #define GRAYWHITE 0xEEEEFFC4
  17. #define LIGHTNEUTRALBLUE 0xabcdef66
  18. #define GREENISHGOLD 0xCCFFDD56
  19. #define LIGHTBLUEGREEN 0x0FFDD349
  20. #define NEUTRALBLUE 0xABCDEF01
  21. #define LIGHTCYAN 0xAAFFCC33
  22. #define LEMON 0xDDDD2357
  23. #define MEDIUMBLUE 0x63AFF00A
  24. #define NEUTRAL 0xABCDEF97
  25. #define BLACK 0x00000000
  26. #define NEUTRALGREEN 0x81CFAB00
  27. #define DARKGREEN 0x12900BBF
  28. #define LIGHTGREEN 0x24FF0AB9
  29. #define DARKBLUE 0x300FFAAB
  30. #define BLUEGREEN 0x46BBAA00
  31. #define PINK 0xFF66FFAA
  32. #define dregister 2011
  33. #define dlogin 2012
  34. #define UserPath "Users/%s.ini"
  35. //include
  36. #include <a_samp>
  37. #include <a_samp>
  38. #include <YSI\y_ini>
  39. //new
  40. new bool:firstSpawn[ MAX_PLAYERS ];
  41. // kitka
  42. native WP_Hash(buffer[],len,const str[]);
  43.  
  44. main()
  45. {
  46. print("\n----------------------------------");
  47. print(" Blank Gamemode by your name here");
  48. print("----------------------------------\n");
  49. }
  50. public OnGameModeInit()
  51. {
  52. AddStaticVehicleEx ( 510, 2017.6434,1338.0948,10.8203,265.4293, 0, 1, 30 );
  53. AddStaticVehicleEx ( 510, 2017.1171,1347.7137,10.8203,267.3094, 0, 1, 30 );
  54.  
  55. // Don't use these lines if it's a filterscript
  56. SetGameModeText("Serveris 1.0");
  57. AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
  58. return 1;
  59. }
  60.  
  61. enum PlayerInfo
  62. {
  63. Pass[129],
  64. Adminlevel,
  65. VIPlevel,
  66. Money,
  67. Scores,
  68. Kills,
  69. Deaths
  70. }
  71.  
  72. new pInfo[MAX_PLAYERS][PlayerInfo];
  73.  
  74. stock Path(playerid)
  75. {
  76. new str[128],name[MAX_PLAYER_NAME];
  77. GetPlayerName(playerid,name,sizeof(name));
  78. format(str,sizeof(str),UserPath,name);
  79. return str;
  80. }
  81. forward loadaccount_user(playerid, name[], value[]);
  82.  
  83.  
  84. public loadaccount_user(playerid, name[], value[])
  85. {
  86. INI_String("Password", pInfo[playerid][Pass],129);
  87. INI_Int("AdminLevel",pInfo[playerid][Adminlevel]);
  88. INI_Int("VIPLevel",pInfo[playerid][VIPlevel]);
  89. INI_Int("Money",pInfo[playerid][Money]);
  90. INI_Int("Scores",pInfo[playerid][Scores]);
  91. INI_Int("Kills",pInfo[playerid][Kills]);
  92. INI_Int("Deaths",pInfo[playerid][Deaths]);
  93. return 1;
  94. }
  95.  
  96. public OnGameModeExit()
  97. {
  98. return 1;
  99. }
  100.  
  101. public OnPlayerRequestClass(playerid, classid)
  102. {
  103. SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
  104. SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
  105. SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
  106. return 1;
  107. }
  108.  
  109. public OnPlayerConnect(playerid)
  110. {
  111.  
  112. PlayAudioStreamForPlayer( playerid, "http://84.46.205.13/rc128.mp3.m3u" );
  113. firstSpawn[ playerid ] = true;
  114.  
  115. if(InvalidNickKick(playerid)) return 0;
  116.  
  117. new name[MAX_PLAYER_NAME];
  118. GetPlayerName(playerid,name,sizeof(name));
  119. if(fexist(Path(playerid)))
  120. {// then
  121. INI_ParseFile(Path(playerid),"loadaccount_%s", .bExtra = true, .extra = playerid); //Will load user''s data using INI_Parsefile.
  122. ShowPlayerDialog(playerid,dlogin,DIALOG_STYLE_INPUT,"Prisijungimas","Sveiki sugrįže! {FFFFFF}Šis vartotojas yra {DB881A}registruotas {FFFFFF}įveskite slaptažodį norėdami prisijungti.","Jungtis","Išeiti");/*A dialog with input style will appear so you can insert your password to login.*/
  123. }
  124. else //If the connected user is not registered,
  125. {//then we will ''force'' him to register :)
  126. ShowPlayerDialog(playerid,dregister,DIALOG_STYLE_INPUT,"Registracija","Sveiki! {FFFFFF}Jūs turite užsiregistruoti. Įveskite norimą slaptažodį.","Registruotis","Išeiti");
  127. return 1;
  128. }
  129. return 1;
  130.  
  131. }
  132.  
  133. public OnPlayerDisconnect(playerid, reason)
  134. {
  135. //Same as OnDialogResponse, we will save their stats inside of their user''s account
  136. new INI:file = INI_Open(Path(playerid)); //will open their file
  137. INI_SetTag(file,"Player''s Data");//We will set a tag inside of user''s account called "Player''s Data"
  138. INI_WriteInt(file,"AdminLevel",pInfo[playerid][Adminlevel]); //If you''ve set his/her admin level, then his/her admin level will be saved inside of his/her account
  139. INI_WriteInt(file,"VIPLevel",pInfo[playerid][VIPlevel]);//As explained above
  140. INI_WriteInt(file,"Money",GetPlayerMoney(playerid));//We will save his money inside of his account
  141. INI_WriteInt(file,"Scores",GetPlayerScore(playerid));//We will save his score inside of his account
  142. INI_WriteInt(file,"Kills",pInfo[playerid][Kills]);//As explained above
  143. INI_WriteInt(file,"Deaths",pInfo[playerid][Deaths]);//As explained above
  144. INI_Close(file);//Now after we''ve done saving their data, we now need to close the file
  145. return 1;
  146. }
  147.  
  148. public OnPlayerSpawn(playerid)
  149. {
  150. StopAudioStreamForPlayer ( playerid );
  151. firstSpawn[ playerid ] = false;
  152. return 1;
  153. }
  154.  
  155. public OnPlayerDeath(playerid, killerid, reason)
  156. {
  157. pInfo[killerid][Kills]++;//Will give 1 kill to killer and it will be saved inside of his/her account
  158. pInfo[playerid][Deaths]++;//Will give 1 death each time they die and it will be saved inside of his/her account
  159. return 1;
  160. }
  161.  
  162. public OnVehicleSpawn(vehicleid)
  163. {
  164. return 1;
  165. }
  166.  
  167. public OnVehicleDeath(vehicleid, killerid)
  168. {
  169. return 1;
  170. }
  171.  
  172. public OnPlayerText(playerid, text[])
  173. {
  174. return 1;
  175. }
  176.  
  177. public OnPlayerCommandText(playerid, cmdtext[])
  178. {
  179. if (strcmp("/mycommand", cmdtext, true, 10) == 0)
  180. {
  181. // Do something here
  182. return 1;
  183. }
  184. return 0;
  185. }
  186.  
  187. public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
  188. {
  189. return 1;
  190. }
  191.  
  192. public OnPlayerExitVehicle(playerid, vehicleid)
  193. {
  194. return 1;
  195. }
  196.  
  197. public OnPlayerStateChange(playerid, newstate, oldstate)
  198. {
  199. return 1;
  200. }
  201.  
  202. public OnPlayerEnterCheckpoint(playerid)
  203. {
  204. return 1;
  205. }
  206.  
  207. public OnPlayerLeaveCheckpoint(playerid)
  208. {
  209. return 1;
  210. }
  211.  
  212. public OnPlayerEnterRaceCheckpoint(playerid)
  213. {
  214. return 1;
  215. }
  216.  
  217. public OnPlayerLeaveRaceCheckpoint(playerid)
  218. {
  219. return 1;
  220. }
  221.  
  222. public OnRconCommand(cmd[])
  223. {
  224. return 1;
  225. }
  226.  
  227. public OnPlayerRequestSpawn(playerid)
  228. {
  229. return 1;
  230. }
  231.  
  232. public OnObjectMoved(objectid)
  233. {
  234. return 1;
  235. }
  236.  
  237. public OnPlayerObjectMoved(playerid, objectid)
  238. {
  239. return 1;
  240. }
  241.  
  242. public OnPlayerPickUpPickup(playerid, pickupid)
  243. {
  244. return 1;
  245. }
  246.  
  247. public OnVehicleMod(playerid, vehicleid, componentid)
  248. {
  249. return 1;
  250. }
  251.  
  252. public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
  253. {
  254. return 1;
  255. }
  256.  
  257. public OnVehicleRespray(playerid, vehicleid, color1, color2)
  258. {
  259. return 1;
  260. }
  261.  
  262. public OnPlayerSelectedMenuRow(playerid, row)
  263. {
  264. return 1;
  265. }
  266.  
  267. public OnPlayerExitedMenu(playerid)
  268. {
  269. return 1;
  270. }
  271.  
  272. public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
  273. {
  274. return 1;
  275. }
  276.  
  277. public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
  278. {
  279. return 1;
  280. }
  281.  
  282. public OnRconLoginAttempt(ip[], password[], success)
  283. {
  284. return 1;
  285. }
  286.  
  287. public OnPlayerUpdate(playerid)
  288. {
  289. return 1;
  290. }
  291.  
  292. public OnPlayerStreamIn(playerid, forplayerid)
  293. {
  294. return 1;
  295. }
  296.  
  297. public OnPlayerStreamOut(playerid, forplayerid)
  298. {
  299. return 1;
  300. }
  301.  
  302. public OnVehicleStreamIn(vehicleid, forplayerid)
  303. {
  304. return 1;
  305. }
  306.  
  307. public OnVehicleStreamOut(vehicleid, forplayerid)
  308. {
  309. return 1;
  310. }
  311.  
  312. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  313. {
  314.  
  315. if(dialogid == dregister) //If dialog id is a register dialog
  316. {//then
  317. if(!response) return Kick(playerid); //If they clicked the second button "Quit", we will kick them.
  318. if(response) //if they clicked the first button "Register"
  319. {//then
  320. if(!strlen(inputtext)) //If they didn''t enter any password
  321. {// then we will tell to them to enter the password to register
  322. ShowPlayerDialog(playerid,dregister,DIALOG_STYLE_INPUT,"Registracija","Prašome įvesti slaptažodį, tuščias laukelis netinka!","Registruotis","Išeiti");
  323. return 1;
  324. }
  325. //If they have entered a correct password for his/her account...
  326. new hashpass[129]; //Now we will create a new variable to hash his/her password
  327. WP_Hash(hashpass,sizeof(hashpass),inputtext);//We will use whirlpool to hash their inputted text
  328. new INI:file = INI_Open(Path(playerid)); // we will open a new file for them to save their account inside of Scriptfiles/Users folder
  329. INI_SetTag(file,"Player''s Data");//We will set a tag inside of user''s account called "Player''s Data"
  330. INI_WriteString(file,"Password",hashpass);//This will write a hashed password into user''s account
  331. INI_WriteInt(file,"AdminLevel",0); //Write an integer inside of user''s account called "AdminLevel". We will set his level to 0 after he registered.
  332. INI_WriteInt(file,"VIPLevel",0);//As explained above
  333. INI_WriteInt(file,"Money",0);//Write an integer inside of user''s account called "Money". We will set their money to 0 after he registered
  334. INI_WriteInt(file,"Scores",0);//Write an integer inside of user''s account called "Scores". We will set their score to 0 after he registered
  335. INI_WriteInt(file,"Kills",0);//As explained above
  336. INI_WriteInt(file,"Deaths",0);//As explained above
  337. INI_Close(file);//Now after we''ve done saving their data, we now need to close the file
  338. SendClientMessage(playerid,-1,"Jūs sėkmingai užsiregistravote!");//Tell to them that they have successfully registered a new account
  339. return 1;
  340. }
  341. }
  342. if(dialogid == dlogin) //If dialog id is a login dialog
  343. {//then
  344. if(!response) return Kick(playerid); //If they clicked the second button "Quit", we will kick them.
  345. if(response) //if they clicked the first button "Register"
  346. {//then
  347. new hashpass[129]; //Will create a new variable to hash his/her password
  348. WP_Hash(hashpass,sizeof(hashpass),inputtext); //Will hash inputted password
  349. if(!strcmp(hashpass, pInfo[playerid][Pass], false)) //If they have insert their correct password
  350. {//then
  351. INI_ParseFile(Path(playerid),"loadaccount_%s",.bExtra = true, .extra = playerid);//We will load his account''s data from user''s path
  352. SetPlayerScore(playerid,pInfo[playerid][Scores]);//We will get their score inside of his user''s account and we will set it here
  353. GivePlayerMoney(playerid,pInfo[playerid][Money]);//As explained above
  354. SendClientMessage(playerid,-1,"Sveiki sugrįže! Jūs sėkmingai prisijungėte.");//Tell them that they''ve successfully logged in
  355. }
  356. else //If they''ve entered an incorrect password
  357. {//then
  358. ShowPlayerDialog(playerid,dlogin,DIALOG_STYLE_INPUT,"Prisijungimas","{FFFFFF}Jūsų įvestas slaptažodis buvo {FF0000}neteisingas{FFFFFF}, pabandykite įvesti dar kartą!","Prisijungti","Išeiti");//We will tell to them that they''ve entered an incorrect password
  359. return 1;
  360. }
  361. }
  362. }
  363. return 1;
  364. }
  365.  
  366. public OnPlayerClickPlayer(playerid, clickedplayerid, source)
  367. {
  368. return 1;
  369. }
  370. stock InvalidNickKick(playerid)
  371. {
  372. if(IsPlayerNPC(playerid))return 1;
  373. new name[MAX_PLAYER_NAME];
  374. GetPlayerName(playerid,name,sizeof(name));
  375. new where = strfind(name,"_",true);
  376. new lenght = strlen(name)-1;
  377. new invalid = strfind(name,"[",true);
  378. if(invalid == -1) invalid = strfind(name,"]",true);
  379.  
  380. if(name[0] < 65 || name[0] > 90)
  381. {
  382. new msg[128];
  383. SendClientMessage(playerid,RED,"* Serveris: Jusu slapyvardis netinkamas. Vardas rasosi didziaja raide!");
  384. SendClientMessage(playerid,RED,"* Serveris: Teisinga slapyvardzio forma butu:");
  385. SendClientMessage(playerid,RED,"* Serveris: Vardas_Pavarde");
  386. format(msg,sizeof(msg),"* ]]] %s [[ ]] %i [[[ *", name[0], name[0]);
  387. SendClientMessage(playerid, RED, msg);
  388. Kick(playerid);
  389. return 1;
  390. }
  391.  
  392. if(name[where+1] < 65 || name[where+1] > 90)
  393. {
  394. SendClientMessage(playerid,RED,"* Serveris: Jusu slapyvardis netinkamas. Pavarde rasosi didziaja raide!");
  395. SendClientMessage(playerid,RED,"* Serveris: Teisinga slapyvardzio forma butu:");
  396. SendClientMessage(playerid,RED,"* Serveris: Vardas_Pavarde");
  397. Kick(playerid);
  398. return 1;
  399. }
  400.  
  401. for(new i = 1; i < where-1; i++)
  402. {
  403. if(name[i] < 97 || name[i] > 122)
  404. {
  405. SendClientMessage(playerid,RED,"* Serveris: Jusu slapyvardis netinkamas del: (didziosios raides arba skaiciai vardo vidury)");
  406. SendClientMessage(playerid,RED,"* Serveris: Teisinga slapyvardzio forma butu:");
  407. SendClientMessage(playerid,RED,"* Serveris: Vardas_Pavarde");
  408. Kick(playerid);
  409. return 1;
  410. }
  411. }
  412.  
  413.  
  414. if(where == 0 || where == lenght || where==-1)
  415. {
  416. SendClientMessage(playerid,RED,"* Serveris: Jusu slapyvardis netinkamas.");
  417. SendClientMessage(playerid,RED,"* Serveris: Teisinga slapyvardzio forma butu:");
  418. SendClientMessage(playerid,RED,"* Serveris: Vardas_Pavarde");
  419. Kick(playerid);
  420. return 1;
  421. }
  422.  
  423. if(strlen(name[where])<4)
  424. {
  425. SendClientMessage(playerid,RED,"* Serveris: Jusu pavarde per trumpa");
  426. SendClientMessage(playerid,RED,"* Serveris: Teisinga slapyvardzio forma butu:");
  427. SendClientMessage(playerid,RED,"* Serveris: Vardas_Pavarde");
  428. Kick(playerid);
  429. return 1;
  430. }
  431.  
  432. if(where<3)
  433. {
  434. SendClientMessage(playerid,RED,"* Serveris: Jusu vardas per trumpas");
  435. SendClientMessage(playerid,RED,"* Serveris: Teisinga slapyvardzio forma butu:");
  436. SendClientMessage(playerid,RED,"* Serveris: Vardas_Pavarde");
  437. Kick(playerid);
  438. return 1;
  439. }
  440.  
  441.  
  442. if(invalid != -1)
  443. {
  444. SendClientMessage(playerid,RED,"* Serveris: Varde rasta netinkamu raidziu.");
  445. SendClientMessage(playerid,RED,"* Serveris: Teisinga slapyvardzio forma butu:");
  446. SendClientMessage(playerid,RED,"* Serveris: Vardas_Pavarde");
  447. Kick(playerid);
  448. return 1;
  449. }
  450.  
  451. for(new i = where+2; i < MAX_PLAYER_NAME; i++)
  452. {
  453. if(name[i] < 97 || name[i] > 122)
  454. {
  455. if(name[i] == 0){i = MAX_PLAYER_NAME; return 0;}
  456. SendClientMessage(playerid,RED,"* Serveris: Jusu slapyvardis netinkamas del: (didziosios raides arba skaiciai pavardes vidury)");
  457. SendClientMessage(playerid,RED,"* Serveris: Teisinga slapyvardzio forma butu:");
  458. SendClientMessage(playerid,RED,"* Serveris: Vardas_Pavarde");
  459. Kick(playerid);
  460. return 1;
  461. }
  462. }
  463. return 0;
  464. }
Advertisement
Add Comment
Please, Sign In to add comment