Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1. #include <a_samp>
  2.  
  3. new Portao;
  4. forward ClosePortao(playerid);
  5.  
  6. public OnGameModeInit()
  7. {
  8.     Portao = CreateObject(970, 1, 2, 3, 0, 0, 0);
  9.     return 1;
  10. }
  11.  
  12. public OnPlayerCommandText(playerid, cmdtext[])
  13. {
  14.     if (strcmp("/portao", cmdtext, true, 10) == 0)
  15.     {
  16.         if(IsPlayerInRangeOfPoint(playerid,7.0, 1, 2, 3))
  17.         {
  18.         SendClientMessage(playerid, -1, "Portão Aberto, irá Fechar em 5 Segundos");
  19.         MoveObject(Portao, 1, 2, 2, 1.0, 0.0, 0.0, 0.0);
  20.         SetTimer("ClosePortao", 5000, false);
  21.         }
  22.         return 1;
  23.     }
  24.     return 0;
  25. }
  26.  
  27. public ClosePortao(playerid)
  28. {
  29.     MoveObject(Portao, 1, 2, 3, 1.0, 0.0, 0.0, 0.0);
  30.     return 1;
  31. }
  32.  
  33. public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
  34. {
  35.     if ((newkeys==KEY_JUMP))
  36.     {
  37.         OnPlayerCommandText(playerid,"/portao");
  38.     }
  39.     return 1;
  40. }