Jump to content

[Tutorial] HudProgres (level | Raport | Vehicles)


s4uriK.Official

Recommended Posts

adaugam la variabile:
Quote

new PlayerText: HudTD[3];
new PlayerBar:HudProgress[MAX_PLAYERS][3];

adaugam la playertextdraws
Quote

HudTD[0] = CreatePlayerTextDraw(playerid, 87.999992, 269.644470, "Level: 5-6 (0/5 RP)");
    PlayerTextDrawLetterSize(playerid, HudTD[0], 0.176666, 0.865778);
    PlayerTextDrawAlignment(playerid, HudTD[0], 2);
    PlayerTextDrawColor(playerid, HudTD[0], -1);
    PlayerTextDrawSetShadow(playerid, HudTD[0], 1);
    PlayerTextDrawSetOutline(playerid, HudTD[0], 1);
    PlayerTextDrawBackgroundColor(playerid, HudTD[0], 118);
    PlayerTextDrawFont(playerid, HudTD[0], 1);
    PlayerTextDrawSetProportional(playerid, HudTD[0], 1);
    PlayerTextDrawSetShadow(playerid, HudTD[0], 1);

    HudTD[1] = CreatePlayerTextDraw(playerid, 88.000007, 304.074096, "Raport: 1-5 (0/2)");
    PlayerTextDrawLetterSize(playerid, HudTD[1], 0.176666, 0.865778);
    PlayerTextDrawAlignment(playerid, HudTD[1], 2);
    PlayerTextDrawColor(playerid, HudTD[1], -1);
    PlayerTextDrawSetShadow(playerid, HudTD[1], 1);
    PlayerTextDrawSetOutline(playerid, HudTD[1], 1);
    PlayerTextDrawBackgroundColor(playerid, HudTD[1], 118);
    PlayerTextDrawFont(playerid, HudTD[1], 1);
    PlayerTextDrawSetProportional(playerid, HudTD[1], 1);
    PlayerTextDrawSetShadow(playerid, HudTD[1], 1);
    
    HudTD[2] = CreatePlayerTextDraw(playerid, 87.000007, 235.214844, "Vehicles: 50/50");
    PlayerTextDrawLetterSize(playerid, HudTD[2], 0.176666, 0.865778);
    PlayerTextDrawAlignment(playerid, HudTD[2], 2);
    PlayerTextDrawColor(playerid, HudTD[2], -1);
    PlayerTextDrawSetShadow(playerid, HudTD[2], 1);
    PlayerTextDrawSetOutline(playerid, HudTD[2], 1);
    PlayerTextDrawBackgroundColor(playerid, HudTD[2], 118);
    PlayerTextDrawFont(playerid, HudTD[2], 1);
    PlayerTextDrawSetProportional(playerid, HudTD[2], 1);
    PlayerTextDrawSetShadow(playerid, HudTD[2], 1);

adaugam la pinfo:
Quote

pShowHud[6],

pe urma la function:
Quote

function DestroyProgress(playerid, bar) {
    HidePlayerProgressBar(playerid, HudProgress[playerid][bar]);
    PlayerTextDrawHide(playerid, HudTD[bar]);
    return 1;
}
    
function UpdateProgress(playerid, bar) {
    new string[64];
    switch(bar) {
        case 0: {
            format(string, sizeof(string), "Level: %d-%d (%d/%d RP)", PlayerInfo[playerid][pLevel], PlayerInfo[playerid][pLevel]+1, PlayerInfo[playerid][pExp], PlayerInfo[playerid][pLevel]*levelexp);
            PlayerTextDrawSetString(playerid, HudTD[bar], string);
            PlayerTextDrawShow(playerid, HudTD[bar]);
            SetPlayerProgressBarMaxValue(playerid, HudProgress[playerid][bar], PlayerInfo[playerid][pLevel]*levelexp);
            SetPlayerProgressBarValue(playerid, HudProgress[playerid][bar], PlayerInfo[playerid][pExp]);
            SetPlayerProgressBarColor(playerid, HudProgress[playerid][bar], GetHudColor(PlayerInfo[playerid][pShowHud][3]));    
        }
        case 1: {
            if(PlayerInfo[playerid][pMember] == 0) {
                PlayerInfo[playerid][pShowHud][4] = 0;
                UpdateVar(playerid, "ShowHud4", 0);
                SCM(playerid, COLOR_GRAD2, "Optiunea de a vedea progresul raportului a fost dezactivata automat!");
                DestroyProgress(playerid, bar);
                return 1;
            }
            if(PlayerInfo[playerid][pRank] >= 5) format(string, sizeof(string), "Raport: %d (%d/%d)", PlayerInfo[playerid][pRank], PlayerInfo[playerid][pCommands], GetNeedPointsR(playerid));
            else format(string, sizeof(string), "Raport: %d-%d (%d/%d)", PlayerInfo[playerid][pRank], PlayerInfo[playerid][pRank]+1, PlayerInfo[playerid][pCommands], GetNeedPointsR(playerid));
            PlayerTextDrawSetString(playerid, HudTD[bar], string);
            PlayerTextDrawShow(playerid, HudTD[bar]);
            SetPlayerProgressBarMaxValue(playerid, HudProgress[playerid][bar], GetNeedPointsR(playerid));
            SetPlayerProgressBarValue(playerid, HudProgress[playerid][bar], PlayerInfo[playerid][pCommands]);
            SetPlayerProgressBarColor(playerid, HudProgress[playerid][bar], GetHudColor(PlayerInfo[playerid][pShowHud][4]));        
        }
        case 2: {
            format(string, sizeof(string), "Vehicles: %d/%d", GetVehicles(playerid), GetSlots(playerid));
            PlayerTextDrawSetString(playerid, HudTD[bar], string);
            PlayerTextDrawShow(playerid, HudTD[bar]);
            SetPlayerProgressBarMaxValue(playerid, HudProgress[playerid][bar], GetSlots(playerid));
            SetPlayerProgressBarValue(playerid, HudProgress[playerid][bar], GetVehicles(playerid));
            SetPlayerProgressBarColor(playerid, HudProgress[playerid][bar], GetHudColor(PlayerInfo[playerid][pShowHud][5]));
        }
    }
    ShowPlayerProgressBar(playerid, HudProgress[playerid][bar]);
    return 1;
}

adaugam la OnPlayerDisconnect:
Quote

DestroyPlayerProgressBar(playerid, HudProgress[playerid][0]);
    DestroyPlayerProgressBar(playerid, HudProgress[playerid][1]);
    DestroyPlayerProgressBar(playerid, HudProgress[playerid][2]);

adaugam la setplayerunjail:
Quote

if(PlayerInfo[pShowHud][3] != 0) UpdateProgress(i, 0);
            if(PlayerInfo[pShowHud][4] != 0) UpdateProgress(i, 1);
            if(PlayerInfo[pShowHud][5] != 0) UpdateProgress(i, 2);

la comanda /hud adaugam astea 3, ultimele 3:
Quote

if(item3 != 0) format(string, 1024, "{FFFFFF}Progres Level: %s\n", HudName[item3]);
    else format(string, 1024, "{FFFFFF}Progres Level: {FF9E9E}Dezactivat\n", HudName[item3]);
    strcat(string2, string);    

    if(item4 != 0) format(string, 1024, "{FFFFFF}Progres Raport: %s\n", HudName[item4]);
    else format(string, 1024, "{FFFFFF}Progres Raport: {FF9E9E}Dezactivat\n", HudName[item4]);
    strcat(string2, string);
    
    if(item5 != 0) format(string, 1024, "{FFFFFF}Progres Vehicles: %s\n", HudName[item5]);
    else format(string, 1024, "{FFFFFF}Progres Vehicles: {FF9E9E}Dezactivat\n", HudName[item5]);
    strcat(string2, string);

la onplayerlogin
Quote

HudProgress[playerid][0] = CreatePlayerProgressBar(playerid,52.00, 282.00, 72.50, 4.19, 0x00FF00FF, 100.0);
    HudProgress[playerid][1] = CreatePlayerProgressBar(playerid,52.00, 316.00, 72.50, 4.19, 0x00FF00FF, 100.0);
    HudProgress[playerid][2] = CreatePlayerProgressBar(playerid,52.00, 248.00, 72.50, 4.19, 0x00FF00FF, 100.0);

la dialog_hud:
Quote

case 3: ShowPlayerDialog(playerid,DIALOG_HUDSELECT,DIALOG_STYLE_LIST,"Optiuni HUD: Progres level","{FF9E9E}Dezactiveaza\n{B8BFC2}Gri\n{FF0000}Rosu\n{00FF2F}Verde\n{0022FF}Albastru\n{FFFB00}Galben\n{8000FF}Mov","Ok","Inapoi"); 
                case 4: ShowPlayerDialog(playerid,DIALOG_HUDSELECT,DIALOG_STYLE_LIST,"Optiuni HUD: Progres raport","{FF9E9E}Dezactiveaza\n{B8BFC2}Gri\n{FF0000}Rosu\n{00FF2F}Verde\n{0022FF}Albastru\n{FFFB00}Galben\n{8000FF}Mov","Ok","Inapoi");
                case 5: ShowPlayerDialog(playerid,DIALOG_HUDSELECT,DIALOG_STYLE_LIST,"Optiuni HUD: Progres vehicles","{FF9E9E}Dezactiveaza\n{B8BFC2}Gri\n{FF0000}Rosu\n{00FF2F}Verde\n{0022FF}Albastru\n{FFFB00}Galben\n{8000FF}Mov","Ok","Inapoi");

la dialog_hudselect:
Quote

case 3: {
                    PlayerInfo[playerid][pShowHud][3] = listitem;
                    if(listitem == 0) DestroyProgress(playerid, 0);
                    else UpdateProgress(playerid, 0);
                    format(query, sizeof(query), "UPDATE `users` SET `ShowHud3`='%d' WHERE `ID`='%d'", PlayerInfo[playerid][pShowHud][3], PlayerInfo[playerid][pSQLID]);
                    mysql_query(SQL, query);                    
                }        
                case 4: {
                    PlayerInfo[playerid][pShowHud][4] = listitem;
                    if(listitem == 0) DestroyProgress(playerid, 1);
                    else UpdateProgress(playerid, 1);                
                    format(query, sizeof(query), "UPDATE `users` SET `ShowHud4`='%d' WHERE `ID`='%d'", PlayerInfo[playerid][pShowHud][4], PlayerInfo[playerid][pSQLID]);
                    mysql_query(SQL, query);
                }
                case 5: {
                    PlayerInfo[playerid][pShowHud][5] = listitem;
                    if(listitem == 0) DestroyProgress(playerid, 2);
                    else UpdateProgress(playerid, 2);
                    format(query, sizeof(query), "UPDATE `users` SET `ShowHud5`='%d' WHERE `ID`='%d'", PlayerInfo[playerid][pShowHud][5], PlayerInfo[playerid][pSQLID]);
                    mysql_query(SQL, query);
                }

 poza: GvmEa5G.png

Edited by s4uriK

                     

  Serverul meu de Discord: Click aici       a7DfKP7.gif                                                                      FGIfknL.gif

k35T5Nb.png                                                                                                                                                                                                                                                                                                I0aS856.gif

Link to comment
Share on other sites

Acum 54 minute, s4uriK a spus:

adaugam la variabile:

adaugam la playertextdraws

adaugam la pinfo:

pe urma la function:

adaugam la OnPlayerDisconnect:

adaugam la setplayerunjail:

la comanda /hud adaugam astea 3, ultimele 3:

la onplayerlogin

la dialog_hud:

la dialog_hudselect:

 poza: GvmEa5G.png

Bv fratica <3 :*

  • Upvote 1
Link to comment
Share on other sites

11 minutes ago, Mr.Floryn said:

Bv fratica <3 :*

Ms frate <3 :*

                     

  Serverul meu de Discord: Click aici       a7DfKP7.gif                                                                      FGIfknL.gif

k35T5Nb.png                                                                                                                                                                                                                                                                                                I0aS856.gif

Link to comment
Share on other sites

On 14.04.2017 at 4:15 PM, Geani said:

bun tutorial felicitari!

Ms <3

                     

  Serverul meu de Discord: Click aici       a7DfKP7.gif                                                                      FGIfknL.gif

k35T5Nb.png                                                                                                                                                                                                                                                                                                I0aS856.gif

Link to comment
Share on other sites

La 13.04.2017 la 20:14, s4uriK a spus:

adaugam la variabile:

adaugam la playertextdraws

adaugam la pinfo:

pe urma la function:

adaugam la OnPlayerDisconnect:

adaugam la setplayerunjail:

la comanda /hud adaugam astea 3, ultimele 3:

la onplayerlogin

la dialog_hud:

la dialog_hudselect:

 poza: GvmEa5G.png

Frumos tutorial, rezultatul final ma da pe spate. Cand mai faci un tutorial, nu uita de limba romana si de cei newbie ;)

Link to comment
Share on other sites

  • 1 month later...
  • 2 weeks later...
7 hours ago, mrtea said:

Si unde este acel function? De ex la mine in gamemode nu este ?!

adaugi la finalul gamemodeului sunt niste functii libere care trebuie adaugate la final

 

    __  ____      __           
   /  |/  (_)____/ /____  _____
  / /|_/ / / ___/ __/ _ \/ ___/
 / /  / / (__  ) /_/  __/ /    
/_/  /_/_/____/\__/\___/_/     
SERVICII SCRIPTING DE CALITATE
Pagina     Scripting     pawn
Link to comment
Share on other sites

3 minutes ago, mrtea said:

imi da undefined function!

adaugi asta la inceputul gamemodeului dupa #includeuri

#define function%0(%1) forward%0(%1); public%0(%1)

 

    __  ____      __           
   /  |/  (_)____/ /____  _____
  / /|_/ / / ___/ __/ _ \/ ___/
 / /  / / (__  ) /_/  __/ /    
/_/  /_/_/____/\__/\___/_/     
SERVICII SCRIPTING DE CALITATE
Pagina     Scripting     pawn
Link to comment
Share on other sites

  • 2 weeks later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more details you can also review our Terms of Use and Privacy Policy.