Page 1 of 3 123 LastLast
Results 1 to 10 of 29

Thread: best player map

  1. #1
    Private First Class
    Join Date
    Feb 2013
    Posts
    201
    Thanks
    4
    Thanked 10 Times in 7 Posts

    best player map

    hello , why first_player_name is not defined

    PHP Code:
    callback_playerconnect()
    {
    .....
        
    self thread checkstatus();

    PHP Code:
    checkstatus()
    {
        
    level.brakdanych = &"^1BRAK DANYCH";

        
    players getentarray("player""classname");
        
    highexp undefined;
        
    name undefined;
        
    highrank undefined;
        

        for(
    0players.sizei++)
        {
            
    player players[i];

            if(
    isdefined(player.pers["team"]) && player.pers["team"] == "spectator")
                continue;

            if(!
    isdefined(highexp))
            {
                
    highexp player.sexp;
                
    name player.name;
                
    highrank player.poziom;
                continue;
            }
            
            
            
    wait 0.01;
            
            if(
    isDefined(name))
                
    first_player_name name;
            else
                
    first_player_name level.brakdanych;
                
            if(
    isDefined(highexp))
                
    first_player_exp highexp;
            else
                
    first_player_exp level.brakdanych;
                
            if(
    isDefined(highrank))
                
    first_player_rank highrank;
            else
                
    first_player_rank level.brakdanych;
            
            
    wait 3;
                
            
    players[iiprintlnbold("name is" name +"fp name is" first_player_name);

            if(
    isdefined(first_player_name))
                
    players[isetClientCvar("first_player""First Player: Name:" first_player_name "His Exp IS:" first_player_exp "His rank IS:" first_player_rank);
             else
                
    players[isetClientCvar("first_player""First Player: Name:" "BRAK DANYCH" "His Exp IS:" +"BRAK DANYCH" "His rank IS:" "BRAK DANYCH");
            
        }    

    Last edited by malyczolg; 11th July 2013 at 15:48.

  2. #2
    Assadministrator IzNoGoD's Avatar
    Join Date
    Aug 2012
    Posts
    1,718
    Thanks
    17
    Thanked 1,068 Times in 674 Posts
    Dude,
    We are NOT your personal helpdesk. Please consider narrowing down the problem yourself, use some iprintlns, use some common sense.

    If you need the community for every little script you are writing, you are better off not writing the scripts. It will not teach you anything if others do it for you.

    I see no effort in your post to debug ANYTHING AT ALL. I dont see error logs, I dont see additional iprintlns, nothing.

    The only thing we have to go on here is you saying "why is variable X not defined", while only providing a script WITHOUT any comments in it, without telling us the purpose of this script, nothing.

    Please consider doing some of the stuff the community does yourself. Most of us have got the cod scripting as a hobby, we do not have a job supporting you. Providing us with insufficient data over and over again will upset us, and lead to posts like this.

    Good day sir.

  3. The Following 2 Users Say Thank You to IzNoGoD For This Useful Post:

    Earliboy (11th July 2013),RobsoN (11th July 2013)

  4. #3
    Private
    Join Date
    Jul 2012
    Posts
    76
    Thanks
    9
    Thanked 56 Times in 38 Posts
    Quote Originally Posted by IzNoGoD View Post
    If you need the community for every little script you are writing, you are better off not writing the scripts.
    Couldn't have said it better myself.
    I know what the script is provided to do. But seriously, the way it's scripted does not make any sense at all.
    No one becomes perfect over night. I remember the good old times. I'd never debug, but I would get it working anyway. I did not know about 'developer 1', no, the only errors I got were 'Unknown Function @46436'. Sometimes just a semicolon was missing and after hours of searching I found it. So guys, I am telling you, THAT made me good at that shite. And malyczolg, you are complaining about an indefined var. Come on, you're better than that.

  5. #4
    Private First Class Earliboy's Avatar
    Join Date
    Nov 2012
    Location
    Germany
    Posts
    130
    Thanks
    5
    Thanked 88 Times in 61 Posts
    Well, if someone posts a problem and allready tried to find the problem by himself, then its fine for me.
    But if someone comes ALWAYS if he gets an error WITHOUT trying to fix by himself, i won't help.
    Specialy without sending any errors or explains. I'm NOT going to edit my mod to insert an script. It takes much time and all I will get is the same error he got.
    No ... No ... this is not possible .......

  6. #5
    Private
    Join Date
    Jul 2013
    Posts
    14
    Thanks
    1
    Thanked 2 Times in 2 Posts
    I can see at least two mistakes.

    PHP Code:
     wait 0.01;
            
            if(
    isDefined(name))
                
    first_player_name name;
            else
                
    first_player_name level.brakdanych
    Firstly, wait 0.01 will be rounded upwards to 0.05 unless you have sv_fps set to 100.
    Secondly, in CoD2 you have to define all variables outside if statements.

    And you should really try some debugging

  7. #6
    Assadministrator IzNoGoD's Avatar
    Join Date
    Aug 2012
    Posts
    1,718
    Thanks
    17
    Thanked 1,068 Times in 674 Posts
    Quote Originally Posted by megazor View Post
    Secondly, in CoD2 you have to define all variables outside if statements.
    Not true.

    PHP Code:
    if(== b)
         
    1;
    else
         
    2;
    iprintln(c); 
    will not produce errors

    but
    PHP Code:
    if(== b)
         
    1;
    else if(
    != b)
         
    2;
    iprintln(c); 
    will produce errors, for the script cannot be sure that it is actually called, although you can see it will.

    also,

    PHP Code:
    somerandomcode();
    return;
    morerandomcode(); 
    will give the "unreachable code" error.

    PHP Code:
    somerandomcode();
    if(
    true)
         return;
    morerandomcode(); 
    will not.

    CoD2 is weird.

  8. The Following 2 Users Say Thank You to IzNoGoD For This Useful Post:

    kung foo man (12th July 2013),RobsoN (12th July 2013)

  9. #7
    Private
    Join Date
    Jan 2013
    Location
    Hungary
    Posts
    113
    Thanks
    10
    Thanked 74 Times in 45 Posts
    Write first_player_name = undefined; the first line of the function and it will work.

    EDIT: Oh, and i forgot: You cannot embed localizedstrings in setClientCvar().
    Last edited by randall; 12th July 2013 at 09:47.

  10. #8
    Private First Class
    Join Date
    Feb 2013
    Posts
    201
    Thanks
    4
    Thanked 10 Times in 7 Posts
    hi , thanks work
    but if i have 100exp bot have 200exp l'm on the dvar
    Who can help me?

  11. #9
    Private
    Join Date
    Jan 2013
    Location
    Hungary
    Posts
    113
    Thanks
    10
    Thanked 74 Times in 45 Posts
    Quote Originally Posted by malyczolg View Post
    hi , thanks work
    but if i have 100exp bot have 200exp l'm on the dvar
    Who can help me?
    Because your script is totally wrong. The biggest mistake is the waiting in the 'for' cycle. Try this, it causes the result you'd like to see: (not tested!)
    PHP Code:
    checkStatus()
    {
        
    level.brakdanych "^1BRAK DANYCH";
        
    first = [];
        
    first["player"]    = undefined;
        
    first["name"]    = level.brakdanych;
        
    first["exp"]    = level.brakdanych;
        
    first["rank"]    = level.brakdanych;

        
    players getEntarray("player""classname");
        for (
    0players.sizei++)
        {
            
    player players];

            if (! 
    isDefined(player.pers["team"]) || player.pers["team"] == "spectator")
                continue;

            if (! 
    isDefined(first["player"]) || player.sexp first["exp"])
            {
                
    first["player"] = player;
                
    first["name"] = player.name;
                
    first["exp"] = player.sexp;
                
    first["rank"] = player.poziom;
            }
        }

        for (
    0players.sizei++)
        {
            
    player players];

            
    player setClientCvar("first_player",
                    
    "First Player: Name:" first["name"] +
                    
    " His Exp IS:" first["exp"] +
                    
    " His rank IS:" first["rank"]);
        }

    Last edited by randall; 12th July 2013 at 21:26.

  12. The Following User Says Thank You to randall For This Useful Post:

    Ni3ls (13th July 2013)

  13. #10
    Private First Class
    Join Date
    Feb 2013
    Posts
    201
    Thanks
    4
    Thanked 10 Times in 7 Posts
    randall very thanks it works , can u tell me how add the second player?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •