Quantcast
Channel: SA-MP Forums
Viewing all articles
Browse latest Browse all 18226

[Ajuda] Ligar Text Draw no sistema de Exp

$
0
0
Eae galera Blz ?, Eu to precisando de uma ajuda pois eu não to sabendo como fazer, eu quero ligar a textdraw nesse sistema de exp aqui, eu tentei fazer a progressbar mais não ficou do jeito que eu queria ent eu fiz com textdraw.

Por favor preciso muito, já agradeço de coração quem ajudar <3.

Sistema de Exp Por level.
Code:

// This is a comment
// uncomment the line below if you want to write a filterscript
//#define FILTERSCRIPT

#include <a_samp>
#include <dini> //include de salvamento de dados.
#include <progress> //para podermos usa as funções

#define COR_EXP                                                                                                          0xFFD000FF

new EXP[MAX_PLAYERS], Score[MAX_PLAYERS]; // Variáveis de armazenamento de dados.
new TimerEXP[MAX_PLAYERS]; // Variável de armazenamento de Timer.
new Bar:EXPP;

#if defined FILTERSCRIPT

public OnFilterScriptInit()
{
        print("\n--------------------------------------");
        print(" Blank Filterscript by your name here");
        print("--------------------------------------\n");
        return 1;
}

public OnFilterScriptExit()
{
        return 1;
}

#else

main()
{
        print("\n----------------------------------");
        print(" Blank Gamemode by your name here");
        print("----------------------------------\n");
}

#endif

public OnGameModeInit()
{
        EXPP = CreateProgressBar(548.00, 32.00, 59.50, 4.19, -3145473, 100.0); //essa posição e em baixo da tela, tu criar uma progress etc
        SetProgressBarMaxValue(EXPP, 60); //vou da o valor maximo a ela de 60 pq são 6 upzzinhos ate o up(meu jeito :))
        // Don't use these lines if it's a filterscript
        SetGameModeText("Blank Script");
        AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
        return 1;
}

public OnGameModeExit()
{
        HideProgressBarForAll(EXPP);
        return 1;
}

public OnPlayerRequestClass(playerid, classid)
{
        SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
        SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
        SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
        return 1;
}

public OnPlayerConnect(playerid)
{
        new arq[128]; // Variavel que armazena o caminho do arquivo da conta.
        format(arq, sizeof(arq), "Contas/%s.ini", PlayerName(playerid)); //Formatando a variável para o caminho do arquivo usando seu nick.
        if(dini_Exists(arq)) //Verificando se o arquivo existe
        {
            EXP[playerid] = dini_Int(arq, "EXP"); //Getando a informação do arquivo para variável.
            Score[playerid] = dini_Int(arq, "Score"); // o mesmo dito a cima
            TimerEXP[playerid] = SetTimerEx("OnPlayerEXP", 600000, true, "d", playerid); // criando um timer de 10 minutos que se repetirá até ser destruído.
        }
        return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
        new arq[128]; // Variavel que armazena o caminho do arquivo da conta.
        format(arq, sizeof(arq), "Contas/%s.ini", PlayerName(playerid)); //Formatand a variavel para o caminho do arquivo usando seu nick.
        if(!dini_Exists(arq)) dini_Create(arq); // Verifica se o arquivo NÃO existe, para poder cria-lo.
        dini_IntSet(arq, "EXP", EXP[playerid]); //Geta as informações da variavel para o arquivo.
        dini_IntSet(arq, "Score", Score[playerid]);// o mesmo dito a cima
        KillTimer(TimerEXP[playerid]); //Destroi o timer.
        return 1;
}

public OnPlayerSpawn(playerid)
{
          ShowProgressBarForPlayer(playerid, EXPP);
    SetProgressBarColor(EXPP, COR_EXP);
        return 1;
}

public OnPlayerDeath(playerid, killerid, reason)
{
        return 1;
}

public OnVehicleSpawn(vehicleid)
{
        return 1;
}

public OnVehicleDeath(vehicleid, killerid)
{
        return 1;
}

public OnPlayerText(playerid, text[])
{
        return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
        if (strcmp("/mycommand", cmdtext, true, 10) == 0)
        {
                // Do something here
                return 1;
        }
        return 0;
}

public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
        return 1;
}

public OnPlayerExitVehicle(playerid, vehicleid)
{
        return 1;
}

public OnPlayerStateChange(playerid, newstate, oldstate)
{
        return 1;
}

public OnPlayerEnterCheckpoint(playerid)
{
        return 1;
}

public OnPlayerLeaveCheckpoint(playerid)
{
        return 1;
}

public OnPlayerEnterRaceCheckpoint(playerid)
{
        return 1;
}

public OnPlayerLeaveRaceCheckpoint(playerid)
{
        return 1;
}

public OnRconCommand(cmd[])
{
        return 1;
}

public OnPlayerRequestSpawn(playerid)
{
        return 1;
}

public OnObjectMoved(objectid)
{
        return 1;
}

public OnPlayerObjectMoved(playerid, objectid)
{
        return 1;
}

public OnPlayerPickUpPickup(playerid, pickupid)
{
        return 1;
}

public OnVehicleMod(playerid, vehicleid, componentid)
{
        return 1;
}

public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
{
        return 1;
}

public OnVehicleRespray(playerid, vehicleid, color1, color2)
{
        return 1;
}

public OnPlayerSelectedMenuRow(playerid, row)
{
        return 1;
}

public OnPlayerExitedMenu(playerid)
{
        return 1;
}

public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
{
        return 1;
}

public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
        return 1;
}

public OnRconLoginAttempt(ip[], password[], success)
{
        return 1;
}

public OnPlayerUpdate(playerid)
{
        return 1;
}

public OnPlayerStreamIn(playerid, forplayerid)
{
        return 1;
}

public OnPlayerStreamOut(playerid, forplayerid)
{
        return 1;
}

public OnVehicleStreamIn(vehicleid, forplayerid)
{
        return 1;
}

public OnVehicleStreamOut(vehicleid, forplayerid)
{
        return 1;
}

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
        return 1;
}

public OnPlayerClickPlayer(playerid, clickedplayerid, source)
{
        return 1;
}
forward OnPlayerEXP(playerid); //Declarando a callback
public OnPlayerEXP(playerid) // criando a callback
{
    if(EXP[playerid] == 1)
    {
          SetProgressBarValue(EXPP, 10.0);
          UpdateProgressBar(EXPP, playerid);
          PlayerPlaySound(playerid,1149,0.0,0.0,0.0), GameTextForPlayer(playerid,"+>EXP!",1000,2);
          EXP[playerid] ++; //somando + 1 no valor atual da variável.
          SendClientMessage(playerid, -1, "**Você somou + 1 EXP.");
    }
    if(EXP[playerid] == 2)
    {
          SetProgressBarValue(EXPP, 20.0);
          UpdateProgressBar(EXPP, playerid);
          PlayerPlaySound(playerid,1149,0.0,0.0,0.0), GameTextForPlayer(playerid,"+>EXP!",1000,2);
          EXP[playerid] ++; //somando + 1 no valor atual da variável.
          SendClientMessage(playerid, -1, "**Você somou + 1 EXP.");
    }
    if(EXP[playerid] == 3)
    {
          SetProgressBarValue(EXPP, 30.0);
          UpdateProgressBar(EXPP, playerid);
          PlayerPlaySound(playerid,1149,0.0,0.0,0.0), GameTextForPlayer(playerid,"+>EXP!",1000,2);
          EXP[playerid] ++; //somando + 1 no valor atual da variável.
          SendClientMessage(playerid, -1, "**Você somou + 1 EXP.");
    }
    if(EXP[playerid] == 4)
    {
          SetProgressBarValue(EXPP, 40.0);
          UpdateProgressBar(EXPP, playerid);
          PlayerPlaySound(playerid,1149,0.0,0.0,0.0), GameTextForPlayer(playerid,"+>EXP!",1000,2);
          EXP[playerid] ++; //somando + 1 no valor atual da variável.
          SendClientMessage(playerid, -1, "**Você somou + 1 EXP.");
    }
    if(EXP[playerid] == 5)
    {
          SetProgressBarValue(EXPP, 50.0);
          UpdateProgressBar(EXPP, playerid);
          PlayerPlaySound(playerid,1149,0.0,0.0,0.0), GameTextForPlayer(playerid,"+>EXP!",1000,2);
          EXP[playerid] ++; //somando + 1 no valor atual da variável.
          SendClientMessage(playerid, -1, "**Você somou + 1 EXP.");
    }
    if(EXP[playerid] == 6)
    {
          SetProgressBarValue(EXPP, 60.0);
          UpdateProgressBar(EXPP, playerid);
          Score[playerid]++; //Soma um level na variável.
          EXP[playerid] = 0; //Seta o EXP para 0 pois o player ja somou 6 EXP de 10 minutos totalizando 1 hora.
          SetPlayerScore(playerid, Score[playerid]);
          PlayerPlaySound(playerid,1149,0.0,0.0,0.0), GameTextForPlayer(playerid,">UP<",1000,2);

          SendClientMessage(playerid, -1, "**Você upou + 1 Score."); //Manda uma msg avisando.
          SetProgressBarValue(EXPP, -00.0);
          UpdateProgressBar(EXPP, playerid);
    }
}

stock PlayerName(playerid) // Este code getará o nick do Player.
{
    new Nome[MAX_PLAYER_NAME];
    GetPlayerName(playerid, Nome, sizeof(Nome));
    return Nome;
}

TextDraw
Code:

tExp[0] = TextDrawCreate(610.548950, 65.800003, "SANGUE");
        TextDrawLetterSize(tExp[0], 0.144703, 0.859999);
        TextDrawAlignment(tExp[0], 1);
        TextDrawColor(tExp[0], -1);
        TextDrawSetShadow(tExp[0], 0);
        TextDrawSetOutline(tExp[0], 0);
        TextDrawBackgroundColor(tExp[0], 255);
        TextDrawFont(tExp[0], 2);
        TextDrawSetProportional(tExp[0], 1);
        TextDrawSetShadow(tExp[0], 0);

        tExp[1] = TextDrawCreate(610.057189, 44.416702, "COLETE");
        TextDrawLetterSize(tExp[1], 0.145419, 0.867497);
        TextDrawAlignment(tExp[1], 1);
        TextDrawColor(tExp[1], -1);
        TextDrawSetShadow(tExp[1], 0);
        TextDrawSetOutline(tExp[1], 0);
        TextDrawBackgroundColor(tExp[1], 255);
        TextDrawFont(tExp[1], 2);
        TextDrawSetProportional(tExp[1], 1);
        TextDrawSetShadow(tExp[1], 0);

        tExp[2] = TextDrawCreate(610.599670, 29.683422, "EXP");
        TextDrawLetterSize(tExp[2], 0.179324, 0.888332);
        TextDrawAlignment(tExp[2], 1);
        TextDrawColor(tExp[2], -1);
        TextDrawSetShadow(tExp[2], 0);
        TextDrawSetOutline(tExp[2], 0);
        TextDrawBackgroundColor(tExp[2], 255);
        TextDrawFont(tExp[2], 2);
        TextDrawSetProportional(tExp[2], 1);
        TextDrawSetShadow(tExp[2], 0);

        tExp[3] = TextDrawCreate(560.928771, 16.983369, "LEVEL");
        TextDrawLetterSize(tExp[3], 0.272071, 1.274165);
        TextDrawAlignment(tExp[3], 1);
        TextDrawColor(tExp[3], -1);
        TextDrawSetShadow(tExp[3], 0);
        TextDrawSetOutline(tExp[3], 0);
        TextDrawBackgroundColor(tExp[3], 255);
        TextDrawFont(tExp[3], 2);
        TextDrawSetProportional(tExp[3], 1);
        TextDrawSetShadow(tExp[3], 0);

        tExp[4] = TextDrawCreate(577.266174, 6.200024, "1");
        TextDrawLetterSize(tExp[4], 0.295987, 1.349166);
        TextDrawAlignment(tExp[4], 2);
        TextDrawColor(tExp[4], 0xFFD000FF);
        TextDrawSetShadow(tExp[4], 0);
        TextDrawSetOutline(tExp[4], 0);
        TextDrawBackgroundColor(tExp[4], -65281);
        TextDrawFont(tExp[4], 2);
        TextDrawSetProportional(tExp[4], 1);
        TextDrawSetShadow(tExp[4], 0);

        tExp[5] = TextDrawCreate(547.481323, 31.816696, "box"); //PRETO
        TextDrawLetterSize(tExp[5], 0.000000, 0.583723);
        TextDrawTextSize(tExp[5], 605.579956, 0.000000);
        TextDrawAlignment(tExp[5], 1);
        TextDrawColor(tExp[5], 255);
        TextDrawUseBox(tExp[5], 1);
        TextDrawBoxColor(tExp[5], 255);
        TextDrawSetShadow(tExp[5], 0);
        TextDrawSetOutline(tExp[5], 0);
        TextDrawBackgroundColor(tExp[5], 41215);
        TextDrawFont(tExp[5], 1);
        TextDrawSetProportional(tExp[5], 1);
        TextDrawSetShadow(tExp[5], 0);

        tExp[6] = TextDrawCreate(548.992797, 33.566642, "box"); //AMARELOESCURO
        TextDrawLetterSize(tExp[6], 0.000000, 0.207905);
        TextDrawTextSize(tExp[6], 604.000000, 0.000000);
        TextDrawAlignment(tExp[6], 1);
        TextDrawColor(tExp[6], 255);
        TextDrawUseBox(tExp[6], 1);
        TextDrawBoxColor(tExp[6], -2139094785);
        TextDrawSetShadow(tExp[6], 0);
        TextDrawSetOutline(tExp[6], 0);
        TextDrawBackgroundColor(tExp[6], 41215);
        TextDrawFont(tExp[6], 1);
        TextDrawSetProportional(tExp[6], 1);
        TextDrawSetShadow(tExp[6], 0);

        tExp[7] = TextDrawCreate(578.928466, 29.666664, "10/50");
        TextDrawLetterSize(tExp[7], 0.196660, 0.894165);
        TextDrawAlignment(tExp[7], 2);
        TextDrawColor(tExp[7], -1);
        TextDrawSetShadow(tExp[7], 0);
        TextDrawSetOutline(tExp[7], 0);
        TextDrawBackgroundColor(tExp[7], 255);
        TextDrawFont(tExp[7], 2);
        TextDrawSetProportional(tExp[7], 1);
        TextDrawSetShadow(tExp[7], 0);

        tExp[8] = TextDrawCreate(548.998657, 33.449985, "box"); //AMARELOCLARO
        TextDrawLetterSize(tExp[8], 0.000000, 0.174053);
        TextDrawTextSize(tExp[8], 565.000000, 0.000000);
        TextDrawAlignment(tExp[8], 1);
        TextDrawColor(tExp[8], 255);
        TextDrawUseBox(tExp[8], 1);
        TextDrawBoxColor(tExp[8], 0xFFD000FF);
        TextDrawSetShadow(tExp[8], 0);
        TextDrawSetOutline(tExp[8], 0);
        TextDrawBackgroundColor(tExp[8], 41215);
        TextDrawFont(tExp[8], 1);
        TextDrawSetProportional(tExp[8], 1);
        TextDrawSetShadow(tExp[8], 0);

        tExp[9] = TextDrawCreate(548.750000, 53.316658, "MANUTENCAO");
        TextDrawLetterSize(tExp[9], 0.208124, 1.022500);
        TextDrawAlignment(tExp[9], 1);
        TextDrawColor(tExp[9], -2147483393);
        TextDrawSetShadow(tExp[9], 0);
        TextDrawSetOutline(tExp[9], 0);
        TextDrawBackgroundColor(tExp[9], 255);
        TextDrawFont(tExp[9], 2);
        TextDrawSetProportional(tExp[9], 1);
        TextDrawSetShadow(tExp[9], 0);


Viewing all articles
Browse latest Browse all 18226

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>