SHARE
TWEET

[FS] Sprees System Simple V.1

Chip7 May 15th, 2012 102 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*VISITE NOSSO SITE: http://www.sampknd.com/
  2.   sAMP KND MELHOR BLOG DE SAMP DO BRASIL
  3.   Sprees System v.1 Feito Por [ZNS].[KrauZeR]_.|||4LiSs0N
  4. */
  5.  
  6. *============================================================================================================*/
  7. #include <a_samp>
  8. #include <Dini>
  9. #include <ZCMD>
  10. #include <sscanf2>
  11. new     KillsSpree[MAX_PLAYERS],
  12.         Text:InfoSpree[MAX_PLAYERS],
  13.         Player_Name[MAX_PLAYER_NAME],
  14.         Text:BoxSpree,
  15.         strings[100]
  16. ;
  17. /*============================================================================================================*/
  18. public OnPlayerConnect(playerid)
  19. {
  20.    OnUpdateScore(playerid);
  21.    LoginSpree(playerid);
  22.    return 1;
  23. }
  24. /*============================================================================================================*/
  25. public OnPlayerDisconnect(playerid, reason)
  26. {
  27.    printf("\nSprees de %s foram salvos\n",PlayerName(playerid));
  28.    SaveSpree(playerid);
  29.    return 1;
  30. }
  31. /*============================================================================================================*/
  32.  
  33. public OnPlayerDeath(playerid, killerid, reason)
  34. {
  35.     KillsSpree[killerid] ++;
  36.     KillsSpree[playerid] = 0;
  37.  
  38.     if(KillsSpree[killerid] >= 5)
  39.     {
  40.         GetPlayerName(killerid, Player_Name, MAX_PLAYER_NAME);
  41.         format(strings,256,"{33CCFF}%s{FF0023}Chegou nos {33CCFF}%d{FF0023} de Spree",PlayerName(playerid), KillsSpree[killerid]);
  42.         SendClientMessageToAll(0xFF0023FF,strings);
  43.     }
  44.     OnUpdateScore(killerid);
  45.     return 1;
  46. }
  47. /*============================================================================================================*/
  48. CMD:spreeinfo(playerid, params[])
  49. {
  50.     new playerS;
  51.     if(sscanf(params, "ud", playerS))
  52.     return SendClientMessage(playerid, -1, "[ERRO] Use: /spreeinfo [id]");
  53.     if(!IsPlayerConnected(playerS))
  54.     return SendClientMessage(playerid, -1, "[ERRO] Jogador não conectado");
  55.     GetPlayerName(playerS, Player_Name, MAX_PLAYER_NAME);
  56.     format(strings,256,"•|INFO| Jogador %s Contem %d de Spree |•",Player_Name,KillsSpree[playerid]);
  57.     SendClientMessageToAll(0xFF0023FF,strings);
  58.     return 1;
  59. }
  60. CMD:setspree(playerid, params[])
  61. {
  62.     new player,sprees;
  63.     if(!IsPlayerAdmin(playerid))
  64.     return SendClientMessage(playerid, -1, "[ERRO] Sem autorização para usar esse comando!");
  65.     if(sscanf(params, "ud", player,sprees))
  66.     return SendClientMessage(playerid, -1, "[ERRO] Use: /setspree [id] [Spree]");
  67.     if(!IsPlayerConnected(player))
  68.     return SendClientMessage(playerid, -1, "[ERRO] Jogador não conectado");
  69.     KillsSpree[player] = sprees;
  70.     GetPlayerName(player, Player_Name, MAX_PLAYER_NAME);
  71.     format(strings,256,"• Você setou o spree de %s para %d •",Player_Name,sprees);
  72.     SendClientMessage(playerid,0xFF0023FF,strings);
  73.     return 1;
  74. }
  75. /*============================================================================================================*/
  76. public OnPlayerSpawn(playerid)
  77. {
  78.     TextDrawShowForPlayer(playerid,BoxSpree);
  79.     TextDrawShowForPlayer(playerid,InfoSpree[playerid]);
  80.     return 1;
  81. }
  82. /*============================================================================================================*/
  83. public OnFilterScriptInit()
  84. {
  85.     for(new i, k = GetMaxPlayers(); i != k; ++i)
  86.     {
  87.         InfoSpree[i] = TextDrawCreate(44.000000, 285.000000," ");
  88.         TextDrawFont(InfoSpree[i], 2);
  89.         TextDrawLetterSize(InfoSpree[i], 0.290000, 1.300000);
  90.         TextDrawColor(InfoSpree[i], 0x0DB0DDFF);
  91.         TextDrawSetOutline(InfoSpree[i], 1);
  92.         TextDrawSetProportional(InfoSpree[i], 1);
  93.     }
  94. /*============================================================================================================*/
  95.     BoxSpree = TextDrawCreate(41.000000, 276.000000, "~n~");
  96.     TextDrawBackgroundColor(BoxSpree, 255);
  97.     TextDrawFont(BoxSpree, 1);
  98.     TextDrawLetterSize(BoxSpree,0.370000, 3.399998);
  99.     TextDrawColor(BoxSpree, 0);
  100.     TextDrawSetOutline(BoxSpree, 0);
  101.     TextDrawSetProportional(BoxSpree, 1);
  102.     TextDrawSetShadow(BoxSpree, 1);
  103.     TextDrawUseBox(BoxSpree, 1);
  104.     TextDrawBoxColor(BoxSpree, 80);
  105.     TextDrawTextSize(BoxSpree, 150.000000, 0.000000);
  106.  
  107.     if(!fexist("sprees.ini")) dini_Create("sprees.ini");
  108.     return 1;
  109. }
  110. /*============================================================================================================*/
  111. public OnPlayerUpdate(playerid)
  112. {
  113.     OnUpdateScore(playerid);
  114.     return 1;
  115. }
  116. /*============================================================================================================*/
  117. stock OnUpdateScore(playerid)
  118. {
  119.     format(strings, sizeof(strings),"Spree:~w~ %d",KillsSpree[playerid]);
  120.     TextDrawSetString(InfoSpree[playerid],strings);
  121.     return 1;
  122. }
  123. /*============================================================================================================*/
  124. stock SaveSpree(playerid)
  125. {
  126.     dini_IntSet("sprees.ini",PlayerName(playerid),KillsSpree[playerid]);
  127.     return 1;
  128. }
  129. /*============================================================================================================*/
  130. stock LoginSpree(playerid)
  131. {
  132.     if(dini_Isset("sprees.ini",PlayerName(playerid)))  KillsSpree[playerid] = (playerid,dini_Int("sprees.ini",PlayerName(playerid)));
  133.     return 1;
  134. }
  135. /*============================================================================================================*/
  136. stock PlayerName(playerid)
  137. {
  138.     new Namei[MAX_PLAYERS];
  139.     GetPlayerName(playerid, Namei, sizeof(Namei));
  140.     return Namei;
  141. }
  142. /*============================================================================================================*/
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top