Advertisement
Guest User

Untitled

a guest
Sep 24th, 2017
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 5.92 KB | None | 0 0
  1. #include <a_samp>
  2. #include <SII>
  3.  
  4. #define DIALOG_REGISTER 2000
  5. #define DIALOG_LOGIN 2001
  6.  
  7. #define WHITE "{FFFFFF}"
  8. #define RED "{F81414}"
  9. #define GREEN "{00FF22}"
  10. #define LIGHTBLUE "{00CED1}"
  11.  
  12. enum pInfo
  13. {
  14.     pPass,
  15.     pScore,
  16.     pCash,
  17.     pAdmin,
  18. }
  19.  
  20. new gPlayerName[MAX_PLAYERS][MAX_PLAYER_NAME];
  21. new PlayerInfo[MAX_PLAYERS][pInfo];
  22.  
  23. stock getINI(playerid)
  24. {
  25.     new account[64];
  26.     format(account,30,"Users/%s.ini",gPlayerName[playerid]);
  27.    
  28.     return account;
  29. }
  30.  
  31. main()
  32. {
  33.     print("\n----------------------------------");
  34.     print(" Blank Gamemode by your name here");
  35.     print("----------------------------------\n");
  36. }
  37.  
  38. public OnGameModeInit()
  39. {
  40.     SetGameModeText("Blank Script");
  41.     AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
  42.    
  43.     return 1;
  44. }
  45.  
  46. public OnGameModeExit()
  47. {
  48.  
  49.     return 1;
  50. }
  51.  
  52. public OnPlayerRequestClass(playerid, classid)
  53. {
  54.     SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
  55.     SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
  56.     SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
  57.    
  58.     return 1;
  59. }
  60.  
  61. public OnPlayerConnect(playerid)
  62. {
  63.     GetPlayerName(playerid, gPlayerName[playerid], MAX_PLAYER_NAME);
  64.     if (fexist(getINI(playerid)))
  65.     {
  66.         ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,""WHITE"Login",""WHITE"Type your password below to login.","Login","Quit");
  67.     }
  68.     else
  69.     {
  70.         ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT,""WHITE"Registering...",""WHITE"Type your password below to register a new account.","Register","Quit");
  71.     }
  72.    
  73.     return 1;
  74. }
  75.  
  76. public OnPlayerDisconnect(playerid, reason)
  77. {
  78.     if(INI_Open(getINI(playerid)))
  79.     {
  80.  
  81.         INI_WriteInt("Score",PlayerInfo[playerid][pScore]);
  82.         INI_WriteInt("Cash",PlayerInfo[playerid][pCash]);
  83.         INI_WriteInt("Admin",PlayerInfo[playerid][pAdmin]);
  84.         INI_Save();
  85.         INI_Close();
  86.     }
  87.    
  88.     return 1;
  89. }
  90.  
  91. public OnPlayerSpawn(playerid)
  92. {
  93.  
  94.     return 1;
  95. }
  96.  
  97. public OnPlayerDeath(playerid, killerid, reason)
  98. {
  99.  
  100.     return 1;
  101. }
  102.  
  103. public OnVehicleSpawn(vehicleid)
  104. {
  105.  
  106.     return 1;
  107. }
  108.  
  109. public OnVehicleDeath(vehicleid, killerid)
  110. {
  111.  
  112.     return 1;
  113. }
  114.  
  115. public OnPlayerText(playerid, text[])
  116. {
  117.  
  118.     return 1;
  119. }
  120.  
  121. public OnPlayerCommandText(playerid, cmdtext[])
  122. {
  123.     if (strcmp("/mycommand", cmdtext, true, 10) == 0)
  124.     {
  125.         // Do something here
  126.         return 1;
  127.     }
  128.    
  129.     return 0;
  130. }
  131.  
  132. public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
  133. {
  134.  
  135.     return 1;
  136. }
  137.  
  138. public OnPlayerExitVehicle(playerid, vehicleid)
  139. {
  140.  
  141.     return 1;
  142. }
  143.  
  144. public OnPlayerStateChange(playerid, newstate, oldstate)
  145. {
  146.  
  147.     return 1;
  148. }
  149.  
  150. public OnPlayerEnterCheckpoint(playerid)
  151. {
  152.  
  153.     return 1;
  154. }
  155.  
  156. public OnPlayerLeaveCheckpoint(playerid)
  157. {
  158.  
  159.     return 1;
  160. }
  161.  
  162. public OnPlayerEnterRaceCheckpoint(playerid)
  163. {
  164.  
  165.     return 1;
  166. }
  167.  
  168. public OnPlayerLeaveRaceCheckpoint(playerid)
  169. {
  170.  
  171.     return 1;
  172. }
  173.  
  174. public OnRconCommand(cmd[])
  175. {
  176.  
  177.     return 1;
  178. }
  179.  
  180. public OnPlayerRequestSpawn(playerid)
  181. {
  182.  
  183.     return 1;
  184. }
  185.  
  186. public OnObjectMoved(objectid)
  187. {
  188.  
  189.     return 1;
  190. }
  191.  
  192. public OnPlayerObjectMoved(playerid, objectid)
  193. {
  194.  
  195.     return 1;
  196. }
  197.  
  198. public OnPlayerPickUpPickup(playerid, pickupid)
  199. {
  200.  
  201.     return 1;
  202. }
  203.  
  204. public OnVehicleMod(playerid, vehicleid, componentid)
  205. {
  206.  
  207.     return 1;
  208. }
  209.  
  210. public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
  211. {
  212.  
  213.     return 1;
  214. }
  215.  
  216. public OnVehicleRespray(playerid, vehicleid, color1, color2)
  217. {
  218.  
  219.     return 1;
  220. }
  221.  
  222. public OnPlayerSelectedMenuRow(playerid, row)
  223. {
  224.  
  225.     return 1;
  226. }
  227.  
  228. public OnPlayerExitedMenu(playerid)
  229. {
  230.  
  231.     return 1;
  232. }
  233.  
  234. public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
  235. {
  236.  
  237.     return 1;
  238. }
  239.  
  240. public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
  241. {
  242.  
  243.     return 1;
  244. }
  245.  
  246. public OnRconLoginAttempt(ip[], password[], success)
  247. {
  248.  
  249.     return 1;
  250. }
  251.  
  252. public OnPlayerUpdate(playerid)
  253. {
  254.  
  255.     return 1;
  256. }
  257.  
  258. public OnPlayerStreamIn(playerid, forplayerid)
  259. {
  260.  
  261.     return 1;
  262. }
  263.  
  264. public OnPlayerStreamOut(playerid, forplayerid)
  265. {
  266.  
  267.     return 1;
  268. }
  269.  
  270. public OnVehicleStreamIn(vehicleid, forplayerid)
  271. {
  272.  
  273.     return 1;
  274. }
  275.  
  276. public OnVehicleStreamOut(vehicleid, forplayerid)
  277. {
  278.  
  279.     return 1;
  280. }
  281.  
  282. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  283. {
  284.     switch( dialogid )
  285.     {
  286.         case DIALOG_REGISTER:
  287.         {
  288.             if(!response) return Kick(playerid);
  289.             if(response)
  290.             {
  291.                 if(!strlen(inputtext))
  292.                 {
  293.                     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");
  294.                 }
  295.                
  296.                 if(INI_Open(getINI(playerid)))
  297.                 {
  298.                     INI_WriteString("Password",inputtext);
  299.                     INI_WriteInt("Score",1);
  300.                     INI_WriteInt("Cash",5000);
  301.                     INI_WriteInt("Admin",0);
  302.  
  303.                     INI_Save();
  304.                     INI_Close();
  305.  
  306.                     ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,""WHITE"Login",""WHITE"Type your password below to login.","Login","Quit");
  307.                 }
  308.             }
  309.         }
  310.         case DIALOG_LOGIN:
  311.         {
  312.             if(!response) return Kick(playerid);
  313.             if(response)
  314.             {
  315.                 if(!strlen(inputtext))
  316.                 {
  317.                     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");
  318.                 }
  319.                 if(INI_Open(getINI(playerid)))
  320.                 {
  321.                     INI_ReadString(PlayerInfo[playerid][pPass],"Password",20);
  322.  
  323.                     if(strcmp(inputtext,PlayerInfo[playerid][pPass],false))
  324.                     {
  325.                         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");
  326.                     }
  327.                     SetPlayerScore(playerid,INI_ReadInt("Score"));
  328.                     ResetPlayerMoney(playerid);
  329.                     GivePlayerMoney(playerid,INI_ReadInt("Cash"));
  330.                     PlayerInfo[playerid][pAdmin] = INI_ReadInt("Admin");
  331.                     INI_Close();
  332.                 }
  333.             }
  334.         }
  335.     }
  336.    
  337.     return 1;
  338. }
  339.  
  340. public OnPlayerClickPlayer(playerid, clickedplayerid, source)
  341. {
  342.  
  343.     return 1;
  344. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement