Raised This Month: $ Target: $400
 0% 

menu


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
ironskillz1
AlliedModders Donor
Join Date: Jul 2012
Location: Sweden
Old 01-09-2013 , 12:39   menu
Reply With Quote #1

I want to see the percent of all players on the server but it doesnt work
exemple this line shows me how many percent i got
and it works great
Code:
Terroist Surviver </td><td> %i / %i  </td><td> %d%% </td></tr>", iAchLevel[i][SURVIVE],  iAchPoints[SURVIVE], 100 * iAchLevel[i][SURVIVE] /  iAchPoints[SURVIVE]);
But this line dont shows me players percent
when i open the meny it shows that i got 0% and evry body else got random percent LOL
Code:
new szMenuKey[128];
for( new i; i < iNum; i++ )
    {
        iPlayer = iPlayers[i];
        new percent = 100 * iAchLevel[i][i]/iAchPoints[i]
        get_user_name(iPlayer, szName, charsmax(szName));
        format(szMenuKey,127,"%s%s \d[%d%%]^n",(id==iPlayer)?"\r":"",szName,percent);
        num_to_str(iPlayer, szKey, charsmax(szKey));
        menu_additem(iMenu, szMenuKey, szKey);
but if i change the code to
Code:
new szMenuKey[128];
for( new i; i < iNum; i++ )
    {
        iPlayer = iPlayers[i];
        new percent = 100 * iAchLevel[id][i]/iAchPoints[i]
        get_user_name(iPlayer, szName, charsmax(szName));
        format(szMenuKey,127,"%s%s \d[%d%%]^n",(id==iPlayer)?"\r":"",szName,percent);
        num_to_str(iPlayer, szKey, charsmax(szKey));
        menu_additem(iMenu, szMenuKey, szKey);
the percent only works for guys that open the meny

and here is the array
Code:
new iAchLevel[MaxPlayers][iAchCount]
and here is a other iAchLevel line in the plugin
Code:
iAchLevel[id][JUMP]++
How can i fix so it shows evryones stats including my own in the menu?
__________________
I have many private and unique plugins for Jailbreak and Hide'N'Seek. PM me for more info.

Pm me.

Check out my roulette site.
ironskillz1 is offline
Send a message via Skype™ to ironskillz1
AngeIII
Senior Member
Join Date: Sep 2007
Location: Latvia
Old 01-09-2013 , 13:04   Re: menu
Reply With Quote #2

new percent = 100 * iAchLevel[i][i]/iAchPoints[i]
to
new percent = 100 * iAchLevel[iPlayer][ACHIEVMENT NUMBER!!!!]/iAchPoints[ACHIEVMENT NUMBER!!!]

but this is incorrect.
if you want to show HOW MANY achievments have player of all possible achievments you should
100 * allplayerachievments / totalpossibleachievmentscount.
as i know for you it is:
GlobalVariable:
iTotalAchievements = totalpossibleachievmentscount
all player achievments = TotalAchievements[Player_id]
if you want to show players achievment of selected ACHIEVMENT:
for example achievment: "SURVIVE"
player1 done: [0 %]
player2 done: [50 %]
this is:
100* iAchLevel[player id][achievement id]/iAchPoints[achievment id]
__________________
skype: pavle_ivanof
-=ThQ=-
PRIVATE SUPPORT = PAID SUPPORT
AngeIII is offline
Send a message via Skype™ to AngeIII
ironskillz1
AlliedModders Donor
Join Date: Jul 2012
Location: Sweden
Old 01-09-2013 , 13:15   Re: menu
Reply With Quote #3

this code worked perfect for me
Code:
new percent = 100 * iAchLevel[iPlayer][i]/iAchPoints[i]
And the percent is counting your ''points'' and with points and mean how many kills/death/survive/jumps of the total points
so if the total points is 100 and you got 50 points it say [50%] Done
__________________
I have many private and unique plugins for Jailbreak and Hide'N'Seek. PM me for more info.

Pm me.

Check out my roulette site.
ironskillz1 is offline
Send a message via Skype™ to ironskillz1
AngeIII
Senior Member
Join Date: Sep 2007
Location: Latvia
Old 01-09-2013 , 13:25   Re: menu
Reply With Quote #4

new percent = 100 * iAchLevel[iPlayer][i]/iAchPoints[i]
with this you will get incorrect result cause "i" it is loop variable for players
so in result you will see:
first player name first achievment [player]/ first achievment total
second player name second achievment [player / second achievment total
... ..
i mean your achievment increaseas too.
so if you want to display total you should use this:
new precent = 100*TotalAchievements[iPlayer]/iTotalAchievements
__________________
skype: pavle_ivanof
-=ThQ=-
PRIVATE SUPPORT = PAID SUPPORT
AngeIII is offline
Send a message via Skype™ to AngeIII
ironskillz1
AlliedModders Donor
Join Date: Jul 2012
Location: Sweden
Old 01-10-2013 , 09:21   Re: menu
Reply With Quote #5

Quote:
Originally Posted by AngeIII View Post
new percent = 100 * iAchLevel[iPlayer][i]/iAchPoints[i]
with this you will get incorrect result cause "i" it is loop variable for players
so in result you will see:
first player name first achievment [player]/ first achievment total
second player name second achievment [player / second achievment total
... ..
i mean your achievment increaseas too.
so if you want to display total you should use this:
new precent = 100*TotalAchievements[iPlayer]/iTotalAchievements
but if i do like this
Code:
new percent = 100 * iAchLevel[iPlayer]/iAchPoints[i]
i get this error :S
Code:
Error: Array must be indexed (variable "iAchLevel") on line 404
__________________
I have many private and unique plugins for Jailbreak and Hide'N'Seek. PM me for more info.

Pm me.

Check out my roulette site.
ironskillz1 is offline
Send a message via Skype™ to ironskillz1
AngeIII
Senior Member
Join Date: Sep 2007
Location: Latvia
Old 01-10-2013 , 09:49   Re: menu
Reply With Quote #6

do what I said and don't do with "some other method".
for total:
new precent = 100*TotalAchievements[iPlayer]/iTotalAchievements


for "defined" achievement:
PHP Code:
new ach_id=JUMP// display info about JUMP achievment:
...
for ..
{
..
 new 
percent 100 iAchLevel[iPlayer][ach_id]/iAchPoints[ach_id]
...

Understand?!
__________________
skype: pavle_ivanof
-=ThQ=-
PRIVATE SUPPORT = PAID SUPPORT

Last edited by AngeIII; 01-10-2013 at 09:51.
AngeIII is offline
Send a message via Skype™ to AngeIII
ironskillz1
AlliedModders Donor
Join Date: Jul 2012
Location: Sweden
Old 01-10-2013 , 09:59   Re: menu
Reply With Quote #7

[QUOTE=AngeIII;1870856]do what I said and don't do with "some other method".
for total:
new precent = 100*TotalAchievements[iPlayer]/iTotalAchievements


for "defined" achievement:
PHP Code:
new ach_id=JUMP// display info about JUMP achievment:
...
for ..
{
..
 new 
percent 100 iAchLevel[iPlayer][ach_id]/iAchPoints[ach_id]
...

i want the percent off the ach kills/death/survivor/jumps
like this
iAchLevel is how many kills/death/survivor/jumps you got
and iAchpoints is the total points you can get
but when i do that i get error
Code:
new percent = 100 * iAchLevel[iPlayer]/iAchPoints[i]
and the lines you sended shows how many achs you got and how many you got for 1 ach
__________________
I have many private and unique plugins for Jailbreak and Hide'N'Seek. PM me for more info.

Pm me.

Check out my roulette site.
ironskillz1 is offline
Send a message via Skype™ to ironskillz1
AngeIII
Senior Member
Join Date: Sep 2007
Location: Latvia
Old 01-10-2013 , 10:59   Re: menu
Reply With Quote #8

so you need to summup firstly.

...
PHP Code:
new szMenuKey[128];
new 
sum;
new 
sum_total;
for( new 
iiTotalAchievementsi++)
    
sum_total=sum_total+iAchPoints[i];
for( new 
iiNumi++ )
    {
        
iPlayer iPlayers[i];
        
sum=0;
        for( new 
z;z<iTotalAchievements;z++)
              
sum=sum+iAchLevel[iPlayer][z]
        new 
percent 100 sum/sum_total
        get_user_name
(iPlayerszNamecharsmax(szName));
        
format(szMenuKey,127,"%s%s \d[%d%%]^n",(id==iPlayer)?"\r":"",szName,percent);
        
num_to_str(iPlayerszKeycharsmax(szKey));
        
menu_additem(iMenuszMenuKeyszKey);
..... 
__________________
skype: pavle_ivanof
-=ThQ=-
PRIVATE SUPPORT = PAID SUPPORT

Last edited by AngeIII; 01-10-2013 at 11:00.
AngeIII is offline
Send a message via Skype™ to AngeIII
ironskillz1
AlliedModders Donor
Join Date: Jul 2012
Location: Sweden
Old 01-10-2013 , 11:40   Re: menu
Reply With Quote #9

Nope i solved it
its works perfect with this code
Code:
new percent = 100 * iAchLevel[iPlayer][i]/iAchPoints[i]
__________________
I have many private and unique plugins for Jailbreak and Hide'N'Seek. PM me for more info.

Pm me.

Check out my roulette site.
ironskillz1 is offline
Send a message via Skype™ to ironskillz1
AngeIII
Senior Member
Join Date: Sep 2007
Location: Latvia
Old 01-10-2013 , 13:42   Re: menu
Reply With Quote #10

it is definetly wrong... variable i it is loop variable which can be from 1 to 32.
your achievments iAchPoints and iAchLevel doesn't indexed to [][33].

my method correct but I think you dont understand so good luck. when you will get errors reread :
https://forums.alliedmods.net/showpo...61&postcount=2
https://forums.alliedmods.net/showpo...56&postcount=6
https://forums.alliedmods.net/showpo...94&postcount=8
__________________
skype: pavle_ivanof
-=ThQ=-
PRIVATE SUPPORT = PAID SUPPORT
AngeIII is offline
Send a message via Skype™ to AngeIII
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 13:43.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode