Originally Posted by
BlancO
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.