Advertisement
Guest User

Untitled

a guest
Jul 30th, 2011
1,994
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 10.57 KB | None | 0 0
  1. /*==============================================================================
  2.  
  3. ==============================================================================*/
  4. /*==============================================================================
  5.  
  6. ==============================================================================*/
  7. #include <a_samp>
  8. #include <SII>
  9. #include <zcmd>
  10. #include <sscanf2>
  11. /*==============================================================================
  12.  
  13. ==============================================================================*/
  14. #define COLOR_GREY 0xAFAFAFAA
  15. #define COLOR_LIGHTBLUE 0x33CCFFAA
  16.  
  17. #define WHITE "{FFFFFF}"
  18. #define RED "{F81414}"
  19. #define GREEN "{00FF22}"
  20. #define LIGHTBLUE "{00CED1}"
  21. #define ORANGE "{FFAF00}"
  22. #define BLUE "{0025E1}"
  23. #define PURPLE "{FF00FF}"
  24. /*==============================================================================
  25.  
  26. ==============================================================================*/
  27. #define DIALOG_REGISTER 2000
  28. #define DIALOG_LOGIN 2001
  29. /*==============================================================================
  30.  
  31. ==============================================================================*/
  32. enum pInfo
  33. {
  34. pPass,
  35. pAdmin,
  36. pCash,
  37. pKills,
  38. pDeaths
  39. }
  40. new PlayerInfo[MAX_PLAYERS][pInfo];
  41. new gPlayerName[MAX_PLAYERS][MAX_PLAYER_NAME];
  42. /*==============================================================================
  43.  
  44. ==============================================================================*/
  45. stock getINI(playerid)
  46. {
  47. new account[64];
  48. format(account,30,"Users/%s.ini",gPlayerName[playerid]);
  49. return account;
  50. }
  51. /*==============================================================================
  52.  
  53. ==============================================================================*/
  54. main()
  55. {
  56. print("\n----------------------------------");
  57. print(" Blank Gamemode by your name here");
  58. print("----------------------------------\n");
  59. }
  60.  
  61. public OnGameModeInit()
  62. {
  63. return 1;
  64. }
  65.  
  66. public OnGameModeExit()
  67. {
  68. return 1;
  69. }
  70.  
  71. public OnPlayerRequestClass(playerid, classid)
  72. {
  73. return 1;
  74. }
  75.  
  76. public OnPlayerConnect(playerid)
  77. {
  78. GetPlayerName(playerid, gPlayerName[playerid], MAX_PLAYER_NAME);
  79. if (fexist(getINI(playerid)))
  80. {
  81. ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,""WHITE"Login",""WHITE"Type your password below to login.","Login","Quit");
  82. }
  83. else
  84. {
  85. ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT,""WHITE"Registering...",""WHITE"Type your password below to register a new account.","Register","Quit");
  86. }
  87. return 1;
  88. }
  89.  
  90. public OnPlayerDisconnect(playerid, reason)
  91. {
  92. if(INI_Open(getINI(playerid))) {
  93.  
  94. INI_WriteInt("Admin",PlayerInfo[playerid][pAdmin]);
  95. INI_WriteInt("Cash",GetPlayerMoney(playerid));
  96. INI_WriteInt("Kills",PlayerInfo[playerid][pKills]);
  97. INI_WriteInt("Deaths",PlayerInfo[playerid][pDeaths]);
  98. INI_Save();
  99. INI_Close();
  100. }
  101. return 1;
  102. }
  103.  
  104. public OnPlayerSpawn(playerid)
  105. {
  106. return 1;
  107. }
  108.  
  109. public OnPlayerDeath(playerid, killerid, reason)
  110. {
  111. PlayerInfo[killerid][pKills]++;
  112. PlayerInfo[playerid][pDeaths]++;
  113. GivePlayerMoney(killerid,1000);
  114. GivePlayerMoney(playerid,-1000);
  115. return 1;
  116. }
  117.  
  118. public OnVehicleSpawn(vehicleid)
  119. {
  120. return 1;
  121. }
  122.  
  123. public OnVehicleDeath(vehicleid, killerid)
  124. {
  125. return 1;
  126. }
  127.  
  128. public OnPlayerText(playerid, text[])
  129. {
  130. return 1;
  131. }
  132.  
  133. public OnPlayerCommandText(playerid, cmdtext[])
  134. {
  135. if (strcmp("/mycommand", cmdtext, true, 10) == 0)
  136. {
  137. // Do something here
  138. return 1;
  139. }
  140. return 0;
  141. }
  142.  
  143. public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
  144. {
  145. return 1;
  146. }
  147.  
  148. public OnPlayerExitVehicle(playerid, vehicleid)
  149. {
  150. return 1;
  151. }
  152.  
  153. public OnPlayerStateChange(playerid, newstate, oldstate)
  154. {
  155. return 1;
  156. }
  157.  
  158. public OnPlayerEnterCheckpoint(playerid)
  159. {
  160. return 1;
  161. }
  162.  
  163. public OnPlayerLeaveCheckpoint(playerid)
  164. {
  165. return 1;
  166. }
  167.  
  168. public OnPlayerEnterRaceCheckpoint(playerid)
  169. {
  170. return 1;
  171. }
  172.  
  173. public OnPlayerLeaveRaceCheckpoint(playerid)
  174. {
  175. return 1;
  176. }
  177.  
  178. public OnRconCommand(cmd[])
  179. {
  180. return 1;
  181. }
  182.  
  183. public OnPlayerRequestSpawn(playerid)
  184. {
  185. return 1;
  186. }
  187.  
  188. public OnObjectMoved(objectid)
  189. {
  190. return 1;
  191. }
  192.  
  193. public OnPlayerObjectMoved(playerid, objectid)
  194. {
  195. return 1;
  196. }
  197.  
  198. public OnPlayerPickUpPickup(playerid, pickupid)
  199. {
  200. return 1;
  201. }
  202.  
  203. public OnVehicleMod(playerid, vehicleid, componentid)
  204. {
  205. return 1;
  206. }
  207.  
  208. public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
  209. {
  210. return 1;
  211. }
  212.  
  213. public OnVehicleRespray(playerid, vehicleid, color1, color2)
  214. {
  215. return 1;
  216. }
  217.  
  218. public OnPlayerSelectedMenuRow(playerid, row)
  219. {
  220. return 1;
  221. }
  222.  
  223. public OnPlayerExitedMenu(playerid)
  224. {
  225. return 1;
  226. }
  227.  
  228. public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
  229. {
  230. return 1;
  231. }
  232.  
  233. public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
  234. {
  235. return 1;
  236. }
  237.  
  238. public OnRconLoginAttempt(ip[], password[], success)
  239. {
  240. return 1;
  241. }
  242.  
  243. public OnPlayerUpdate(playerid)
  244. {
  245. return 1;
  246. }
  247.  
  248. public OnPlayerStreamIn(playerid, forplayerid)
  249. {
  250. return 1;
  251. }
  252.  
  253. public OnPlayerStreamOut(playerid, forplayerid)
  254. {
  255. return 1;
  256. }
  257.  
  258. public OnVehicleStreamIn(vehicleid, forplayerid)
  259. {
  260. return 1;
  261. }
  262.  
  263. public OnVehicleStreamOut(vehicleid, forplayerid)
  264. {
  265. return 1;
  266. }
  267.  
  268. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  269. {
  270. switch( dialogid )
  271. {
  272. case DIALOG_REGISTER:
  273. {
  274. if (!response) return Kick(playerid);
  275. if (response)
  276. {
  277.  
  278. if(!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, ""WHITE"Registering...",""RED"You have entered an invalid password.\n"WHITE"Type your password below to register a new account.","Register","Quit");
  279.  
  280. if(INI_Open(getINI(playerid))) {
  281. INI_WriteString("Password",inputtext);
  282. INI_WriteInt("Admin",0);
  283. INI_WriteInt("Cash",0);
  284. INI_WriteInt("Kills",0);
  285. INI_WriteInt("Deaths",0);
  286.  
  287. INI_Save();
  288. INI_Close();
  289.  
  290. ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,""WHITE"Login",""WHITE"Type your password below to login.","Login","Quit");
  291. }
  292. }
  293. }
  294.  
  295. case DIALOG_LOGIN:
  296. {
  297. if ( !response ) return Kick ( playerid );
  298. if( response )
  299. {
  300.  
  301. if(!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT, ""WHITE"Login",""RED"You have entered an invalid password.\n"WHITE"Type your password below to login.","Login","Quit");
  302.  
  303. if(INI_Open(getINI(playerid))) {
  304. INI_ReadString(PlayerInfo[playerid][pPass],"Password",20);
  305.  
  306. if(strcmp(inputtext,PlayerInfo[playerid][pPass],false)) {
  307. ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT, ""WHITE"Login",""RED"You have entered an incorrect password.\n"WHITE"Type your password below to login.","Login","Quit");
  308. }
  309. else {
  310. ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,""WHITE"Login",""WHITE"Type your password below to login.","Login","Quit");
  311. }
  312.  
  313. PlayerInfo[playerid][pAdmin] = INI_ReadInt("Admin");
  314. GivePlayerMoney( playerid, INI_ReadInt( "Cash" ) );
  315. PlayerInfo[playerid][pKills] = INI_ReadInt("Kills");
  316. PlayerInfo[playerid][pDeaths] = INI_ReadInt("Deaths");
  317.  
  318. INI_Close();
  319. }
  320. }
  321. }
  322. }
  323. return 1;
  324. }
  325.  
  326. public OnPlayerClickPlayer(playerid, clickedplayerid, source)
  327. {
  328. return 1;
  329. }
  330.  
  331. /*==============================================================================
  332. ZCMD and Sscanf2...
  333. Credits to Y_Less and Zeexs
  334. ==============================================================================*/
  335. CMD:godmodeon(playerid, params[])
  336. {
  337. if(PlayerInfo[playerid][pAdmin] >= 1)
  338. {
  339. SetPlayerHealth(playerid, 10000000);
  340. SetPlayerArmour(playerid, 10000000);
  341. }
  342. else
  343. {
  344. SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use that command!");
  345. }
  346. return 1;
  347. }
  348.  
  349. CMD:godmodeoff(playerid, params[])
  350. {
  351. if(PlayerInfo[playerid][pAdmin] >= 1)
  352. {
  353. SetPlayerHealth(playerid, 100);
  354. SetPlayerArmour(playerid, 100);
  355. }
  356. else
  357. {
  358. SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use that command!");
  359. }
  360. return 1;
  361. }
  362.  
  363. CMD:teleport(playerid, params[])
  364. {
  365. if(PlayerInfo[playerid][pAdmin] >= 1)
  366. {
  367. new ID;
  368. if(sscanf(params, "u", ID)) SendClientMessage(playerid, COLOR_GREY, "USAGE: /tele [playerid]");
  369. else if(IsPlayerConnected(ID) == 0) SendClientMessage(playerid, COLOR_GREY, "Player is not connected!");
  370. else
  371. {
  372. new Float:x, Float:y, Float:z;
  373. GetPlayerPos(playerid, x, y, z);
  374. SetPlayerPos(ID, x+1, y+1, z);
  375. }
  376. }
  377. else
  378. {
  379. SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use that command!");
  380. }
  381. return 1;
  382. }
  383.  
  384. CMD:goto(playerid, params[])
  385. {
  386. if(PlayerInfo[playerid][pAdmin] >= 1)
  387. {
  388. new ID;
  389. if(sscanf(params, "u", ID)) SendClientMessage(playerid, COLOR_GREY, "USAGE: /goto [playerid]");
  390. else if(IsPlayerConnected(ID) == 0) SendClientMessage(playerid, COLOR_GREY, "Player is not connected!");
  391. else
  392. {
  393. new Float:x, Float:y, Float:z;
  394. GetPlayerPos(ID, x, y, z);
  395. SetPlayerPos(playerid, x+1, y+1, z);
  396. }
  397. }
  398. else
  399. {
  400. SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use that command!");
  401. }
  402. return 1;
  403. }
  404.  
  405. CMD:kick(playerid, params[])
  406. {
  407. if(PlayerInfo[playerid][pAdmin] >= 1)
  408. {
  409. new PID, pName[MAX_PLAYER_NAME], Sender[MAX_PLAYER_NAME];
  410. if(sscanf(params, "u", PID)) return SendClientMessage(playerid, COLOR_GREY, "USAGE: /kick [playerid]");
  411. if(!IsPlayerConnected(PID)) return SendClientMessage(playerid, COLOR_GREY, "Player is not connected!");
  412.  
  413. new Str[128];
  414. GetPlayerName(PID, pName, sizeof(pName));
  415. GetPlayerName(playerid, Sender, sizeof(Sender));
  416.  
  417. format(Str, sizeof(Str), "You kicked %s!", pName);
  418. SendClientMessage(playerid, COLOR_LIGHTBLUE, Str);
  419. Kick(PID);
  420.  
  421. }
  422. else
  423. {
  424. SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use that command!");
  425. }
  426. return 1;
  427. }
  428.  
  429. CMD:makemeadmin(playerid, params[])
  430. {
  431. if(IsPlayerAdmin(playerid))
  432. {
  433. PlayerInfo[playerid][pAdmin] = 1;
  434. SendClientMessage(playerid, COLOR_LIGHTBLUE, "You have made yourself an Admin!");
  435. }
  436. else
  437. {
  438. SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use that command!");
  439. }
  440. return 1;
  441. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement