Advertisement
Lucas_Alemao

Sistema de recompensas by Lucas_Alemao

Apr 22nd, 2012
332
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 2.37 KB | None | 0 0
  1. /*
  2.  
  3.          SISTEMA DE RECOMPENSAS
  4.             By:Lucas_Alemao
  5.                   ou
  6.               [iPs]Lucas
  7. */
  8.  
  9.  
  10. #include a_samp
  11. #include zcmd
  12.  
  13. //Defina o valor inicial da recomepnsa.
  14. #define     VALOR_INICIAL 1200
  15.  
  16. #define GetarDado(%0,%1) %1[%0]
  17.  
  18. const Verde = 0x12C41E96;
  19.  
  20. new Recompensa[MAX_PLAYERS];
  21. new Matou[MAX_PLAYERS];
  22. new Seguidos[MAX_PLAYERS];
  23. new str[256];
  24. new Text3D:recompensa[MAX_PLAYERS];
  25.  
  26. public OnFilterScriptInit() {
  27.     print("\n\nFS de recompensas By [iPs]Lucas carregado com sucesso\n\n");
  28.     return 1;
  29. }
  30.  
  31. public OnPlayerConnect(playerid) {
  32.     Recompensa[playerid] = 0;
  33.     Matou[playerid] = 0;
  34.     Seguidos[playerid] = 0;
  35.     return 1;
  36. }
  37.  
  38. public OnPlayerDeath(playerid, killerid, reason) {
  39.     Matou[killerid]++;
  40.     Matou[playerid] = 0;
  41.     Seguidos[killerid]++;
  42.     if(GetarDado(killerid, Matou) == 1) {
  43.         Recompensa[killerid] = VALOR_INICIAL;
  44.     }
  45.     else if(GetarDado(killerid, Seguidos) >= 5) {
  46.         format(str, sizeof(str), "[ATENÇÃO] O Jogador {0EF01D}%s{12C41E} ja matou %d pessoas consecutivas. Sua cabeça está valendo $%d.", Nome(killerid), GetarDado(killerid, Matou), GetarDado(killerid, Recompensa));
  47.         SendClientMessageToAll(Verde, str);
  48.         Recompensa[killerid] = Recompensa[killerid]*2;
  49.         Seguidos[killerid] = 0;
  50.     }
  51.     if(GetarDado(playerid, Recompensa) > 0) {
  52.         GivePlayerMoney(killerid, Recompensa[playerid]);
  53.         format(str, sizeof(str), "[ATENÇÃO] O Jogador {0EF01D}%s{12C41E} Matou {0EF01D}%s{12C41E} e ganhou uma recompensa de $%d.", Nome(killerid), Nome(playerid), GetarDado(playerid, Recompensa));
  54.         SendClientMessageToAll(Verde, str);
  55.         Recompensa[playerid] = 0;
  56.     }
  57.     AtualizarText(playerid);
  58.     AtualizarText(killerid);
  59. }
  60.  
  61. CMD:cabecas(playerid) {
  62.     for(new i = 0; i < MAX_PLAYERS; ++i) {
  63.         if(Matou[i] >= 5) {
  64.             format(str, sizeof(str), "%s - $%d - Matou: %d", Nome(i), GetarDado(i, Recompensa), GetarDado(i, Matou));
  65.             SendClientMessage(playerid, Verde, str);
  66.         }
  67.     }
  68.     return 1;
  69. }
  70.  
  71. stock AtualizarText(playerid) {
  72.     Delete3DTextLabel(recompensa[playerid]);
  73.     if(GetarDado(playerid, Matou) >= 5) {
  74.         format(str, 50, "Recompensa: %d", GetarDado(playerid, Recompensa));
  75.         recompensa[playerid] = Create3DTextLabel(str, 0x53E62296, 0, 0, 0, 20, 1, 1);
  76.         Attach3DTextLabelToPlayer(recompensa[playerid], playerid, 0, 0, 1);
  77.     }
  78. }
  79.    
  80.  
  81. stock Nome(playerid) {
  82.     new pname[24];
  83.     GetPlayerName(playerid, pname, 24);
  84.     return pname;
  85. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement