Advertisement
Chip7

[FS] FilterScript Sistema de Bombas

Aug 17th, 2012
473
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 5.95 KB | None | 0 0
  1. /*VISITE NOSSO SITE: http://www.sampknd.com/
  2.   SAMP KND MELOR BLOG DE SAMP DO BRASIL
  3. */
  4.  
  5. #include a_samp
  6. #include DOF2
  7. #include zcmd
  8.  
  9. #define bombasd "Bombas\\%s.ini"
  10. #define msgb    "Você ainda tem %d bombas."
  11.  
  12. new qtdb[MAX_PLAYERS];
  13. new bobj[MAX_PLAYERS];
  14. new nome[25];
  15. new Float:cds[3];
  16. new bool:plantando[MAX_PLAYERS];
  17. new bfile[35];
  18. new bindicador[60];
  19.  
  20.  
  21. stock salvardados(playerid)
  22. {
  23.     GetPlayerName(playerid,nome,24);
  24.     format(bfile,sizeof bfile,bombasd,nome);
  25.     DOF2_SetInt(bfile,"bombas",GetPVarInt(playerid,"bombas"));
  26.     DOF2_SaveFile();
  27.     return 1;
  28. }
  29.  
  30.  
  31.  
  32. public OnFilterScriptInit()
  33. {
  34.     print("O sistema de bombas de FROSTGF foi carregado");
  35.     return 1;
  36. }
  37.  
  38. public OnFilterScriptExit()
  39. {
  40.     print("O sistema de bombas de FROSTGF foi descarregado");
  41.     DOF2_Exit();
  42.     return 1;
  43. }
  44.  
  45. public OnPlayerConnect(playerid)
  46. {
  47.     GetPlayerName(playerid,nome,sizeof nome);
  48.     format(bfile,sizeof bfile,bombasd,nome);
  49.     if(!fexist(bfile))
  50.     {
  51.         DOF2_CreateFile(bfile);
  52.         DOF2_SetInt(bfile,"bombas",GetPVarInt(playerid,"bombas"));
  53.         DOF2_SaveFile();
  54.         plantando[playerid] = false;
  55.     }
  56.     else return SetPVarInt(playerid,"bombas",DOF2_GetInt(bfile,"bombas"));
  57.     return 1;
  58. }
  59.  
  60. public OnPlayerDisconnect(playerid)
  61. {
  62.     salvardados(playerid);
  63.     return 1;
  64. }
  65.  
  66. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  67. {
  68.     GetPlayerName(playerid,nome,24);
  69.     if(dialogid == 1)
  70.     {
  71.         if(response)
  72.         {
  73.             if(listitem == 0)
  74.             {
  75.                 if(GetPlayerMoney(playerid) >= 3500)
  76.                 {
  77.                     GetPlayerName(playerid,nome,sizeof nome);
  78.                     format(bfile,sizeof bfile,bombasd,nome);
  79.                     SetPVarInt(playerid,"bombas",++qtdb[playerid]);
  80.                     SendClientMessage(playerid,-1,"Bomba adquirida com sucesso.");
  81.                     GivePlayerMoney(playerid,-3500);
  82.                     salvardados(playerid);
  83.                 }
  84.                 else return SendClientMessage(playerid,-1,"Você não tem dinheiro suficiente para comprar uma bomba(R$3500,00).");
  85.             }
  86.             if(listitem == 1)
  87.             {
  88.                 if(GetPVarInt(playerid,"bombas") >= 1)
  89.                 {
  90.                     format(bindicador,sizeof bindicador,msgb,GetPVarInt(playerid,"bombas")-1);
  91.                     GetPlayerName(playerid,nome,sizeof nome);
  92.                     format(bfile,sizeof bfile,bombasd,nome);
  93.                     SetPVarInt(playerid,"bombas",--qtdb[playerid]);
  94.                     GivePlayerMoney(playerid,3100);
  95.                     SendClientMessage(playerid,-1,bindicador);
  96.                     salvardados(playerid);
  97.                 }
  98.                 else return SendClientMessage(playerid,-1,"Você não tem bombas para vender.");
  99.             }
  100.             if(listitem == 2)
  101.             {
  102.                 if(GetPVarInt(playerid,"bombas") >= 1)
  103.                 {
  104.                     format(bindicador,sizeof bindicador,msgb,GetPVarInt(playerid,"bombas"));
  105.                     SendClientMessage(playerid,-1,bindicador);
  106.                 }
  107.                 else return SendClientMessage(playerid,-1,"Você não possui bombas, para comprar bombas use: /bombamenu");
  108.             }
  109.             return 1;
  110.         }
  111.         return 1;
  112.     }
  113.     return 1;
  114. }
  115.  
  116. CMD:bombamenu(playerid,params[]) return ShowPlayerDialog(playerid,1,DIALOG_STYLE_LIST,"Menu","Comprar bomba - R$3500,00\nVender bomba - R$3100,00\nVer minhas bombas","Ok","Fechar");
  117.  
  118.  
  119. CMD:detonar(playerid,params[])
  120. {
  121.     if(plantando[playerid] == true)
  122.     {
  123.         format(bfile,sizeof bfile,bombasd,nome);
  124.         format(bindicador,sizeof bindicador,msgb,GetPVarInt(playerid,"bombas")-1);
  125.         DestroyObject(bobj[playerid]);
  126.         CreateExplosion(cds[0],cds[1],cds[2],7,100.0);
  127.         plantando[playerid] = false;
  128.         SendClientMessage(playerid,-1,bindicador);
  129.         SetPVarInt(playerid,"bombas",--qtdb[playerid]);
  130.         salvardados(playerid);
  131.     }
  132.     else
  133.     {
  134.         SendClientMessage(playerid,-1,"Algo impediu que a bomba explodisse.");
  135.         SendClientMessage(playerid,-1,"Como sua bomba não explodiu, você pega ela de volta.");
  136.         DestroyObject(bobj[playerid]);
  137.     }
  138.     return 1;
  139. }
  140.  
  141. CMD:plantarbomba(playerid,params[])
  142. {
  143.     if(GetPVarInt(playerid,"bombas") >= 1)
  144.     {
  145.         if(plantando[playerid] == false)
  146.         {
  147.             new strp[75];
  148.             GetPlayerPos(playerid,cds[0],cds[1],cds[2]);
  149.             format(strp,sizeof strp,"Você tem %d bombas, caso aborte a explosão, você não perderá a bomba.",GetPVarInt(playerid,"bombas")-1);
  150.             SendClientMessage(playerid,-1,strp);
  151.             bobj[playerid] = CreateObject(1252,cds[0],cds[1],cds[2],-1,0.0,1.0);
  152.             ApplyAnimation(playerid, "BOMBER", "BOM_Plant", 4.0, 0, 0, 0, 0, 0);
  153.             SendClientMessage(playerid,-1,"use /detonar para explodir a bomba!!!");
  154.             plantando[playerid] = true;
  155.             return 1;
  156.         }
  157.     }
  158.     else return SendClientMessage(playerid,-1,"Você não plantou uma bomba para poder explodir!!");
  159.     return 1;
  160. }
  161.  
  162. CMD:desarmar(playerid,params[])
  163. {
  164.     if(plantando[playerid] == true)
  165.     {
  166.         if(IsPlayerInRangeOfPoint(playerid,5.0,cds[0],cds[1],cds[2]))
  167.         {
  168.             format(bindicador,sizeof bindicador,"Você desativou sua bomba,e a pegou de volta(%d bombas)",GetPVarInt(playerid,"bombas"));
  169.             SendClientMessage(playerid,-1,bindicador);
  170.             DestroyObject(bobj[playerid]);
  171.             plantando[playerid] = false;
  172.         }
  173.         else return SendClientMessage(playerid,-1,"Você não está perto de sua bomba para desarma-la.");
  174.     }
  175.     else return SendClientMessage(playerid,-1,"Você não plantou uma bomba.");
  176.     return 1;
  177. }
  178.  
  179. CMD:comandosfs(playerid,params[]) return ShowPlayerDialog(playerid,13,DIALOG_STYLE_MSGBOX,"Menu","use:\n\n\t/plantarbomba\n\t/desarmar\n\t/bombamenu","Ok","");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement