SA-MP Forums Archive
[FilterScript] Sprees System Simple V.1 [Sistema de Matanзa] - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: Non-English (https://sampforum.blast.hk/forumdisplay.php?fid=9)
+--- Forum: Languages (https://sampforum.blast.hk/forumdisplay.php?fid=33)
+---- Forum: Português/Portuguese (https://sampforum.blast.hk/forumdisplay.php?fid=34)
+----- Forum: Lançamentos/Releases (https://sampforum.blast.hk/forumdisplay.php?fid=56)
+----- Thread: [FilterScript] Sprees System Simple V.1 [Sistema de Matanзa] (/showthread.php?tid=341055)



Sprees System Simple V.1 [Sistema de Matanзa] - 4LiSs0N - 09.05.2012

Galera Estou Postando o Sprees System V.1
Oque tem de Novo?
A Textdraw Foi Mudada de Local
Admins na Rcon Pode Usar o Comando:
/Setspree [id] [Sprees] - Seta o spree do Player
Player Comuns Pode Usar o Comando:
/Spreeinfo [id] - Vк Quanto de spree o Player tem
Os Sprees Sao Salvos ao Desconectar do Jogo
ao Player Entrar ao Jogo Sera Setado Para quantos de Sprees que Ele tinha antes de desconectar!
os sprees dos players ficaram no arquivo "sprees.ini"

Imagem:



Includes Necesarias:
#include a_samp
#Include Dini | Usei Dini pois nao sei muito sobre outros modo de salvamento
#Include zcmd
#include sscanf2


#Code#
pawn Code:
/*|||||||||||||||||||||||Sprees System v.1 Feito Por [ZNS].[KrauZeR]_.|||4LiSs0N|||||||||||||||||||||||||||||||*/
/*============================================================================================================*/
#include <a_samp>
#include <Dini>
#include <ZCMD>
#include <sscanf2>
new     KillsSpree[MAX_PLAYERS],
        Text:InfoSpree[MAX_PLAYERS],
        Player_Name[MAX_PLAYER_NAME],
        Text:BoxSpree,
        strings[100]
;
/*============================================================================================================*/
public OnPlayerConnect(playerid)
{
   OnUpdateScore(playerid);
   LoginSpree(playerid);
   return 1;
}
/*============================================================================================================*/
public OnPlayerDisconnect(playerid, reason)
{
   printf("\nSprees de %s foram salvos\n",PlayerName(playerid));
   SaveSpree(playerid);
   return 1;
}
/*============================================================================================================*/

public OnPlayerDeath(playerid, killerid, reason)
{
    KillsSpree[killerid] ++;
    KillsSpree[playerid] = 0;

    if(KillsSpree[killerid] >= 5)
    {
        GetPlayerName(killerid, Player_Name, MAX_PLAYER_NAME);
        format(strings,256,"{33CCFF}%s{FF0023}Chegou nos {33CCFF}%d{FF0023} de Spree",PlayerName(playerid), KillsSpree[killerid]);
        SendClientMessageToAll(0xFF0023FF,strings);
    }
    OnUpdateScore(killerid);
    return 1;
}
/*============================================================================================================*/
CMD:spreeinfo(playerid, params[])
{
    new playerS;
    if(sscanf(params, "ud", playerS))
    return SendClientMessage(playerid, -1, "[ERRO] Use: /spreeinfo [id]");
    if(!IsPlayerConnected(playerS))
    return SendClientMessage(playerid, -1, "[ERRO] Jogador nгo conectado");
    GetPlayerName(playerS, Player_Name, MAX_PLAYER_NAME);
    format(strings,256,"•|INFO| Jogador %s Contem %d de Spree |•",Player_Name,KillsSpree[playerid]);
    SendClientMessageToAll(0xFF0023FF,strings);
    return 1;
}
CMD:setspree(playerid, params[])
{
    new player,sprees;
    if(!IsPlayerAdmin(playerid))
    return SendClientMessage(playerid, -1, "[ERRO] Sem autorizaзгo para usar esse comando!");
    if(sscanf(params, "ud", player,sprees))
    return SendClientMessage(playerid, -1, "[ERRO] Use: /setspree [id] [Spree]");
    if(!IsPlayerConnected(player))
    return SendClientMessage(playerid, -1, "[ERRO] Jogador nгo conectado");
    KillsSpree[player] = sprees;
    GetPlayerName(player, Player_Name, MAX_PLAYER_NAME);
    format(strings,256,"• Vocк setou o spree de %s para %d •",Player_Name,sprees);
    SendClientMessage(playerid,0xFF0023FF,strings);
    return 1;
}
/*============================================================================================================*/
public OnPlayerSpawn(playerid)
{
    TextDrawShowForPlayer(playerid,BoxSpree);
    TextDrawShowForPlayer(playerid,InfoSpree[playerid]);
    return 1;
}
/*============================================================================================================*/
public OnFilterScriptInit()
{
    for(new i, k = GetMaxPlayers(); i != k; ++i)
    {
        InfoSpree[i] = TextDrawCreate(44.000000, 285.000000," ");
        TextDrawFont(InfoSpree[i], 2);
        TextDrawLetterSize(InfoSpree[i], 0.290000, 1.300000);
        TextDrawColor(InfoSpree[i], 0x0DB0DDFF);
        TextDrawSetOutline(InfoSpree[i], 1);
        TextDrawSetProportional(InfoSpree[i], 1);
    }
/*============================================================================================================*/
    BoxSpree = TextDrawCreate(41.000000, 276.000000, "~n~");
    TextDrawBackgroundColor(BoxSpree, 255);
    TextDrawFont(BoxSpree, 1);
    TextDrawLetterSize(BoxSpree,0.370000, 3.399998);
    TextDrawColor(BoxSpree, 0);
    TextDrawSetOutline(BoxSpree, 0);
    TextDrawSetProportional(BoxSpree, 1);
    TextDrawSetShadow(BoxSpree, 1);
    TextDrawUseBox(BoxSpree, 1);
    TextDrawBoxColor(BoxSpree, 80);
    TextDrawTextSize(BoxSpree, 150.000000, 0.000000);

    if(!fexist("sprees.ini")) dini_Create("sprees.ini");
    return 1;
}
/*============================================================================================================*/
public OnPlayerUpdate(playerid)
{
    OnUpdateScore(playerid);
    return 1;
}
/*============================================================================================================*/
stock OnUpdateScore(playerid)
{
    format(strings, sizeof(strings),"Spree:~w~ %d",KillsSpree[playerid]);
    TextDrawSetString(InfoSpree[playerid],strings);
    return 1;
}
/*============================================================================================================*/
stock SaveSpree(playerid)
{
    dini_IntSet("sprees.ini",PlayerName(playerid),KillsSpree[playerid]);
    return 1;
}
/*============================================================================================================*/
stock LoginSpree(playerid)
{
    if(dini_Isset("sprees.ini",PlayerName(playerid)))  KillsSpree[playerid] = (playerid,dini_Int("sprees.ini",PlayerName(playerid)));
    return 1;
}
/*============================================================================================================*/
stock PlayerName(playerid)
{
    new Namei[MAX_PLAYERS];
    GetPlayerName(playerid, Namei, sizeof(Namei));
    return Namei;
}
/*============================================================================================================*/

Espero que Gostem
Creditos:
|[ZNS].[KrauZeR]_. | 4LiSs0N| e Garfield (OnUpdateScore)
Dispenso Criticas Comentбrios fъteis!


Re: Sprees System Simple V.1 [Sistema de Matanзa] - FriendrS - 09.05.2012

Muito Bom a Nova versгo Os players gostam disso pra eles й um desafio quem tem mais sprees
Ainda mais agora que salva parabйns o /setspree que eu gostei mais


Re: Sprees System Simple V.1 [Sistema de Matanзa] - 4LiSs0N - 09.05.2012

Vlw Friend


Re: Sprees System Simple V.1 [Sistema de Matanзa] - Hancoc - 09.05.2012

Ficou Otimo cara Concerteza vou usar
com os devidos creditos claro


Re: Sprees System Simple V.1 [Sistema de Matanзa] - 4LiSs0N - 09.05.2012

Vlw Hencoc Bom Proveito '-'


Re: Sprees System Simple V.1 [Sistema de Matanзa] - dPlaYer_ - 09.05.2012

Dini Matou tudo '-

Porem o sistema ficou legal


Re: Sprees System Simple V.1 [Sistema de Matanзa] - RoacH` - 09.05.2012

pawn Code:
if(sscanf(params, "ud", playerS))
?
@Poderias utilizar algo mas avanзado "foreach and dof2"



Re: Sprees System Simple V.1 [Sistema de Matanзa] - 'Duallity - 12.05.2012

Quote:
Originally Posted by RoacH`
View Post
pawn Code:
if(sscanf(params, "ud", playerS))
?
@Poderias utilizar algo mas avanзado "foreach and dof2"
sscanf nao й algo tao ultrapassado --'


Re: Sprees System Simple V.1 [Sistema de Matanзa] - Hiuship - 13.05.2012

Quote:
Originally Posted by 'Duallity
View Post
sscanf nao й algo tao ultrapassado --'

Ele nao disse isso... olhe o code... estб errado.. e o que ele disse era para o cara usar outras coisas ao invez doque usa...