Onurboh

Untitled

Feb 13th, 2021 (edited)
794
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 3.60 KB | None | 0 0
  1. /*
  2.  
  3. Sistema de Procurados | Wanted System
  4.  
  5. Desenvolvido por: Bruno.
  6.  */
  7.  
  8. #include "a_samp"
  9. #include "zcmd"
  10.  
  11. // Enumeradores //
  12.  
  13. enum pwanted
  14. {
  15.     w_KillsData,
  16.     w_LevelsData,
  17.     w_RewardData,
  18.     w_ScoreData,
  19.     bool:w_Wanted,
  20. }
  21.  
  22. new pWantedData[MAX_PLAYERS][pwanted];
  23.  
  24.  
  25. public OnPlayerConnect(playerid)
  26. {
  27.     pWantedData[playerid][w_KillsData] = 0;
  28.     pWantedData[playerid][w_LevelsData] = 0;
  29.     pWantedData[playerid][w_ScoreData] = 0;
  30.     pWantedData[playerid][w_RewardData] = 0;
  31.     pWantedData[playerid][w_Wanted] = false;
  32.    
  33.     return 1;
  34. }
  35.  
  36. public OnPlayerDeath(playerid, killerid, reason)
  37. {
  38.     new strmsg[200], namedead[MAX_PLAYER_NAME], namekiller[MAX_PLAYER_NAME];
  39.  
  40.     SendDeathMessage(killerid, playerid, reason);
  41.  
  42.     if(killerid != INVALID_PLAYER_ID)
  43.     {
  44.         pWantedData[killerid][w_KillsData] ++;
  45.         if(pWantedData[playerid][w_Wanted] == true)
  46.         {
  47.             GetPlayerName(killerid, namekiller, sizeof namekiller);
  48.             GetPlayerName(playerid, namedead, sizeof namedead);
  49.  
  50.             GivePlayerMoney(killerid, pWantedData[playerid][w_RewardData]);
  51.             SetPlayerScore(killerid, pWantedData[playerid][w_ScoreData]);
  52.             format(strmsg, sizeof strmsg, "{00FF00}Procurados | {87CEFA}O cacador de procurados '%s' matou o matador de noobs '%s'! (Recompensas: Dinheiro %d | Score: %d)", namekiller, namedead, pWantedData[playerid][w_RewardData], pWantedData[playerid][w_ScoreData]);
  53.             SendClientMessageToAll(-1, strmsg);
  54.         }
  55.     }
  56.     ws_CheckKills(killerid);
  57.  
  58.     pWantedData[playerid][w_Wanted] = false;
  59.     pWantedData[playerid][w_KillsData] = 0;
  60.     pWantedData[playerid][w_LevelsData] = 0;
  61.     pWantedData[playerid][w_ScoreData] = 0;
  62.     pWantedData[playerid][w_RewardData] = 0;
  63.     SetPlayerWantedLevel(playerid, 0);
  64.    
  65.     return 1;
  66. }
  67.  
  68. //Funçoes
  69.  
  70. ws_CheckKills(killerid)
  71. {
  72.     new ws_StringKills[500];
  73.  
  74.     if(pWantedData[killerid][w_KillsData] == 10 || pWantedData[killerid][w_KillsData] == 20 || pWantedData[killerid][w_KillsData] == 30 || pWantedData[killerid][w_KillsData] == 40 || pWantedData[killerid][w_KillsData] == 50)
  75.     {
  76.         pWantedData[killerid][w_Wanted] = true;
  77.         pWantedData[killerid][w_LevelsData] ++;
  78.         pWantedData[killerid][w_RewardData] += 10000;
  79.         pWantedData[killerid][w_ScoreData] += 5;
  80.  
  81.         new name[MAX_PLAYER_NAME];
  82.         GetPlayerName(killerid, name, sizeof name);
  83.  
  84.         format(ws_StringKills, sizeof ws_StringKills, "{00FF00}Procurados | {87CEFA}O(a) miseravel do(a)  %s, ja matou '%d' noobs sem morrer!,  o(a) maluco(a) é foda! {FFFF00}(/procurados)", name, pWantedData[killerid][w_KillsData]);
  85.         SendClientMessageToAll(-1, ws_StringKills);
  86.         SetPlayerWantedLevel(killerid, pWantedData[killerid][w_LevelsData]);       
  87.     }
  88.  
  89.     return 1;
  90. }
  91. // Comandos
  92.  
  93. //Comando de teste (pode remover sem poblemas.)
  94. CMD:arma(playerid)
  95. {
  96.     GivePlayerWeapon(playerid, 24, 2000);
  97.     GivePlayerWeapon(playerid, 26, 2999);
  98.     GivePlayerWeapon(playerid, 29, 2000);
  99.  
  100.     return 1;
  101. }
  102.  
  103. CMD:procurados(playerid)
  104. {
  105.     new str_procurados[1024], string[600], namewanteds[MAX_PLAYER_NAME];
  106.  
  107.     strins(str_procurados, "Nomes\t Estrelas\t Recompensa\tScore\n", strlen(str_procurados));
  108.     for(new i; i < MAX_PLAYERS; i++)
  109.     {
  110.         if(IsPlayerConnected(i) && pWantedData[i][w_KillsData] >= 10)
  111.         {
  112.             GetPlayerName(i, namewanteds, sizeof namewanteds);
  113.             format(string, sizeof string, "{87CEFA}%s\t {87CEFA}%d\t{7FFF00}R$ {87CEFA}%d\t{87CEFA}%d\n", namewanteds, pWantedData[i][w_LevelsData], pWantedData[i][w_RewardData], pWantedData[i][w_ScoreData]);
  114.             strcat(str_procurados, string);
  115.         }
  116.     }
  117.     ShowPlayerDialog(playerid, 2001, DIALOG_STYLE_TABLIST_HEADERS, "Procurados", str_procurados, "Fechar", "");
  118.    
  119.     return 1;
  120. }
Add Comment
Please, Sign In to add comment