/*|||||||||||||||||||||||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;
}
/*============================================================================================================*/
if(sscanf(params, "ud", playerS))
pawn Code:
@Poderias utilizar algo mas avanзado "foreach and dof2" |