Raised This Month: $ Target: $400
 0% 

worst player - server name. Why?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
mati009988
Member
Join Date: Jul 2009
Old 01-12-2011 , 14:54   worst player - server name. Why?
Reply With Quote #1

Why it show server name?
How to fix it?


PHP Code:
public RoundEnd()
{
    new 
name[34]
    new 
worstplayerworstscore
    
    
for(new isizeof(Kills); i++)
    {
        if(
Kills[i] < worstscore)
        {
        if(
get_user_team(i) == || get_user_team(i) == 2){
            
worstplayer i
            worstscore 
Kills[i]
        }
        return 
PLUGIN_CONTINUE
        
}
    }
    
    
get_user_name(worstplayername33)

    
client_print(0print_chat"The worst player is: %s ^nKills: %i"nameworstscore)
    return 
PLUGIN_CONTINUE

mati009988 is offline
GXLZPGX
Veteran Member
Join Date: Sep 2009
Old 01-12-2011 , 16:00   Re: worst player - server name. Why?
Reply With Quote #2

Quote:
Originally Posted by mati009988 View Post
Why it show server name?
How to fix it?


PHP Code:
public RoundEnd()
{
    new 
name[34]
    new 
worstplayerworstscore
    
    
for(new isizeof(Kills); i++)
    {
        if(
Kills[i] < worstscore)
        {
        if(
get_user_team(i) == || get_user_team(i) == 2){
            
worstplayer i
            worstscore 
Kills[i]
        }
        return 
PLUGIN_CONTINUE
        
}
    }
    
    
get_user_name(worstplayername33)

    
client_print(0print_chat"The worst player is: %s ^nKills: %i"nameworstscore)
    return 
PLUGIN_CONTINUE

#1: A name can store a maximum of 31 characters. Change the amount of arrays to 32.
#2: The way it's set up, "i" could be greater than the maximum of 32 players allowed in a server. So I wouldn't be surprised if you got errors in the logs.
#3: Even if you set up #2 correctly, the value of "worstplayer" is being changed constantly. So no matter what, it would always return the last player it looped to.
__________________
Currently accepting payment US DOLLARS ONLY for custom plugins, contact me through PM.
GXLZPGX is offline
nikhilgupta345
Veteran Member
Join Date: Aug 2009
Location: Virginia
Old 01-12-2011 , 16:56   Re: worst player - server name. Why?
Reply With Quote #3

for(new i; i > sizeof(Kills); i++)

should be

for(new i; i < sizeof(Kills); i++)


Also, when worstscore is made, then worstscore is automatically set to 0. Usually most people don't have a score less than 0. So what I think you should do is set worstscore to Kills[0] beforehand.
__________________
Quote:
Originally Posted by DarkGod View Post
nikhilgupta generates his plugins using sheer awesome.
If you like my work, please
nikhilgupta345 is offline
Send a message via ICQ to nikhilgupta345 Send a message via Yahoo to nikhilgupta345
drekes
Veteran Member
Join Date: Jul 2009
Location: Vault 11
Old 01-12-2011 , 17:15   Re: worst player - server name. Why?
Reply With Quote #4

Try something like this:
PHP Code:
new g_MaxPlayers;

public 
plugin_init()
    
g_MaxPlayers get_players();
    
public 
RoundEnd()
{    
    new 
worstplayerworstscore;
    
    for(new 
1g_MaxPlayersi++)
    {
        if(
is_user_connected(i) && worstscore && Kills[i] < worstscore)
        {
            switch(
get_user_team(i))
            {
                case 
12:
                {
                    
worstplayer i;
                    
worstscore Kills[i];
                }
            }
        }
    }
    
    new 
name[32];
    
get_user_name(worstplayernamecharsmax(name));
    
    
client_print(0print_chat"The worst player is: %s"name);
    
client_print(0print_chat"Kills: %i"worstscore);

__________________

Quote:
Originally Posted by nikhilgupta345 View Post
You're retarded.
drekes is offline
Send a message via MSN to drekes
nikhilgupta345
Veteran Member
Join Date: Aug 2009
Location: Virginia
Old 01-12-2011 , 17:59   Re: worst player - server name. Why?
Reply With Quote #5

PHP Code:
new g_MaxPlayers;

public 
plugin_init()
    
g_MaxPlayers get_players();
    
public 
RoundEnd()
{    
    new 
worstplayer 1worstscore Kills[1];
    
    for(new 
1g_MaxPlayersi++)
    {
        if(
is_user_connected(i) && worstscore && Kills[i] < worstscore)
        {
            switch(
get_user_team(i))
            {
                case 
12:
                {
                    
worstplayer i;
                    
worstscore Kills[i];
                }
            }
        }
    }
    
    new 
name[32];
    
get_user_name(worstplayernamecharsmax(name));
    
    
client_print(0print_chat"The worst player is: %s"name);
    
client_print(0print_chat"Kills: %i"worstscore);

I think that should work :/
__________________
Quote:
Originally Posted by DarkGod View Post
nikhilgupta generates his plugins using sheer awesome.
If you like my work, please
nikhilgupta345 is offline
Send a message via ICQ to nikhilgupta345 Send a message via Yahoo to nikhilgupta345
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 02:09.


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