Jump to content

[REZOLVAT] Problema functie CheckLevelProgress


ionchyAdv
 Share

Recommended Posts

Salut, am si eu o problema. Acum 5/6 luni am inceput un edit cu conceptia unui gamemode care sa duca spre nephrite, am luat o functie dintr-un gamemode, aceasta numindu-se ( giveexp respectiv CheckLevelProgress). La inceput cand avansa in nivel automat, ii seta experienta pe 0, asa ca am decis sa fac sa-i seteze exeperienta in felul urmator ( PlayerInfo[playerid][pExp] = PlayerInfo[playerid][pExp] - PlayerInfo[playerid][pNeedExp]; ). Acum am o problema legata de textdraw, dar si la functia giveexp. De exemplu daca eu fac printr-o comanda sa-i dea 1000 exp, si el are 0/300, creste in nivel si ii ramane 700/600, odata ce avanseaza in nivel creste si pNeedExp. Si atunci daca pExp este mai mare ca pNeedExp se ajunge la asta LINK . As putea face intr-un anumit fel, sa pot sa cresc de mai multe ori in nivel daca am mai multa experienta decat cea de care am nevoie? Sau macar sa pot face sa nu treaca de 100% la td? Va multumesc.

COD: 

function CheckLevelProgress(const playerid) {
    new Float: textdrawProcent = (267 + PlayerInfo[playerid][pExp] * 100 / PlayerInfo[playerid][pNeedExp]);
    gString[0] = EOS;
	format(gString, 100, "_LEVEL %d (%d%s)", PlayerInfo[playerid][pLevel], (PlayerInfo[playerid][pExp] * 100 / PlayerInfo[playerid][pNeedExp]),"%");
	PlayerTextDrawSetString(playerid, LevelTD[playerid][0], gString);
    PlayerTextDrawShow(playerid, LevelTD[playerid][0]), PlayerTextDrawShow(playerid, LevelTD[playerid][1]);
    PlayerTextDrawTextSize(playerid, LevelTD[playerid][2], textdrawProcent, 0.000000);
    PlayerTextDrawHide(playerid, LevelTD[playerid][2]), PlayerTextDrawShow(playerid, LevelTD[playerid][2]);
	return true; }

function giveExp(const playerid, expAmount) {
    new lastExp; gString[0] = EOS;
    if(gPlayerLogged[playerid] == 1) {
        if(!expAmount) expAmount = 1;
        PlayerInfo[playerid][pExp] += expAmount;
        format(gString, 42, "+%d EXPERIENCE", expAmount);
        GameTextForPlayer(playerid, gString, 3000, 1);
        format(gString, 144, "Ai primit %d puncte de experienta (total %d). Ai nevoie de %d puncte pentru a avansa la level %d.",expAmount,PlayerInfo[playerid][pExp],PlayerInfo[playerid][pNeedExp],PlayerInfo[playerid][pLevel]+1);
        SCM(playerid, 0xFFD700FF, gString);
        if(PlayerInfo[playerid][pExp] >= PlayerInfo[playerid][pNeedExp]) {
            PlayerInfo[playerid][pExp] = PlayerInfo[playerid][pExp] - PlayerInfo[playerid][pNeedExp];
            lastExp = PlayerInfo[playerid][pNeedExp];

            PlayerInfo[playerid][pNeedExp] = PlayerInfo[playerid][pNeedExp] + 300;
        	PlayerInfo[playerid][pLevel] ++;
        	SetPlayerScore(playerid, PlayerInfo[playerid][pLevel]);
        	format(gString, 144, "Ai avansat la level %d deoarece ai acumulat %d puncte de experienta.", PlayerInfo[playerid][pLevel], lastExp);
        	SCM(playerid, 0xFFD700FF, gString);
        }
        CheckLevelProgress(playerid);
        gQuery[0] = EOS;
        mysql_format(SQL, gQuery, sizeof(gQuery), "UPDATE `users` SET `Respect` = '%d', `Level` = '%d', `NeedExp` = '%d' WHERE `ID` = '%d' LIMIT 1;", PlayerInfo[playerid][pExp], PlayerInfo[playerid][pLevel], PlayerInfo[playerid][pNeedExp], PlayerInfo[playerid][pSQLID]);
        mysql_tquery(SQL, gQuery, "", "");
    }
    return true; }

 

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...