Guest User

Sistema De UP - NewSAMP/Lucas totola

a guest
Jan 31st, 2013
1,232
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.40 KB | None | 0 0
  1. #include <a_samp>
  2. #include <DOF2>
  3.  
  4. #define LEVEL "Level/%s.ini" //PASTA PARA SALVAR O LEVEL.
  5. #define SEGUNDOSLEVEL 3600 //TROQUE PARA OS SEGUNDOS DESEJADOS, 3600 SEGUNDOS = 1 HORA
  6.  
  7. enum Info
  8. {
  9. pSegundos,
  10. pLevel
  11. };
  12. new PlayerInfo[MAX_PLAYERS][Info];
  13. new segundos;
  14.  
  15. public OnFilterScriptInit()
  16. {
  17. print("\n-----------------CARREGADO-----------------");
  18. print(" Sistema de Level UP/HorasJogadas/Salario");
  19. print("----------------LucasTotola----------------\n");
  20.  
  21. segundos = SetTimer("SegundoaMais",1000,1);
  22. return 1;
  23. }
  24.  
  25. public OnFilterScriptExit()
  26. {
  27. print("\n---------------DESCARREGADO----------------");
  28. print(" Sistema de Level UP/HorasJogadas/Salario");
  29. print("----------------LucasTotola----------------\n");
  30. KillTimer(segundos);
  31. DOF2_Exit();
  32. return 1;
  33. }
  34.  
  35. public OnPlayerDisconnect(playerid)
  36. {
  37. new arquivo[34], playername[MAX_PLAYER_NAME];
  38. GetPlayerName(playerid, playername, sizeof(playername));
  39. format(arquivo, sizeof(arquivo), LEVEL, playername);
  40. if(DOF2_FileExists(arquivo))
  41. {
  42. DOF2_SetInt(arquivo, "Segundos", PlayerInfo[playerid][pSegundos]);
  43. DOF2_SetInt(arquivo, "Level", PlayerInfo[playerid][pLevel]);
  44. DOF2_SaveFile();
  45. }
  46. else
  47. {
  48. DOF2_CreateFile(arquivo);
  49. DOF2_SetInt(arquivo, "Segundos", PlayerInfo[playerid][pSegundos]);
  50. DOF2_SetInt(arquivo, "Level", PlayerInfo[playerid][pLevel]);
  51. DOF2_SaveFile();
  52. }
  53. return 1;
  54. }
  55.  
  56. public OnPlayerConnect(playerid)
  57. {
  58. new arquivo[34], playername[MAX_PLAYER_NAME];
  59. GetPlayerName(playerid, playername, sizeof(playername));
  60. format(arquivo, sizeof(arquivo), LEVEL, playername);
  61. PlayerInfo[playerid][pSegundos] = DOF2_GetInt(arquivo, "Segundos");
  62. PlayerInfo[playerid][pLevel] = DOF2_GetInt(arquivo, "Level");
  63. return 1;
  64. }
  65.  
  66. forward SegundoaMais();
  67. public SegundoaMais()
  68. {
  69. for(new i = 0; i < MAX_PLAYERS; i++)
  70. {
  71. PlayerInfo[i][pSegundos] ++;
  72. if(PlayerInfo[i][pSegundos] >= SEGUNDOSLEVEL)
  73. {
  74. PlayerInfo[i][pSegundos] = 0;
  75. LevelUP(i);
  76. }
  77. }
  78. return 1;
  79. }
  80.  
  81. LevelUP(playerid)
  82. {
  83. PlayerInfo[playerid][pLevel] ++;
  84. GivePlayerMoney(playerid, 50000);
  85. GameTextForPlayer(playerid, "~w~Level ~p~UP", 2000, 1);
  86. // COLOQUE AQUI AS FUNÇÕES QUE DESEJA NO SEU "LEVEL UP"
  87. }
Advertisement
Add Comment
Please, Sign In to add comment