Results 1 to 10 of 14

Thread: CoD4 - openfile

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Brigadier General
    Join Date
    Oct 2012
    Posts
    994
    Thanks
    20
    Thanked 588 Times in 388 Posts
    Quote Originally Posted by BlancO View Post
    Should I use it like:

    PHP Code:
    self setStat("kills"0);

    kills self getStat("kills"); 
    No, setStat() and getStat() only work with integers - not strings. If you want to use a string, do what IW themselves did and invent a method which allows you to keep a list of your stats against a string reference. Check out COD4 _persistence.gsc and the accompanying playerStatsTable.csv. These are the 2 primary functions:

    Code:
    /*
    =============
    statGet
    
    Returns the value of the named stat
    =============
    */
    statGet( dataName )
    {
    if ( !level.rankedMatch )
    		return 0;
    	
    	return self getStat( int(tableLookup( "mp/playerStatsTable.csv", 1, dataName, 0 )) );
    }
    
    /*
    =============
    setStat
    
    Sets the value of the named stat
    =============
    */
    statSet( dataName, value )
    {
    	if ( !level.rankedMatch )
    		return;
    	
    	self setStat( int(tableLookup( "mp/playerStatsTable.csv", 1, dataName, 0 )), value );	
    }
    An example of how they are used:

    Code:
     self satSet( "kills", 10 );
    That would go to the satSet() function, and it would lookup the string "kills" in playerStatsTable.csv and find the stat number against the string reference.
    Last edited by Tally; 18th September 2013 at 07:58.

  2. The Following User Says Thank You to Tally For This Useful Post:

    BlancO (18th September 2013)

Tags for this Thread

Posting Permissions

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