SA-MP Forums Archive
dialog for /stats not work at all. - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: dialog for /stats not work at all. (/showthread.php?tid=465171)



dialog for /stats not work at all. - ajam112 - 21.09.2013

Here is my /stats, it's doesnt show at all stats, it's only slow half of it.

pawn Код:
new coordsstring[128], statsstring[1024];
        format(coordsstring, sizeof(coordsstring),"%s • Level %d • %s • Age: %d • Total wealth: $%d • Playing hours: %d • Phone number: %s • Warnings: %d",GetPlayerNameEx(targetid), level, sext, age, totalwealth, ptime, pnumber, warns);
        strcat(statsstring, coordsstring);
        format(coordsstring, sizeof(coordsstring), "\nCash: $%d • Bank balance: $%d • Upgrade points: %d • Spawn armor: %.0f • Next level: %d/%d hours ($%d)", cash, account, upgradep, shealth, exp, expamount, costlevel);
        strcat(statsstring, coordsstring);
        format(coordsstring, sizeof(coordsstring), "\n%s: %s • Rank: %s (%d) • Division: %s • Job: %s (level: %d) • Job 2: %s (level: %d)", facfam, employer, rank, PlayerInfo[targetid][pRank], division, jtext,jlevel,jtext2, jlevel2);
        strcat(statsstring, coordsstring);
        format(coordsstring, sizeof(coordsstring), "\nCrimes: %d • Arrests: %d • Insurance: %s • Wanted level: %d • Health: %.1f • Armor: %.1f • Paintball Tokens: %d",crimes,arrests,insur, wanted, health, armor, ptokens);
        strcat(statsstring, coordsstring);
        format(coordsstring, sizeof(coordsstring), "\nMarried to: %s • Biggest fish: %d • Pot: %d • Crack: %d • Packages: %d • Crates: %d • Radio frequency: %d khz",married,bigfish,pot,crack,packages,crates, radiofreq);
        strcat(statsstring, coordsstring);
        format(coordsstring, sizeof(coordsstring), "\nMaterials: %d • Rope: %d • Cigars: %d • Sprunk: %d • Spray: %d • Screwdrivers: %d • VIP tokens: %d • Checks: %d • VIP: %s",mats,rope,cigars,sprunk,spray, PlayerInfo[targetid][pScrewdriver],tokens,checks,drank);
        strcat(statsstring, coordsstring);
        format(coordsstring, sizeof(coordsstring), "\nADMutes: %d • NMutes: %d • RMutes: %d • Weapons Restricted: %d • Gang Warns: %d • EXP Hours: %d v Biz Key: %d", admutes, nmutes, PlayerInfo[targetid][pRMutedTotal],PlayerInfo[targetid][pWRestricted], PlayerInfo[targetid][pGangWarn], PlayerInfo[targetid][pDoubleEXP], PlayerInfo[targetid][pBiz]);
        strcat(statsstring, coordsstring);
        ShowPlayerDialog(playerid, 5234, DIALOG_STYLE_MSGBOX, "Your stats:", statsstring, "Close", "");
        {
            format(coordsstring, sizeof(coordsstring),"\nHouse: %d • House 2: %d • Renting: %d • Int: %d • VW: %d • Real VW: %d • Jail: %d sec • WJail: %d sec • AFK: %i", housekey,housekey2,rentkey,intir,vw,realvw,jailt,wjailt, playerAFKTime[targetid]);
            strcat(statsstring, coordsstring);
        }
        if (PlayerInfo[playerid][pAdmin] >= 1337)
        {
            if(PlayerInfo[targetid][pAdmin] >= 2 && PlayerInfo[playerid][pAdmin] >= 2)
            {
                format(coordsstring, sizeof(coordsstring),"\nAccepted reports: %d • Trashed reports: %d", PlayerInfo[targetid][pAcceptReport], PlayerInfo[targetid][pTrashReport]);
                strcat(statsstring, coordsstring);
            }
            if(PlayerInfo[targetid][pHelper] >= 2 && PlayerInfo[playerid][pAdmin] >= 2)
            {
                format(coordsstring, sizeof(coordsstring),"\nHours on duty: %d • Accepted help requests: %d", PlayerInfo[targetid][pDutyHours], PlayerInfo[targetid][pAcceptedHelp]);
                strcat(statsstring, coordsstring);
It's only show until this line only
pawn Код:
format(coordsstring, sizeof(coordsstring), "\nADMutes: %d • NMutes: %d • RMutes: %d • Weapons Restricted: %d • Gang Warns: %d • EXP Hours: %d v Biz Key: %d", admutes, nmutes, PlayerInfo[targetid][pRMutedTotal],PlayerInfo[targetid][pWRestricted], PlayerInfo[targetid][pGangWarn], PlayerInfo[targetid][pDoubleEXP], PlayerInfo[targetid][pBiz]);
        strcat(statsstring, coordsstring);



Re: dialog for /stats not work at all. - DanishHaq - 21.09.2013

Put this line:

pawn Код:
ShowPlayerDialog(playerid, 5234, DIALOG_STYLE_MSGBOX, "Your stats:", statsstring, "Close", "");
At the end of the command, ABOVE the FIRST return 1 under the actual code:

pawn Код:
return 1;
If you fail to do so, and it returns errors or doesn't work, post the whole command.

Reason being for this thing happening is that you are showing the dialog before actually checking if that person is an admin / helper to show anything else.


Re: dialog for /stats not work at all. - ajam112 - 21.09.2013

Quote:
Originally Posted by DanishHaq
Посмотреть сообщение
Put this line:

pawn Код:
ShowPlayerDialog(playerid, 5234, DIALOG_STYLE_MSGBOX, "Your stats:", statsstring, "Close", "");
Put at where?


Re: dialog for /stats not work at all. - Dragonsaurus - 21.09.2013

Increase the sizes of the strings.


Re: dialog for /stats not work at all. - DanishHaq - 21.09.2013

Quote:
Originally Posted by ajam112
Посмотреть сообщение
Put at where?
Post the whole command...

Quote:
Originally Posted by Dragonsaurus
Посмотреть сообщение
Increase the sizes of the strings.
The sizes of the arrays are fine, he's placed the ShowPlayerDialog in the incorrect position and now doesn't understand where to put it.


Re: dialog for /stats not work at all. - ajam112 - 21.09.2013

how to?


Re: dialog for /stats not work at all. - DanishHaq - 21.09.2013

Quote:
Originally Posted by ajam112
Посмотреть сообщение
how to?
Give the whole command I just said. The command to view the /stats, maybe [ pawn ] [ / pawn ] tags? It's not rocket science.


Re: dialog for /stats not work at all. - ajam112 - 21.09.2013

/stats
pawn Код:
CMD:stats(playerid, params[]) {
    if (gPlayerLogged{playerid} != 0) {
        ShowStats(playerid,playerid);
    }
    return 1;
}
includes
pawn Код:
new married[20];
        strmid(married, PlayerInfo[targetid][pMarriedTo], 0, strlen(PlayerInfo[targetid][pMarriedTo]), 255);
        new upgradep = PlayerInfo[targetid][gPupgrade];
        new age = PlayerInfo[targetid][pAge];
        new ptime = PlayerInfo[targetid][pConnectTime];
        new bigfish = PlayerInfo[targetid][pBiggestFish];
        new crimes = PlayerInfo[targetid][pCrimes];
        new arrests = PlayerInfo[targetid][pArrested];
        new pot = PlayerInfo[targetid][pPot];
        new crack = PlayerInfo[targetid][pCrack];
        new mats = PlayerInfo[targetid][pMats];
        new wanted = PlayerInfo[targetid][pWantedLevel];
        new level = PlayerInfo[targetid][pLevel];
        new exp = PlayerInfo[targetid][pExp];
        new account = PlayerInfo[targetid][pAccount];
        new nxtlevel = PlayerInfo[targetid][pLevel]+1;
        new expamount = nxtlevel*levelexp;
        new costlevel = nxtlevel*levelcost;//10k for testing purposes
        new housekey = PlayerInfo[targetid][pPhousekey];
        new housekey2 = PlayerInfo[targetid][pPhousekey2];
        new rentkey = PlayerInfo[targetid][pRenting];
        new radiofreq = PlayerInfo[targetid][pRadioFreq];
        new intir = GetPlayerInterior(targetid);
        new tokens = PlayerInfo[targetid][pTokens];
        new ptokens = PlayerInfo[targetid][pPaintTokens];
        new checks = PlayerInfo[targetid][pChecks];
        new Float:shealth = PlayerInfo[targetid][pSHealth];
        //new Float:sarmor = PlayerInfo[targetid][pSArmor];
        new Float:health, Float:armor;
        new packages = GetPVarInt(targetid, "Packages");
        new crates = PlayerInfo[targetid][pCrates];
        new rope = PlayerInfo[targetid][pRope],
            cigars = PlayerInfo[targetid][pCigar],
            sprunk = PlayerInfo[targetid][pSprunk],
            spray = PlayerInfo[targetid][pSpraycan],
            realvw = GetPlayerVirtualWorld(targetid),
            vw = PlayerInfo[targetid][pVW],
            warns = PlayerInfo[targetid][pWarns],
            jailt = PlayerInfo[targetid][pJailTime],
            wjailt = PlayerInfo[targetid][pBeingSentenced];
        GetPlayerHealth(targetid,health);
        GetPlayerArmour(targetid,armor);
        new Float:px,Float:py,Float:pz;
        GetPlayerPos(targetid, px, py, pz);
        new totalwealth;
        new name[MAX_PLAYER_NAME];
        GetPlayerName(targetid, name, sizeof(name));
        new nmutes = PlayerInfo[targetid][pNMuteTotal];
        new admutes = PlayerInfo[targetid][pADMuteTotal];
        totalwealth = account + cash;
        if(PlayerInfo[targetid][pPhousekey] != INVALID_HOUSE_ID && strcmp(name, HouseInfo[PlayerInfo[targetid][pPhousekey]][hOwner], true) == 0) totalwealth += HouseInfo[PlayerInfo[targetid][pPhousekey]][hSafeMoney];
        if(PlayerInfo[targetid][pPhousekey2] != INVALID_HOUSE_ID && strcmp(name, HouseInfo[PlayerInfo[targetid][pPhousekey2]][hOwner], true) == 0) totalwealth += HouseInfo[PlayerInfo[targetid][pPhousekey2]][hSafeMoney];
        new coordsstring[128], statsstring[1024];
        format(coordsstring, sizeof(coordsstring),"%s • Level %d • %s • Age: %d • Total wealth: $%d • Playing hours: %d • Phone number: %s • Warnings: %d",GetPlayerNameEx(targetid), level, sext, age, totalwealth, ptime, pnumber, warns);
        strcat(statsstring, coordsstring);
        format(coordsstring, sizeof(coordsstring), "\nCash: $%d • Bank balance: $%d • Upgrade points: %d • Spawn armor: %.0f • Next level: %d/%d hours ($%d)", cash, account, upgradep, shealth, exp, expamount, costlevel);
        strcat(statsstring, coordsstring);
        format(coordsstring, sizeof(coordsstring), "\n%s: %s • Rank: %s (%d) • Division: %s • Job: %s (level: %d) • Job 2: %s (level: %d)", facfam, employer, rank, PlayerInfo[targetid][pRank], division, jtext,jlevel,jtext2, jlevel2);
        strcat(statsstring, coordsstring);
        format(coordsstring, sizeof(coordsstring), "\nCrimes: %d • Arrests: %d • Insurance: %s • Wanted level: %d • Health: %.1f • Armor: %.1f • Paintball Tokens: %d",crimes,arrests,insur, wanted, health, armor, ptokens);
        strcat(statsstring, coordsstring);
        format(coordsstring, sizeof(coordsstring), "\nMarried to: %s • Biggest fish: %d • Pot: %d • Crack: %d • Packages: %d • Crates: %d • Radio frequency: %d khz",married,bigfish,pot,crack,packages,crates, radiofreq);
        strcat(statsstring, coordsstring);
        format(coordsstring, sizeof(coordsstring), "\nMaterials: %d • Rope: %d • Cigars: %d • Sprunk: %d • Spray: %d • Screwdrivers: %d • VIP tokens: %d • Checks: %d • VIP: %s",mats,rope,cigars,sprunk,spray, PlayerInfo[targetid][pScrewdriver],tokens,checks,drank);
        strcat(statsstring, coordsstring);
        format(coordsstring, sizeof(coordsstring), "\nADMutes: %d • NMutes: %d • RMutes: %d • Weapons Restricted: %d • Gang Warns: %d • EXP Hours: %d v Biz Key: %d", admutes, nmutes, PlayerInfo[targetid][pRMutedTotal],PlayerInfo[targetid][pWRestricted], PlayerInfo[targetid][pGangWarn], PlayerInfo[targetid][pDoubleEXP], PlayerInfo[targetid][pBiz]);
        strcat(statsstring, coordsstring);
        ShowPlayerDialog(playerid, 5234, DIALOG_STYLE_MSGBOX, "Your stats:", statsstring, "Close", "");
        {
            format(coordsstring, sizeof(coordsstring),"\nHouse: %d • House 2: %d • Renting: %d • Int: %d • VW: %d • Real VW: %d • Jail: %d sec • WJail: %d sec • AFK: %i", housekey,housekey2,rentkey,intir,vw,realvw,jailt,wjailt, playerAFKTime[targetid]);
            strcat(statsstring, coordsstring);
        }
        if (PlayerInfo[playerid][pAdmin] >= 1337)
        {
            if(PlayerInfo[targetid][pAdmin] >= 2 && PlayerInfo[playerid][pAdmin] >= 2)
            {
                format(coordsstring, sizeof(coordsstring),"\nAccepted reports: %d • Trashed reports: %d", PlayerInfo[targetid][pAcceptReport], PlayerInfo[targetid][pTrashReport]);
                strcat(statsstring, coordsstring);
            }
            if(PlayerInfo[targetid][pHelper] >= 2 && PlayerInfo[playerid][pAdmin] >= 2)
            {
                format(coordsstring, sizeof(coordsstring),"\nHours on duty: %d • Accepted help requests: %d", PlayerInfo[targetid][pDutyHours], PlayerInfo[targetid][pAcceptedHelp]);
                strcat(statsstring, coordsstring);
            }
        }
        //SendClientMessageEx(playerid, COLOR_GREEN,"___________________________________________________________________________________________________");
    }
}



Re: dialog for /stats not work at all. - Dragonsaurus - 21.09.2013

pawn Код:
new coordsstring[128], statsstring[1024];
        format(coordsstring, sizeof(coordsstring),"%s • Level %d • %s • Age: %d • Total wealth: $%d • Playing hours: %d • Phone number: %s • Warnings: %d",GetPlayerNameEx(targetid), level, sext, age, totalwealth, ptime, pnumber, warns);
        strcat(statsstring, coordsstring);
        format(coordsstring, sizeof(coordsstring), "\nCash: $%d • Bank balance: $%d • Upgrade points: %d • Spawn armor: %.0f • Next level: %d/%d hours ($%d)", cash, account, upgradep, shealth, exp, expamount, costlevel);
        strcat(statsstring, coordsstring);
        format(coordsstring, sizeof(coordsstring), "\n%s: %s • Rank: %s (%d) • Division: %s • Job: %s (level: %d) • Job 2: %s (level: %d)", facfam, employer, rank, PlayerInfo[targetid][pRank], division, jtext,jlevel,jtext2, jlevel2);
        strcat(statsstring, coordsstring);
        format(coordsstring, sizeof(coordsstring), "\nCrimes: %d • Arrests: %d • Insurance: %s • Wanted level: %d • Health: %.1f • Armor: %.1f • Paintball Tokens: %d",crimes,arrests,insur, wanted, health, armor, ptokens);
        strcat(statsstring, coordsstring);
        format(coordsstring, sizeof(coordsstring), "\nMarried to: %s • Biggest fish: %d • Pot: %d • Crack: %d • Packages: %d • Crates: %d • Radio frequency: %d khz",married,bigfish,pot,crack,packages,crates, radiofreq);
        strcat(statsstring, coordsstring);
        format(coordsstring, sizeof(coordsstring), "\nMaterials: %d • Rope: %d • Cigars: %d • Sprunk: %d • Spray: %d • Screwdrivers: %d • VIP tokens: %d • Checks: %d • VIP: %s",mats,rope,cigars,sprunk,spray, PlayerInfo[targetid][pScrewdriver],tokens,checks,drank);
        strcat(statsstring, coordsstring);
        format(coordsstring, sizeof(coordsstring), "\nADMutes: %d • NMutes: %d • RMutes: %d • Weapons Restricted: %d • Gang Warns: %d • EXP Hours: %d v Biz Key: %d", admutes, nmutes, PlayerInfo[targetid][pRMutedTotal],PlayerInfo[targetid][pWRestricted], PlayerInfo[targetid][pGangWarn], PlayerInfo[targetid][pDoubleEXP], PlayerInfo[targetid][pBiz]);
        strcat(statsstring, coordsstring);
        format(coordsstring, sizeof(coordsstring),"\nHouse: %d • House 2: %d • Renting: %d • Int: %d • VW: %d • Real VW: %d • Jail: %d sec • WJail: %d sec • AFK: %i", housekey,housekey2,rentkey,intir,vw,realvw,jailt,wjailt, playerAFKTime[targetid]);
        strcat(statsstring, coordsstring);
        if (PlayerInfo[playerid][pAdmin] >= 1337)
        {
            if(PlayerInfo[targetid][pAdmin] >= 2 && PlayerInfo[playerid][pAdmin] >= 2)
            {
                format(coordsstring, sizeof(coordsstring),"\nAccepted reports: %d • Trashed reports: %d", PlayerInfo[targetid][pAcceptReport], PlayerInfo[targetid][pTrashReport]);
                strcat(statsstring, coordsstring);
            }
            if(PlayerInfo[targetid][pHelper] >= 2 && PlayerInfo[playerid][pAdmin] >= 2)
            {
                format(coordsstring, sizeof(coordsstring),"\nHours on duty: %d • Accepted help requests: %d", PlayerInfo[targetid][pDutyHours], PlayerInfo[targetid][pAcceptedHelp]);
                strcat(statsstring, coordsstring);
            }
        }
        ShowPlayerDialog(playerid, 5234, DIALOG_STYLE_MSGBOX, "Your stats:", statsstring, "Close", "");



Re: dialog for /stats not work at all. - ajam112 - 21.09.2013

i will try it