Jump to content

[DELETED]Problema la ShowStats!!!!


MrGreen
 Share

Recommended Posts

Deci incerc sa fac ShowStats-ul de pe gamemode-ul Burned sa arate ca cel de pe ruby. Aveti mai jos functia ShowStats. Dar cand intru pe server nu apar primele 3 coloane: General, Account, Balance. Ma putei ajuta, am marit si string-urile si degeaba.

Quote

function ShowStats(playerid,targetid) {
    if(!IsPlayerConnected(playerid) || !IsPlayerConnected(targetid)) return true;
    new
        string[1024],
        string2[1024],
        string3[1024],
        atext[20],
        ttext[180],
        rtext[180],
        jtext[100],
        drank[20],
        vtext[20],
        infostring2[1024],
        playersip[180],
        radios[64],
        infostring[1024],
    
        crimes = PlayerInfo[targetid][pCrimes],
        arrests = PlayerInfo[targetid][pArrested],
        drugs = PlayerInfo[targetid][pDrugs],
        mats = PlayerInfo[targetid][pMats],
        level = PlayerInfo[targetid][pLevel],
        exp = PlayerInfo[targetid][pExp],
        nxtlevel = PlayerInfo[targetid][pLevel],
        expamount,
        costlevel,
        pnumber = PlayerInfo[targetid][pPhone],
        rob = PlayerInfo[targetid][pRob],    
        warn = PlayerInfo[targetid][pWarns],
        hkey = PlayerInfo[targetid][pHouse],
        bkey = PlayerInfo[targetid][pBizz],
        clan = PlayerInfo[targetid][pClan];

    if(PlayerInfo[targetid][pMember] == 0) ttext = "None";
    else format(ttext, sizeof(ttext), "%s (rank %d)", FactionName(PlayerInfo[targetid][pMember]), PlayerInfo[targetid][pRank]);
    
    if(PlayerInfo[targetid][pSex] == 1) atext = "Male"; 
    else if(PlayerInfo[targetid][pSex] == 2) atext = "Female"; 
    
    if(PlayerInfo[targetid][pRank] != 0) format(rtext, 256, GetRankName(targetid));
    else rtext = "-";
   
    if(PlayerInfo[targetid][pJob] == 0) jtext = "None";
    else format(jtext, sizeof(jtext), "%s", JobInfo[PlayerInfo[targetid][pJob]][jName]);
    
    if(PlayerInfo[targetid][pPremiumAccount] == 0) { drank = "No"; }
    else if(PlayerInfo[targetid][pPremiumAccount] == 1) { drank = "Yes"; }
    else { drank = "Nu"; }
    new vouchers = PlayerInfo[targetid][pVoucher][0] + PlayerInfo[targetid][pVoucher][1] + PlayerInfo[targetid][pVoucher][2];

    if(PlayerInfo[targetid][pVip] == 0) { vtext = "No"; }
    else if(PlayerInfo[targetid][pVip] == 1) { vtext = "Yes"; }        
    
    expamount = nxtlevel*levelexp;
    costlevel = nxtlevel*levelcost;


    if(WTChannel[playerid] == 0) radios = "Disabled";
    else format(radios, sizeof(radios), "#%d khz", WTChannel[playerid]);
    format(string, sizeof(string3), "{004ca3}General:{ffffff} %s[%d], Playing hours: %.2f, Warns: %d/3 | Phone: %d (%d credit)", GetNameEx(targetid), targetid, PlayerInfo[targetid][pConnectTime], warn, pnumber, PlayerInfo[targetid][pCredit]);
    SCM(playerid, COLOR_WHITE,string3);
    format(string, sizeof(string3), "{004ca3}Account:{ffffff} Level: %d, Respect Points: %d/%d | Next Level: %s ", level, exp, expamount, FormatNumber(costlevel));
    SCM(playerid, COLOR_WHITE,string3);
    format(string, sizeof(string2), "{004ca3}Balance:{ffffff} Money: $%s | Bank: $%s", GetCashStr(targetid), GetBankMoney(targetid));
    SCM(playerid, COLOR_WHITE,string2);
    format(string, sizeof(string), "{004ca3}Shop:{ffffff} Premium Account: %s | Vip Account: %s | Premium Points: %s", drank,vtext, FormatNumber(PlayerInfo[targetid][pPremiumPoints]));
    SCM(playerid, COLOR_WHITE,string);
    format(string, sizeof(string), "{004ca3}Other:{ffffff} Crimes: %d | Arrests: %d | Drugs: %d | Materials: %d | Freq: %s | Rob: %d/10 | Escape: %d/20 | Hiddens: %d", crimes, arrests, drugs, mats, radios, rob, PlayerInfo[targetid][pEscapePoints], PlayerInfo[targetid][pHidden]);
    SCM(playerid, COLOR_WHITE,string);
    format(string, sizeof(string), "{004ca3}Faction:{ffffff} Faction: %s | Faction Warns: %d/3 | Faction Punish: %d/30", ttext, PlayerInfo[targetid][pFACWarns],PlayerInfo[targetid][pFpunish]);
    SCM(playerid, COLOR_WHITE,string);
    format(string, sizeof(string), "{004ca3}Crates:{ffffff} Rare Crates: %d | Epic Crates: %d | Legendary Crates: %d | Vouchers: %d | RPoints: %s | Gift Points: %d/500", PlayerInfo[targetid][pCrates][0], PlayerInfo[targetid][pCrates][1], PlayerInfo[targetid][pCrates][2], vouchers, FormatNumber(PlayerInfo[targetid][pHpoints]), PlayerInfo[targetid][pGiftPoints]);
    SCM(playerid, COLOR_WHITE,string);
    if(clan != 0) {
        if(PlayerInfo[targetid][pClanRank] < 6) format(string, sizeof(string), "{004ca3}Clan:{ffffff} %s (%d) | Tag: %s | Rank: %d | Clan Warns: %d/3", ClanInfo[clan][clName], clan, ClanInfo[clan][clTag], PlayerInfo[targetid][pClanRank], PlayerInfo[targetid][pClanWarn]);
        else format(string, sizeof(string), "{004ca3}Clan:{ffffff} %s (%d) | Tag: %s | Rank: %d | Clan Warns: %d/3 | Clan Days: %d", ClanInfo[clan][clName], clan, ClanInfo[clan][clTag], PlayerInfo[targetid][pClanRank], PlayerInfo[targetid][pClanWarn], ClanInfo[clan][clDays]);                        
        SCM(playerid, COLOR_WHITE, string);
    }
    if(Iter_Count(MyVehicle[targetid]) >= 0) {
        format(string, sizeof(string), "Propieters: Vehicles: %d/%d", Iter_Count(MyVehicle[targetid]), GetSlots(targetid));
        strcat(infostring, string);        
    }
    if(hkey != 999) {
        if(hkey != 999 && strcmp(GetName(targetid), HouseInfo[hkey][hOwner], true) == 0) format(string, sizeof(string), " | House: %d", hkey);
        else format(string, sizeof(string), " | Rent House: %d", hkey);
        strcat(infostring, string);
    }    
    if(bkey != 255) {
        if(bkey >= 100) format(string, sizeof(string), " | Static Business: %d", bkey-100);
        else  format(string, sizeof(string), " | Business: %d", bkey);
        strcat(infostring, string);
    }    
    if(PlayerInfo[targetid][pAdmin] != 0) {
        format(string, sizeof(string), " | Admin warns: %d/3", PlayerInfo[targetid][pAW]);
        strcat(infostring, string);        
    }        
    if(PlayerInfo[targetid][pHelper] != 0) {
        format(string, sizeof(string), " | Helper warns: %d/3", PlayerInfo[targetid][pHW]);
        strcat(infostring, string);        
    }        
    if(PlayerInfo[targetid][pLeader] != 0) {
        format(string, sizeof(string), " | Leader warns: %d/3", PlayerInfo[targetid][pLW]);
        strcat(infostring, string);        
    }                    
    format(infostring2, strlen(infostring)-1, "%s", infostring);
    SCM(playerid, COLOR_WHITE, infostring2);
        
    if(PlayerInfo[targetid][pAdmin] >= 1 || PlayerInfo[targetid][pHelper] >= 1) {
        if(PlayerInfo[targetid][pAdmin] != 0) {
            if(targetid == playerid) format(string, sizeof(string), "Ai ajutat %d jucatori pana acum. Jucatori ajutati saptamana aceasta: %d", PlayerInfo[targetid][pHelpedPlayers], PlayerInfo[targetid][pHelpedPlayersToday]);
            else format(string, sizeof(string), "A ajutat %d jucatori pana acum. Jucatori ajutati saptamana aceasta: %d", PlayerInfo[targetid][pHelpedPlayers], PlayerInfo[targetid][pHelpedPlayersToday]);
        }
        else {
            if(targetid == playerid) format(string, sizeof(string), "Ai ajutat %d jucatori pana acum. Jucatori ajutati azi: %d", PlayerInfo[targetid][pHelpedPlayers], PlayerInfo[targetid][pHelpedPlayersToday]);
            else format(string, sizeof(string), "A ajutat %d jucatori pana acum. Jucatori ajutati azi: %d", PlayerInfo[targetid][pHelpedPlayers], PlayerInfo[targetid][pHelpedPlayersToday]);
        }        
        
        SendClientMessage(playerid, COLOR_WHITE, string);    
    }    
    if(PlayerInfo[playerid][pAdmin] >= 1) {
        GetPlayerIp(targetid,playersip,sizeof(playersip));
        format(string, sizeof(string), "Seconds: %.0f | AFK: %d | Interior ID: %d | Virtual World: %d | SQLID: %d",PlayerInfo[targetid][pSeconds],AFKSeconds[targetid],GetPlayerInterior(targetid),GetPlayerVirtualWorld(targetid),PlayerInfo[targetid][pSQLID]);
        SendClientMessage(playerid, COLOR_LIGHTGOLD,string);        
    }
    return true;
}

 

Link to comment
Share on other sites

  • Hall of Flame🔥

Pai la alea 3 tu formatezi cu un string si iei marimea altui string.

format(string, sizeof(string3) in loc de asta pune  format(string, sizeof(string)

Si fa stringurile alea mai mici, ca nu ai nevoie de 1024.

ezgif-com-gif-maker-1-00000.png

Not So Zen SRL

Link to comment
Share on other sites

On 4/23/2020 at 7:37 PM, Alexandru1337 said:

Pai la alea 3 tu formatezi cu un string si iei marimea altui string.

format(string, sizeof(string3) in loc de asta pune  format(string, sizeof(string)

Si fa stringurile alea mai mici, ca nu ai nevoie de 1024.

Nu o să meargă, la SCM folosește tot string3.

 

Trebuie să aibă

Quote

format(string3, sizeof (string3), ...)

 

Cel mai developer

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

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