Advertisement
Guest User

Untitled

a guest
Nov 23rd, 2017
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.58 KB | None | 0 0
  1. /*
  2.  
  3.  
  4. -2 teams
  5.  
  6. [Done]
  7.  
  8. -Balanced economic system
  9.  
  10. [X]
  11.  
  12. -Head shot system using OnPlayerGiveDamage
  13.  
  14. [X]
  15.  
  16. -Helmet system (this may be hard)
  17.  
  18. [X]
  19.  
  20. -Simple VIP system that can access some restricted weapons or can have a discount on weapons
  21.  
  22. [X]
  23.  
  24. -Simple admin system
  25.  
  26. [X]
  27.  
  28. -Killstreak system using New Killstreak[playerid]
  29.  
  30. [X]
  31.  
  32. -Simple rewards system
  33.  
  34. [X]
  35.  
  36. -Server sided money using this http://forum.sa-mp.com/showthread.php?t=499178
  37.  
  38. [X]
  39.  
  40. -Simple /giveallscore and /giveallmoney
  41.  
  42. [X]
  43.  
  44. */
  45. // Includes
  46. #include <a_samp>
  47. #include <YSI\y_ini>
  48. #include <sscanf2>
  49. #include <zcmd>
  50. #include <foreach>
  51. #include <c_cash> //Server sided money
  52. #include <streamer>
  53. //-------------------------------------------
  54.  
  55. // Defines & Colors
  56. #define TEAM_ATTACKERS 1
  57. #define TEAM_DEFENDERS 2
  58. #define dregister 2011
  59. #define dlogin 2012
  60. #define UserPath "Users/%s.ini"
  61. //-------------------------------------------
  62.  
  63.  
  64.  
  65. // Enums
  66. enum PlayerInfo
  67. {
  68. Pass[129],
  69. Adminlevel,
  70. VIPlevel,
  71. Money,
  72. Scores,
  73. Kills,
  74. Deaths
  75. }
  76. new pInfo[MAX_PLAYERS][PlayerInfo];
  77. //------------------------------------------
  78.  
  79.  
  80.  
  81. // Stocks & Forwards & Others
  82.  
  83.  
  84. stock Path(playerid) //Will create a new stock so we can easily use it later to load/save user's data in user's path
  85. {
  86. new str[128],name[MAX_PLAYER_NAME];
  87. GetPlayerName(playerid,name,sizeof(name));
  88. format(str,sizeof(str),UserPath,name);
  89. return str;
  90. }
  91.  
  92. forward loadaccount_user(playerid, name[], value[]);
  93.  
  94. public loadaccount_user(playerid, name[], value[])
  95. {
  96. INI_String("Password", pInfo[playerid][Pass],129);
  97. INI_Int("AdminLevel",pInfo[playerid][Adminlevel]);
  98. INI_Int("VIPLevel",pInfo[playerid][VIPlevel]);
  99. INI_Int("Money",pInfo[playerid][Money]);
  100. INI_Int("Scores",pInfo[playerid][Scores]);e
  101. INI_Int("Kills",pInfo[playerid][Kills]);
  102. INI_Int("Deaths",pInfo[playerid][Deaths]);
  103. return 1;
  104. }
  105. //------------------------------------------
  106. native WP_Hash(buffer[],len,const str[]);
  107.  
  108. main()
  109. {
  110. print("\n----------------------------------");
  111. print(" Blank Gamemode by your name here");
  112. print("----------------------------------\n");
  113. }
  114.  
  115.  
  116. public OnGameModeInit()
  117. {
  118.  
  119. return 1;
  120. }
  121.  
  122. public OnGameModeExit()
  123. {
  124. return 1;
  125. }
  126.  
  127. public OnPlayerRequestClass(playerid, classid)
  128. {
  129. return 1;
  130. }
  131.  
  132. public OnPlayerConnect(playerid)
  133. {
  134. new name[MAX_PLAYER_NAME];
  135. GetPlayerName(playerid,name,sizeof(name));
  136. if(fexist(Path(playerid)))
  137. {
  138. INI_ParseFile(Path(playerid),"loadaccount_%s", .bExtra = true, .extra = playerid);
  139. ShowPlayerDialog(playerid,dlogin,DIALOG_STYLE_INPUT,"Login","Welcome back. This account is registered. \nInsert your password to login to your account","Login","Quit");
  140. }
  141. else
  142. {
  143. ShowPlayerDialog(playerid,dregister,DIALOG_STYLE_INPUT,"Register","Welcome! This account is not registered.\nEnter your own password to create a new account.","Register","Quit");
  144. return 1;
  145. }
  146. return 1;
  147. }
  148.  
  149. public OnPlayerDisconnect(playerid, reason)
  150. {
  151.  
  152. new INI:file = INI_Open(Path(playerid));
  153. INI_SetTag(file,"Player's Data");
  154. INI_WriteInt(file,"AdminLevel",pInfo[playerid][Adminlevel]);
  155. INI_WriteInt(file,"VIPLevel",pInfo[playerid][VIPlevel]);
  156. INI_WriteInt(file,"Money",GetPlayerMoney(playerid));
  157. INI_WriteInt(file,"Scores",GetPlayerScore(playerid));
  158. INI_WriteInt(file,"Kills",pInfo[playerid][Kills]);
  159. INI_WriteInt(file,"Deaths",pInfo[playerid][Deaths]);
  160. INI_Close(file);
  161. return 1;
  162. }
  163.  
  164. public OnPlayerSpawn(playerid)
  165. {
  166. return 1;
  167. }
  168.  
  169. public OnPlayerDeath(playerid, killerid, reason)
  170. {
  171. return 1;
  172. }
  173.  
  174. public OnVehicleSpawn(vehicleid)
  175. {
  176. return 1;
  177. }
  178.  
  179. public OnVehicleDeath(vehicleid, killerid)
  180. {
  181. return 1;
  182. }
  183.  
  184. public OnPlayerText(playerid, text[])
  185. {
  186. return 1;
  187. }
  188.  
  189. public OnPlayerCommandText(playerid, cmdtext[])
  190. {
  191. if (strcmp("/mycommand", cmdtext, true, 10) == 0)
  192. {
  193. // Do something here
  194. return 1;
  195. }
  196. return 0;
  197. }
  198.  
  199. public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
  200. {
  201. return 1;
  202. }
  203.  
  204. public OnPlayerExitVehicle(playerid, vehicleid)
  205. {
  206. return 1;
  207. }
  208.  
  209. public OnPlayerStateChange(playerid, newstate, oldstate)
  210. {
  211. return 1;
  212. }
  213.  
  214. public OnPlayerEnterCheckpoint(playerid)
  215. {
  216. return 1;
  217. }
  218.  
  219. public OnPlayerLeaveCheckpoint(playerid)
  220. {
  221. return 1;
  222. }
  223.  
  224. public OnPlayerEnterRaceCheckpoint(playerid)
  225. {
  226. return 1;
  227. }
  228.  
  229. public OnPlayerLeaveRaceCheckpoint(playerid)
  230. {
  231. return 1;
  232. }
  233.  
  234. public OnRconCommand(cmd[])
  235. {
  236. return 1;
  237. }
  238.  
  239. public OnPlayerRequestSpawn(playerid)
  240. {
  241. return 1;
  242. }
  243.  
  244. public OnObjectMoved(objectid)
  245. {
  246. return 1;
  247. }
  248.  
  249. public OnPlayerObjectMoved(playerid, objectid)
  250. {
  251. return 1;
  252. }
  253.  
  254. public OnPlayerPickUpPickup(playerid, pickupid)
  255. {
  256. return 1;
  257. }
  258.  
  259. public OnVehicleMod(playerid, vehicleid, componentid)
  260. {
  261. return 1;
  262. }
  263.  
  264. public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
  265. {
  266. return 1;
  267. }
  268.  
  269. public OnVehicleRespray(playerid, vehicleid, color1, color2)
  270. {
  271. return 1;
  272. }
  273.  
  274. public OnPlayerSelectedMenuRow(playerid, row)
  275. {
  276. return 1;
  277. }
  278.  
  279. public OnPlayerExitedMenu(playerid)
  280. {
  281. return 1;
  282. }
  283.  
  284. public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
  285. {
  286. return 1;
  287. }
  288.  
  289. public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
  290. {
  291. return 1;
  292. }
  293.  
  294. public OnRconLoginAttempt(ip[], password[], success)
  295. {
  296. return 1;
  297. }
  298.  
  299. public OnPlayerUpdate(playerid)
  300. {
  301. return 1;
  302. }
  303.  
  304. public OnPlayerStreamIn(playerid, forplayerid)
  305. {
  306. return 1;
  307. }
  308.  
  309. public OnPlayerStreamOut(playerid, forplayerid)
  310. {
  311. return 1;
  312. }
  313.  
  314. public OnVehicleStreamIn(vehicleid, forplayerid)
  315. {
  316. return 1;
  317. }
  318.  
  319. public OnVehicleStreamOut(vehicleid, forplayerid)
  320. {
  321. return 1;
  322. }
  323.  
  324. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  325. {
  326. if(dialogid == dregister)
  327. {
  328. if(!response) return Kick(playerid);
  329. if(response)
  330. {
  331. if(!strlen(inputtext)) /
  332. {
  333. ShowPlayerDialog(playerid,dregister,DIALOG_STYLE_INPUT,"Register","Welcome! This account is not registered.\nEnter your own password to create a new account.\nPlease enter the password!","Register","Quit");
  334. return 1;
  335. }
  336.  
  337. new hashpass[129];
  338. WP_Hash(hashpass,sizeof(hashpass),inputtext);
  339. new INI:file = INI_Open(Path(playerid));
  340. INI_SetTag(file,"Player's Data");
  341. INI_WriteString(file,"Password",hashpass);
  342. INI_WriteInt(file,"AdminLevel",0);
  343. INI_WriteInt(file,"VIPLevel",0);
  344. INI_WriteInt(file,"Money",0);
  345. INI_WriteInt(file,"Scores",0);
  346. INI_WriteInt(file,"Kills",0);
  347. INI_WriteInt(file,"Deaths",0);
  348. INI_Close(file);
  349. SendClientMessage(playerid,-1,"You have been successfully registered");
  350. return 1;
  351. }
  352. }
  353. if(dialogid == dlogin)
  354. {
  355. if(!response) return Kick(playerid);
  356. if(response)
  357. {
  358. new hashpass[129];
  359. WP_Hash(hashpass,sizeof(hashpass),inputtext);
  360. if(!strcmp(hashpass, pInfo[playerid][Pass], false))
  361. {
  362. INI_ParseFile(Path(playerid),"loadaccount_%s",.bExtra = true, .extra = playerid);
  363. SetPlayerScore(playerid,pInfo[playerid][Scores]);
  364. GivePlayerMoney(playerid,pInfo[playerid][Money]);/
  365. SendClientMessage(playerid,-1,"Welcome back! You have successfully logged in");
  366. }
  367. else
  368. {
  369. ShowPlayerDialog(playerid,dlogin,DIALOG_STYLE_INPUT,"Login","Welcome back. This account is registered. \nInsert your password to login to your account.\nIncorrect password!","Login","Quit");
  370. return 1;
  371. }
  372. }
  373. }
  374. return 1;
  375. }
  376.  
  377. public OnPlayerClickPlayer(playerid, clickedplayerid, source)
  378. {
  379. return 1;
  380. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement