StraliotiF

GameMode Treino de Tiro - Fábio Stralioti

Sep 30th, 2016
171
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 11.02 KB | None | 0 0
  1. /*
  2.  GameMode Criado por : Fábio Stralioti
  3.  SCRIPTER FÓRUM GTA TORCIDAS !
  4.  
  5. ******** ************ *********  **** *************
  6. ******** ************ *********  **** *************
  7. ****     ****    **** ****   **  **** *****   *****
  8. ****     ****    **** ****   **  **** *****   *****
  9. ******** ************ *********  **** *****   *****
  10. ******** ************ *********  **** *****   *****
  11. ****     ****    **** ****   **  **** *****   *****
  12. ****     ****    **** *********  **** *************
  13. ****     ****    **** *********  **** *************
  14.  
  15. reupload, perdi a senha da outra conta do pastebin e estou postando tudo nesta rsrsrs
  16.  
  17. */
  18.  
  19. #include <a_samp>
  20. #include <zcmd>
  21. #include <sscanf>
  22. #include <dof2>
  23.  
  24. #pragma tabsize 0
  25.  
  26. #define DIALOG_LOGAR 1
  27. #define DIALOG_REGISTRO 2
  28. #define DIALOG_COMANDOS 3
  29.  
  30. enum pInfo
  31. {
  32.     pSenha
  33. };
  34. new PlayerInfo[MAX_PLAYERS][pInfo];
  35.  
  36. new Text:Textdraw0;
  37. new Text:Textdraw1;
  38. new Text:Textdraw2;
  39. new Erro[MAX_PLAYERS];
  40.  
  41.  
  42. forward hora(playerid);
  43.  
  44. main()
  45. {
  46.     print("\n----------------------------------");
  47.     print("GameMode Treino de Tiro");
  48.     print("Feito Por : Fábio Stralioti");
  49.     print("----------------------------------\n");
  50. }
  51.  
  52. public OnGameModeInit()
  53. {
  54.  SetGameModeText("TT1.0");
  55.  LimitGlobalChatRadius(30);
  56.  DisableInteriorEnterExits();
  57.  UsePlayerPedAnims();
  58.  AddPlayerClass(286,-1616.6968,682.5148,-5.2422,276.9759,0,0,0,0,0,0);
  59.  AddStaticVehicle(597,-1616.6212,691.5457,-5.4738,3.5239,79,1);
  60.  AddStaticVehicle(523,-1598.7529,674.3570,6.7329,181.7815,79,1);
  61.  AddStaticVehicle(597,-1613.0400,692.7591,-5.4734,356.2501,79,1);
  62.  AddStaticVehicle(597,-1608.2551,692.5764,-5.4741,0.6081,79,1);
  63.  AddStaticVehicle(523,-1594.4698,673.2628,6.7541,174.1257,79,1);
  64.  AddStaticVehicle(523,-1586.4838,672.9091,6.7579,174.1916,79,1);
  65.  
  66.  Textdraw0 = TextDrawCreate(526.000000, 369.000000, "Treino Tiro");
  67.  TextDrawBackgroundColor(Textdraw0, 255);
  68.  TextDrawFont(Textdraw0, 3);
  69.  TextDrawLetterSize(Textdraw0, 0.490000, 2.899999);
  70.  TextDrawColor(Textdraw0, -16776961);
  71.  TextDrawSetOutline(Textdraw0, 0);
  72.  TextDrawSetProportional(Textdraw0, 1);
  73.  TextDrawSetShadow(Textdraw0, 1);
  74.  
  75.  Textdraw1 = TextDrawCreate(539.000000, 12.000000, "00/00/00");
  76.  TextDrawBackgroundColor(Textdraw1, 255);
  77.  TextDrawFont(Textdraw1, 1);
  78.  TextDrawLetterSize(Textdraw1, 0.500000, 1.000000);
  79.  TextDrawColor(Textdraw1, -16776961);
  80.  TextDrawSetOutline(Textdraw1, 0);
  81.  TextDrawSetProportional(Textdraw1, 1);
  82.  TextDrawSetShadow(Textdraw1, 1);
  83.  
  84.  Textdraw2 = TextDrawCreate(542.000000, 32.000000, "00:00:00");
  85.  TextDrawBackgroundColor(Textdraw2, 255);
  86.  TextDrawFont(Textdraw2, 1);
  87.  TextDrawLetterSize(Textdraw2, 0.500000, 1.000000);
  88.  TextDrawColor(Textdraw2, -16776961);
  89.  TextDrawSetOutline(Textdraw2, 0);
  90.  TextDrawSetProportional(Textdraw2, 1);
  91.  TextDrawSetShadow(Textdraw2, 1);
  92.  
  93.  SetTimer("hora",1000,1);
  94.  return 1;
  95. }
  96.  
  97. public OnGameModeExit()
  98. {
  99.  DOF2_Exit();
  100.  return 1;
  101. }
  102.  
  103. public OnPlayerConnect(playerid)
  104. {
  105.  SendClientMessage(playerid, -1,"GameMode treino de tiro feito por : Fábio Stralioti");
  106.  
  107.  new name[MAX_PLAYER_NAME];
  108.  new arquivo[40];
  109.  GetPlayerName(playerid, name, 32);
  110.  format(arquivo, 40, "Jogadores/%s.ini", name);
  111.   if(DOF2_FileExists(arquivo))
  112.    {
  113.      ShowPlayerDialog(playerid, DIALOG_LOGAR, DIALOG_STYLE_PASSWORD, "GameMode Treino de Tiro - Login", "Status da conta : Registrada\n digite sua senha para logar!\nSe errar 5 vezes sua conta será banida!", "Logar", "Cancelar");
  114.    }
  115.     else
  116.    {
  117.      ShowPlayerDialog(playerid, DIALOG_REGISTRO, DIALOG_STYLE_INPUT, "GameMode Treino de Tiro - Registro", "Status da conta : Não Registrada\n digite uma senha para se registrar!", "Registrar", "Cancelar");
  118.    }
  119.  
  120.  TextDrawShowForPlayer(playerid, Textdraw0);
  121.  TextDrawShowForPlayer(playerid, Textdraw1);
  122.  TextDrawShowForPlayer(playerid, Textdraw2);
  123.  return 1;
  124. }
  125.  
  126. public OnPlayerDisconnect(playerid, reason)
  127. {
  128.  new arquivo[40], name[MAX_PLAYER_NAME];
  129.     GetPlayerName(playerid, name, 32);
  130.     format(arquivo, 40, "Jogadores/%s.ini", name);
  131.     if(DOF2_FileExists(arquivo))
  132.     {
  133.         DOF2_SetInt(arquivo, "Senha", PlayerInfo[playerid][pSenha]);
  134.         DOF2_SaveFile();
  135.     }
  136.  return 1;
  137. }
  138.  
  139. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  140. {
  141.     new arquivo[40], name[MAX_PLAYER_NAME];
  142.     GetPlayerName(playerid, name, 32);
  143.     format(arquivo, 40, "Jogadores/%s.ini", name);
  144.     if(dialogid == DIALOG_REGISTRO)
  145.     {
  146.         if(!strval(inputtext))
  147.         {
  148.             ShowPlayerDialog(playerid, DIALOG_REGISTRO, DIALOG_STYLE_PASSWORD, "Treino de Tiro - Registro", "Status da conta : Não Registrada\n digite uma senha para se registrar!", "Registrar", "Cancelar");
  149.         SendClientMessage(playerid, -1, "Erro, Digite apenas números para se registrar.");
  150.         return 1;
  151.         }
  152.         if(!response)
  153.         {
  154.             Kick(playerid);
  155.             return 1;
  156.         }
  157.         else
  158.         {
  159.             PlayerInfo[playerid][pSenha] = strval(inputtext);
  160.             DOF2_CreateFile(arquivo);
  161.             DOF2_SetInt(arquivo, "Senha", PlayerInfo[playerid][pSenha]);
  162.         DOF2_SaveFile();
  163.         SendClientMessage(playerid, -1, "Sua Conta foi Registrada, Agora digite sua senha novamente para logar!");
  164.         ShowPlayerDialog(playerid, DIALOG_LOGAR, DIALOG_STYLE_PASSWORD, "Treino de Tiro - Login", "Status da conta : Registrada\n digite sua senha para logar!\nSe errar 5 vezes sua conta será banida!", "Logar", "Cancelar");
  165.         }
  166.     }
  167.     if(dialogid == DIALOG_LOGAR)
  168.     {
  169.         if(!strval(inputtext))
  170.         {
  171.             SendClientMessage(playerid, -1, "Erro, Digite apenas números para se logar.");
  172.         ShowPlayerDialog(playerid, DIALOG_LOGAR, DIALOG_STYLE_PASSWORD, "Treino de Tiro - Login", "Status da conta : Registrada\n digite sua senha para logar!\nSe errar 5 vezes sua conta será banida!", "Logar", "Cancelar");
  173.         return 1;
  174.         }
  175.         if(!response)
  176.         {
  177.             Kick(playerid);
  178.             return 1;
  179.         }
  180.         else
  181.         {
  182.             PlayerInfo[playerid][pSenha] = DOF2_GetInt(arquivo, "Senha");
  183.             if(strval(inputtext) == PlayerInfo[playerid][pSenha])
  184.             {
  185.                 SpawnPlayer(playerid);
  186.             }
  187.             else
  188.             {
  189.                 ShowPlayerDialog(playerid, DIALOG_LOGAR, DIALOG_STYLE_PASSWORD, "Treino de Tiro - Login", "Status da conta : Registrada\n digite sua senha para logar!\nSe errar 5 vezes sua conta será banida!", "Logar", "Cancelar");
  190.                 Erro[playerid]++;
  191.                 if(Erro[playerid] == 5)
  192.                 {
  193.                     SendClientMessage(playerid, -1, "Sua conta está banida por errar 5 vezes a sua senha, contacte o Admin para retirar seu Ban!");
  194.                     Ban(playerid);
  195.                     return 1;
  196.                 }
  197.             }
  198.         }
  199.     }
  200.     return 1;
  201. }
  202.  
  203. public hora(playerid)
  204. {
  205.      new str[128],
  206.           str2[128],
  207.                year,
  208.                     month,
  209.                         day,
  210.                             hour,
  211.                                minute,
  212.                                    second;
  213.  
  214.     getdate(year, month, day);
  215.     gettime(hour,minute,second);
  216.     new mes[12];
  217.  
  218.     if(month == 1) { mes = "1"; }
  219.     else if(month == 2) {mes = "2";}
  220.     else if(month == 3) {mes = "3";}
  221.     else if(month == 4) {mes = "4";}
  222.     else if(month == 5) {mes = "5";}
  223.     else if(month == 6) {mes = "6";}
  224.     else if(month == 7) {mes = "7";}
  225.     else if(month == 8) {mes = "8";}
  226.     else if(month == 9) {mes = "9";}
  227.     else if(month == 10) {mes = "10";}
  228.     else if(month == 11) {mes = "11";}
  229.     else if(month == 12) {mes= "12";}
  230.     format(str, sizeof(str), "%d/%s/%d", day, mes,year);
  231.     TextDrawSetString(Text:Textdraw1, str);
  232.     format(str2, sizeof(str2), "%d:%d:%d", hour, minute, second);
  233.     TextDrawSetString(Text:Textdraw2, str2);
  234. }
  235.  
  236. CMD:equipar(playerid)
  237. {
  238.  new name[MAX_PLAYER_NAME], string[23 + MAX_PLAYER_NAME];
  239.  GetPlayerName(playerid, name, sizeof(name));
  240.  format(string, sizeof(string), "O Player %s se equipou", name);
  241.  SendClientMessageToAll(-1, string);
  242.  GivePlayerWeapon(playerid, 25, 999);
  243.  GivePlayerWeapon(playerid, 3, 999);
  244.  return 1;
  245. }
  246.  
  247. CMD:tr(playerid, params[])
  248. {
  249.  new id, Float: x, Float: y, Float: z, string[256], string2[256], namep[MAX_PLAYER_NAME], namead[MAX_PLAYER_NAME];
  250.  if(sscanf(params, "u", id)) return SendClientMessage(playerid, -1,"Use: /tr [id]");
  251.  if(id == playerid) return SendClientMessage(playerid, -1, "Você não pode trazer em você mesmo...");
  252.  if(!IsPlayerConnected(id)) return SendClientMessage(playerid, -1,"Este jogador não está online.");
  253.  GetPlayerName(playerid, namead, sizeof(namead));
  254.  GetPlayerName(id, namep, sizeof(namep));
  255.  format(string, sizeof(string), "Trouxe o player %s até você.", namep);
  256.  format(string2, sizeof(string2), "%s  trouxe você até ele.", namead);
  257.  SendClientMessage(playerid, -1, string);
  258.  SendClientMessage(id, -1, string2);
  259.  GetPlayerPos(playerid, x, y, z);
  260.  SetPlayerPos(id, x+1, y+1, z);
  261.  return 1;
  262. }
  263.  
  264. CMD:ir(playerid, params[])
  265. {
  266.  new id = strval(params);
  267.  if(isnull(params)) return SendClientMessage(playerid, -1, "/ir [playerid]");
  268.  if(id == playerid) return SendClientMessage(playerid, -1, "Você não pode ir em você mesmo...");
  269.  if(!IsPlayerConnected(id)) return SendClientMessage(playerid, -1, "O player não está conectado");
  270.  new Float:X2, Float:Y2, Float:Z2, Pname[24];
  271.  GetPlayerPos(id, X2, Y2, Z2);
  272.  GetPlayerName(id, Pname, 24);
  273.  SetPlayerPos(playerid, X2, Y2, Z2);
  274.  new String[56];
  275.  format(String, sizeof(String), "Você foi ate %s(%d)", Pname, id);
  276.  SendClientMessage(playerid, -1, String);
  277.  return 1;
  278. }
  279.  
  280. CMD:vidat(playerid)
  281. {
  282.  new i;
  283.  SetPlayerHealth(i,100);
  284.  new string2[72];
  285.  format(string2, sizeof(string2), "Admin: %s deu vida para todos",(playerid));
  286.  SendClientMessageToAll( -1, string2);
  287.  SendClientMessage(playerid, -1, "Você deu vida para todos");
  288.  return 1;
  289. }
  290.  
  291. CMD:creditos(playerid)
  292. {
  293.  SendClientMessage(playerid, -1,"GameMode feito por : Fábio Stralioti");
  294.  return 1;
  295. }
  296.  
  297. CMD:rtc(playerid)
  298. {
  299.  ResetarCarros(playerid);
  300.  return 1;
  301. }
  302.  
  303. CMD:comandos(playerid)
  304. {
  305.  new dialogrande[1024];
  306.  format(dialogrande, sizeof(dialogrande),"%s%s",dialogrande,"/equipar\n/vidat\n/ir\n/tr\n/creditos\n/rtc\n");
  307.  ShowPlayerDialog(playerid,DIALOG_COMANDOS, DIALOG_STYLE_MSGBOX, "Comandos", dialogrande, "OK", "");
  308.  return 1;
  309. }
  310.  
  311. stock ReturnPlayer(playerid)
  312. {
  313.     new name[MAX_PLAYER_NAME];
  314.     GetPlayerName(playerid,name,MAX_PLAYER_NAME);
  315.     return name;
  316. }
  317.  
  318. stock ResetarCarros(playerid)
  319. {
  320.     new string[128];
  321.     GetPlayerName(playerid, string, MAX_PLAYER_NAME);
  322.     format(string, sizeof(string), "O player %s respawnou todos os veiculos", string);
  323.     SendClientMessageToAll(-1, string);
  324.     new bool:inVeh;
  325.     for( new i = 0; i < MAX_VEHICLES; i++ )
  326.     {
  327.         inVeh = false;
  328.         for( new j = 0; j < MAX_PLAYERS; j++ )
  329.         {
  330.             if(IsPlayerInVehicle( j, i ))
  331.             {
  332.                 inVeh = true;
  333.             }
  334.         }
  335.         if(!inVeh) SetVehicleToRespawn(i);
  336.     }
  337.     return true;
  338. }
Advertisement
Add Comment
Please, Sign In to add comment