Guest User

Untitled

a guest
Sep 7th, 2011
1,388
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 7.17 KB | None | 0 0
  1. /* Credits to: Jafet Macario - made this
  2.                Double-O-Seven for Double-O-Files_2 (DOF2)*/
  3.  
  4. #include <a_samp>
  5. #include <Double-O-Files_2>
  6.  
  7. #define DIALOG_REGISTER 1
  8. #define DIALOG_LOGIN 2
  9. main()
  10. {
  11.     print("\n----------------------------------");
  12.     print(" Blank Gamemode DOF2");
  13.     print("----------------------------------\n");
  14. }
  15.  
  16. public OnGameModeInit()
  17. {
  18.     SetGameModeText("Blank Script DOF2");
  19.     return 1;
  20. }
  21. enum pInfo
  22. {
  23.     pKills,
  24.     pDeaths,
  25.     pMoney,
  26.     pAdmin
  27. }
  28. new PlayerInfo[MAX_PLAYERS][pInfo];
  29. //----------------------
  30.  
  31. public OnGameModeExit()
  32. {
  33.     DOF2_Exit();
  34.     return 1;
  35. }
  36.  
  37. public OnPlayerRequestClass(playerid, classid)
  38. {
  39.     return 1;
  40. }
  41.  
  42. public OnPlayerConnect(playerid)
  43. {
  44.     new file[64];
  45.     GetPlayerName(playerid,file,sizeof(file));
  46.     format(file,sizeof(file),DOF2_File(file));// Here we get the path from DOF2_File (/Users)
  47.     if(DOF2_FileExists(file)) // We check if the player is registered
  48.     {
  49.         ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,"Welcome.Please log-in","{FFFFFF}Type your {00FF22}password {FFFFFF}here to log-in","Log-in","Quit");
  50.     }
  51.     else // If not registered
  52.     {
  53.         ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT,"Please register!","{FFFFFF}Type your {00FF22}password {FFFFFF}here to register.","Register","Quit");
  54.     }
  55.     return 1;
  56. }
  57. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  58. {
  59.     switch(dialogid) // We switch the dialogs
  60.     {
  61.         case DIALOG_REGISTER: // If dialog_register (id 1) shows up
  62.         {
  63.             if(!response) Kick(playerid); // If he click on Quit, he will get kicked
  64.             if(!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT,"Please register!","{FFFFFF}Type your {00FF22}password {FFFFFF}here to register.","Register","Quit");
  65.             // If he doesn't type anything, the dialog will show again.
  66.             if(response) // If he click on Register
  67.             {
  68.                 new file[64]; // We declare the size of the file
  69.                 GetPlayerName(playerid,file,sizeof(file)); // We get the file name
  70.                 format(file,sizeof(file),DOF2_File(file)); // We get the path name from DOF2_File, that means from Users folder.
  71.                 DOF2_CreateFile(file, inputtext); // Creates the file and the password.
  72.                 DOF2_SetInt(file, "Kills",PlayerInfo[playerid][pKills] = 0); // When the player register his kills will be set to 0, you can change
  73.                 DOF2_SetInt(file, "Deaths",PlayerInfo[playerid][pDeaths] = 0); // His deaths will be set to 0, you can change
  74.                 DOF2_SetInt(file, "Money",PlayerInfo[playerid][pMoney] = 1000); // His money will be set to 1000, you can change
  75.                 DOF2_SetInt(file, "AdminLevel",PlayerInfo[playerid][pAdmin] = 0); // His Admin Level will be set to 0, you can change
  76.                 DOF2_SaveFile(); // Saves the file.
  77.                 SetSpawnInfo(playerid, 0, 0, 1722.5123, -1912.7931, 13.5647, 269.15, 0, 0, 0, 0, 0, 0); // Sets where the player will spawn, this coordinates are from the Unity Station in Los Santos
  78.                 SpawnPlayer(playerid); // After registering, the player will spawn.
  79.             }
  80.         }
  81.         case DIALOG_LOGIN: // If dialog_login (id 2) shows up
  82.         {
  83.             if(!response) Kick(playerid); // If he click on Quit, he will get kicked.
  84.             if(response) // If he click on Log-in
  85.             {
  86.                 new file[64]; // We declare the size of the file
  87.                 GetPlayerName(playerid,file,sizeof(file)); // We get the file name
  88.                 format(file,sizeof(file),DOF2_File(file)); // We get the user path from DOF2_File ( folder Users )
  89.                 if(DOF2_FileExists(file)) // If he is registered
  90.                 {
  91.                     if(DOF2_CheckLogin(file,inputtext)) // We check if the password match
  92.                     {
  93.                         PlayerInfo[playerid][pKills] = DOF2_GetInt(file,"Kills"); // We load our settings
  94.                         PlayerInfo[playerid][pDeaths] = DOF2_GetInt(file,"Deaths");
  95.                         PlayerInfo[playerid][pMoney] = DOF2_GetInt(file,"Money");
  96.                         PlayerInfo[playerid][pAdmin] = DOF2_GetInt(file,"AdminLevel");
  97.                         SetSpawnInfo(playerid, 0, 0, 1722.5123, -1912.7931, 13.5647, 269.15, 0, 0, 0, 0, 0, 0); // We set the spawn (Unity Station)
  98.                         SpawnPlayer(playerid); // The player spawns after log-in
  99.                         return 1;
  100.                     }
  101.                     else // If the password don't match, they will get an error
  102.                     {
  103.                         ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,"Wrong Password!","{F81414}You have typed a wrong password\n{FFFFFF}Type your password here to log-in!","Log-in","Quit");
  104.                         return 1;
  105.                     }
  106.                 }
  107.             }
  108.         }
  109.     }
  110.     return 1;
  111. }
  112. public OnPlayerDisconnect(playerid, reason)
  113. {
  114.     new file[64]; // We declare the size of the file
  115.     GetPlayerName(playerid,file,sizeof(file)); // We get the file name
  116.     format(file,sizeof(file),DOF2_File(file));// We get the user path from DOF2_File (folder Users)
  117.     DOF2_SetInt(file, "Kills",PlayerInfo[playerid][pKills]); // We set/update the players settings.
  118.     DOF2_SetInt(file, "Deaths",PlayerInfo[playerid][pDeaths]);
  119.     DOF2_SetInt(file, "Money",PlayerInfo[playerid][pMoney]);
  120.     DOF2_SetInt(file, "AdminLevel",PlayerInfo[playerid][pAdmin]);
  121.     return 1;
  122. }
  123.  
  124. public OnPlayerSpawn(playerid)
  125. {
  126.     GivePlayerMoney(playerid, PlayerInfo[playerid][pMoney]);
  127.     return 1;
  128. }
  129.  
  130. public OnPlayerDeath(playerid, killerid, reason)
  131. {
  132.     PlayerInfo[killerid][pKills]++;
  133.     PlayerInfo[playerid][pDeaths]++;
  134.     return 1;
  135. }
  136.  
  137. public OnVehicleSpawn(vehicleid)
  138. {
  139.     return 1;
  140. }
  141.  
  142. public OnVehicleDeath(vehicleid, killerid)
  143. {
  144.     return 1;
  145. }
  146.  
  147. public OnPlayerText(playerid, text[])
  148. {
  149.     return 1;
  150. }
  151.  
  152. public OnPlayerCommandText(playerid, cmdtext[])
  153. {
  154.     if (strcmp("/mycommand", cmdtext, true, 10) == 0)
  155.     {
  156.         // Do something here
  157.         return 1;
  158.     }
  159.     return 0;
  160. }
  161.  
  162. public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
  163. {
  164.     return 1;
  165. }
  166.  
  167. public OnPlayerExitVehicle(playerid, vehicleid)
  168. {
  169.     return 1;
  170. }
  171.  
  172. public OnPlayerStateChange(playerid, newstate, oldstate)
  173. {
  174.     return 1;
  175. }
  176.  
  177. public OnPlayerEnterCheckpoint(playerid)
  178. {
  179.     return 1;
  180. }
  181.  
  182. public OnPlayerLeaveCheckpoint(playerid)
  183. {
  184.     return 1;
  185. }
  186.  
  187. public OnPlayerEnterRaceCheckpoint(playerid)
  188. {
  189.     return 1;
  190. }
  191.  
  192. public OnPlayerLeaveRaceCheckpoint(playerid)
  193. {
  194.     return 1;
  195. }
  196.  
  197. public OnRconCommand(cmd[])
  198. {
  199.     return 1;
  200. }
  201.  
  202. public OnPlayerRequestSpawn(playerid)
  203. {
  204.     return 1;
  205. }
  206.  
  207. public OnObjectMoved(objectid)
  208. {
  209.     return 1;
  210. }
  211.  
  212. public OnPlayerObjectMoved(playerid, objectid)
  213. {
  214.     return 1;
  215. }
  216.  
  217. public OnPlayerPickUpPickup(playerid, pickupid)
  218. {
  219.     return 1;
  220. }
  221.  
  222. public OnVehicleMod(playerid, vehicleid, componentid)
  223. {
  224.     return 1;
  225. }
  226.  
  227. public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
  228. {
  229.     return 1;
  230. }
  231.  
  232. public OnVehicleRespray(playerid, vehicleid, color1, color2)
  233. {
  234.     return 1;
  235. }
  236.  
  237. public OnPlayerSelectedMenuRow(playerid, row)
  238. {
  239.     return 1;
  240. }
  241.  
  242. public OnPlayerExitedMenu(playerid)
  243. {
  244.     return 1;
  245. }
  246.  
  247. public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
  248. {
  249.     return 1;
  250. }
  251.  
  252. public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
  253. {
  254.     return 1;
  255. }
  256.  
  257.  
  258. public OnPlayerUpdate(playerid)
  259. {
  260.     return 1;
  261. }
  262.  
  263. public OnPlayerStreamIn(playerid, forplayerid)
  264. {
  265.     return 1;
  266. }
  267.  
  268. public OnPlayerStreamOut(playerid, forplayerid)
  269. {
  270.     return 1;
  271. }
  272.  
  273. public OnVehicleStreamIn(vehicleid, forplayerid)
  274. {
  275.     return 1;
  276. }
  277.  
  278. public OnVehicleStreamOut(vehicleid, forplayerid)
  279. {
  280.     return 1;
  281. }
  282.  
  283. public OnPlayerClickPlayer(playerid, clickedplayerid, source)
  284. {
  285.     return 1;
  286. }
Advertisement
Add Comment
Please, Sign In to add comment