Advertisement
Guest User

Untitled

a guest
Jul 2nd, 2011
842
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 5.43 KB | None | 0 0
  1. //PLANO DE SAUDE , DESEVOLVIDO POR C0CA.//////////////////////////////
  2. //===========================================================
  3.  
  4.  
  5. #include a_samp
  6. #include dini
  7.  
  8. #define PLANO 1
  9.  
  10. new bool:pplano[MAX_PLAYERS];
  11. new Plano[MAX_PLAYERS];
  12. new assinantes[MAX_PLAYERS];
  13. new nome[MAX_PLAYER_NAME];
  14. new str[128];
  15. new p;
  16.  
  17. public OnFilterScriptInit()
  18. {
  19.     print("---------------------------------------");
  20.     print("Sistema de Plano de saude desenvolvido por c0ca");
  21.     print("---------------------------------------");
  22.     if(!fexist("Planos.txt")) { dini_Create("Planos.txt"); }
  23.     p = CreatePickup(1240, 1, 1176.3975,-1322.3372,14.0193, -1);
  24.     Create3DTextLabel("digite ja /plano , para adquirir seu plano de saúde! ", -1, 1176.3975,-1322.3372,14.0193, 20.0,0);
  25. }
  26.  
  27.  
  28. public OnPlayerCommandText(playerid,cmdtext[])
  29. {
  30.     if(strcmp(cmdtext,"/plano",true)==0) {
  31.         if(!IsPlayerInRangeOfPoint(playerid, 2.0, 1176.3975,-1322.3372,14.0193)) return SendClientMessage(playerid,-1,"Você não está no hospital,(/irplano para ir)");
  32.         ShowPlayerDialog(playerid,PLANO,DIALOG_STYLE_LIST,"Plano de saude By COCA","Plano Ouro(15 Internações Grátis - $2000)\nPlano Prata(10 Internações Grátis - $1500)\nPlano Bronze(5 Internações Grátis - $500)","Obter","Sair");
  33.         return true;
  34.     }
  35.     if(strcmp(cmdtext,"/irplano",true)==0) {
  36.         SetPlayerPos(playerid,1185.5848,-1322.4513,13.5714);
  37.         return true;
  38.     }
  39.     if(strcmp(cmdtext,"/internacoes",true)==0) {
  40.         new string[128];
  41.         format(string,sizeof(string),"Você possui : %d internações",Plano[playerid]);
  42.         SendClientMessage(playerid,-1,string);
  43.         return true;
  44.     }
  45.     if(strcmp(cmdtext,"/assinantes",true)==0) {
  46.         if(Plano[playerid]==0) return SendClientMessage(playerid,-1,"Você não tem um plano , não pode utilizar esse comando");
  47.         new string[128];
  48.         GetPlayerName(playerid,nome,sizeof(nome));
  49.         SendClientMessage(playerid, -1, ".Assinantes ONLINES.");
  50.         for(new i = 0; i < MAX_PLAYERS; i++) {
  51.             if(Plano[i] >0) {
  52.                 if(Plano[i]==0) continue;
  53.                 format(string, sizeof(string), "Nome : %s - Internações disponiveis %d",nome,Plano[i]);
  54.                 SendClientMessage(playerid, -1, string);
  55.             }
  56.         }
  57.         return true;
  58.     }
  59.     return false;
  60. }
  61.  
  62. //====//
  63. public OnPlayerConnect(playerid)
  64. {
  65.     GetPlayerName(playerid, nome, sizeof nome);
  66.     format(str, sizeof str, "%s", nome);
  67.     if(dini_Isset("Planos.txt", str)) { Plano[playerid] = dini_Int("Planos.txt",str); }
  68.     else { Plano[playerid] = 0; }
  69.     pplano[playerid] = false;
  70. }
  71.  
  72. public OnPlayerSpawn(playerid)
  73. {
  74.     if(Plano[playerid] > 0) {
  75.         ResetPlayerMoney(playerid);
  76.         if(pplano[playerid] == true) GivePlayerMoney(playerid, GetPVarInt(playerid, "PagoPeloPlano"));
  77.         pplano[playerid] = false;
  78.     }
  79.     return 1;
  80. }
  81.  
  82.  
  83. public OnPlayerDisconnect(playerid,reason)
  84. {
  85.  
  86.     GetPlayerName(playerid, nome, sizeof nome);
  87.     format(str, sizeof str, "%s", nome);
  88.     dini_IntSet("Planos.txt", str, Plano[playerid]);
  89.     return true;
  90. }
  91.  
  92.  
  93. public OnPlayerDeath(playerid,killerid,reason)
  94. {
  95.     new _Str[128];
  96.     if(Plano[playerid]==0) {
  97.         assinantes[playerid]--;
  98.     }
  99.     if(Plano[playerid]>0) {
  100.         Plano[playerid]--;
  101.         format(_Str,sizeof(_Str),"[HOSPITAL] Você morreu e suas depesas foram pagas pelo seu plano de saude , agora você possui %d internações restantes.",Plano[playerid]);
  102.         SendClientMessage(playerid,-1,_Str);
  103.         pplano[playerid] = true;
  104.         SetPVarInt(playerid, "PagoPeloPlano", GetPlayerMoney(playerid));
  105.     }
  106.     return true;
  107. }
  108.  
  109.  
  110. //====//
  111. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  112. {
  113.     new _Str[128];
  114.     if(dialogid == 5) {
  115.         if(response) {
  116.             if(listitem == 0) {
  117.                 if(GetPlayerMoney(playerid)<1500)return SendClientMessage(playerid,-1,"[ERRO]:Você não possui $1.500");
  118.                 Plano[playerid]+=15;
  119.                 format(_Str,sizeof(_Str),"[HOSPITAL] Você obteve o Plano de saúde Ouro. Você agora possui %d internações gratis.",Plano[playerid]);
  120.                 SendClientMessage(playerid,-1,_Str);
  121.                 GivePlayerMoney(playerid,-2000);
  122.                 assinantes[playerid]++;
  123.                 return 1;
  124.             }
  125.             else if(listitem == 1) {
  126.                 if(GetPlayerMoney(playerid)<1000)return SendClientMessage(playerid,-1,"[ERRO]:Você não possui $1.000");
  127.                 Plano[playerid]+=10;
  128.                 format(_Str,sizeof(_Str),"[HOSPITAL] Você obteve o Plano de saúde Prata. Você agora possui %d internações gratis.",Plano[playerid]);
  129.                 SendClientMessage(playerid,-1,_Str);
  130.                 GivePlayerMoney(playerid,-1500);
  131.                 assinantes[playerid]++;
  132.                 return 1;
  133.             }
  134.             else if(listitem == 2) {
  135.                 if(GetPlayerMoney(playerid)<500)return SendClientMessage(playerid,-1,"[ERRO]:Você não possui $500");
  136.                 Plano[playerid]+=5;
  137.                 format(_Str,sizeof(_Str),"[HOSPITAL] Você obteve o Plano de saúde Bronze. Você agora possui %d internações gratis.",Plano[playerid]);
  138.                 SendClientMessage(playerid,-1,_Str);
  139.                 GivePlayerMoney(playerid,-500);
  140.                 assinantes[playerid]++;
  141.             }
  142.         }
  143.     }
  144.     return true;
  145. }
  146.  
  147.  
  148. #pragma unused p
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement