Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*******************************************************************************
- ********************************************************************************
- ************************** Feito por Josma_CMD ******************************
- ********************************************************************************
- ********************************************************************************
- */
- #include <a_samp>
- #include <SII>
- const Branco = 0xFFFFFFFF;
- enum PInfo { Matou, Morreu, Pontos, Text:TPontos, bool:Connectado, };
- new ProgressaoInfo[MAX_PLAYERS][PInfo];
- new arquivo[50];
- forward SalvarInformacoes(playerid);
- forward CarregarInformacoes(playerid);
- public OnFilterScriptInit()
- {
- print("\n--------------------------------------");
- print(" Sistema de Pontos feito por Josma_CMD");
- print("--------------------------------------\n");
- return true;
- }
- public OnFilterScriptExit()
- {
- for(new i = 0, PP = GetMaxPlayers(); i <= PP; i++)
- {
- if(!IsPlayerConnected(i)) continue;
- TextDrawDestroy(ProgressaoInfo[i][TPontos]);
- }
- return true;
- }
- public OnPlayerConnect(playerid)
- {
- CarregarInformacoes(playerid);
- //********************************* Pontos *********************************
- ProgressaoInfo[playerid][TPontos] = TextDrawCreate(496.000000, 105.000000, "~l~Pontos: ~b~953");
- TextDrawBackgroundColor(ProgressaoInfo[playerid][TPontos], 16777215);
- TextDrawFont(ProgressaoInfo[playerid][TPontos], 2);
- TextDrawLetterSize(ProgressaoInfo[playerid][TPontos], 0.420000, 1.400000);
- TextDrawColor(ProgressaoInfo[playerid][TPontos], -1);
- TextDrawSetOutline(ProgressaoInfo[playerid][TPontos], 1);
- TextDrawSetProportional(ProgressaoInfo[playerid][TPontos], 1);
- return true;
- }
- public OnPlayerDisconnect(playerid, reason)
- {
- SalvarInformacoes(playerid);
- TextDrawDestroy(ProgressaoInfo[playerid][TPontos]);
- return true;
- }
- public OnPlayerSpawn(playerid)
- {
- if(ProgressaoInfo[playerid][Connectado] == false)
- {
- new string[20];
- ProgressaoInfo[playerid][Pontos] = (ProgressaoInfo[playerid][Matou] - ProgressaoInfo[playerid][Morreu]);
- format(string, sizeof(string), "~l~Pontos: ~b~%d", ProgressaoInfo[playerid][Pontos]);
- TextDrawSetString(ProgressaoInfo[playerid][TPontos], string);
- TextDrawShowForPlayer(playerid, ProgressaoInfo[playerid][TPontos]);
- }
- return true;
- }
- public OnPlayerDeath(playerid, killerid, reason)
- {
- new Texto[30], Texto1[30];
- ProgressaoInfo[killerid][Matou] ++;
- ProgressaoInfo[playerid][Morreu] ++;
- ProgressaoInfo[killerid][Pontos] = (ProgressaoInfo[killerid][Matou] - ProgressaoInfo[killerid][Morreu]);
- ProgressaoInfo[playerid][Pontos] = (ProgressaoInfo[playerid][Matou] - ProgressaoInfo[playerid][Morreu]);
- format(Texto, sizeof(Texto), "~l~Pontos: ~b~%d", ProgressaoInfo[killerid][Pontos]);
- TextDrawSetString(ProgressaoInfo[killerid][TPontos], Texto);
- TextDrawShowForPlayer(killerid, ProgressaoInfo[killerid][TPontos]);
- format(Texto1, sizeof(Texto1), "~l~Pontos: ~b~%d", ProgressaoInfo[playerid][Pontos]);
- TextDrawSetString(ProgressaoInfo[playerid][TPontos], Texto1);
- TextDrawShowForPlayer(playerid, ProgressaoInfo[playerid][TPontos]);
- SetPlayerScore(playerid, ProgressaoInfo[playerid][Pontos]);
- SetPlayerScore(killerid, ProgressaoInfo[killerid][Pontos]);
- return true;
- }
- public SalvarInformacoes(playerid)
- {
- format(arquivo, sizeof(arquivo), "/PontosInfo/%s.ini",pNome(playerid));
- INI_Open(arquivo);
- INI_WriteInt("Matou", ProgressaoInfo[playerid][Matou]);
- INI_WriteInt("Morreu", ProgressaoInfo[playerid][Morreu]);
- INI_Save();
- INI_Close();
- return true;
- }
- public CarregarInformacoes(playerid)
- {
- format(arquivo, sizeof(arquivo), "/PontosInfo/%s.ini",pNome(playerid));
- if(fexist(arquivo))
- {
- INI_Open(arquivo);
- ProgressaoInfo[playerid][Matou] = INI_ReadInt("Matou");
- ProgressaoInfo[playerid][Morreu] = INI_ReadInt("Morreu");
- INI_Close();
- }
- else SalvarInformacoes(playerid);
- return true;
- }
- stock pNome(playerid)
- {
- new nome[MAX_PLAYER_NAME];
- GetPlayerName(playerid, nome, sizeof(nome));
- return nome;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement