Page 1 of 2 12 LastLast
Results 1 to 10 of 14

Thread: CoD4 - openfile

  1. #1
    Private
    Join Date
    Feb 2013
    Location
    Poland
    Posts
    32
    Thanks
    33
    Thanked 27 Times in 8 Posts

    CoD4 - openfile

    The problem is I can't open file.

    Console_mp.log
    PHP Code:
    Error
    ******* 
    script compile error *******
    Error: return value of developer command can not be accessed if not in a /# ... #/ comment: (file 'blanco/_start.gsc', line 25)
     
    openfile("file.txt""write");
         *
    ************************************ 
    Script
    PHP Code:
    openfile("file.txt""write");
    fprintln(f"Save it to file.");
    closefile(f); 

  2. #2
    Assadministrator IzNoGoD's Avatar
    Join Date
    Aug 2012
    Posts
    1,718
    Thanks
    17
    Thanked 1,068 Times in 674 Posts
    In cod4 its only avail in developer mode. Not advised for running servers with developer enabled.

    Use kung's cod4 extension for a full mysql interface.

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

    BlancO (17th September 2013),kung foo man (18th September 2013)

  4. #3
    Private
    Join Date
    Jul 2012
    Posts
    76
    Thanks
    9
    Thanked 56 Times in 38 Posts
    Actually I've never met a CoD4 scripter who used openfile() etc. They used getStat() and setStat() if they wanted to save any data.
    Either do what IzNoGod said or try it my way.

  5. #4
    Private
    Join Date
    Feb 2013
    Location
    Poland
    Posts
    32
    Thanks
    33
    Thanked 27 Times in 8 Posts
    Should I use it like:

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

    kills self getStat("kills"); 

  6. #5
    Private
    Join Date
    Jul 2012
    Posts
    76
    Thanks
    9
    Thanked 56 Times in 38 Posts
    Yup, that actually should work.

    Though I would recommend using it like this.

    PHP Code:
    self maps\mp\gametypes\_persistence::statSet("kills"0);
    kills self maps\mp\gametypes\_persistence::statGet("kills"); 
    Also you have the statAdd() function.
    For example:
    PHP Code:
    self maps\mp\gametypes\_persistence::statAdd("kills"1); 
    This would add 1 killpoint to the existing ones.
    It's a bit shorter than
    PHP Code:
     curValue self maps\mp\gametypes\_persistence::statGet("kills");
    self maps\mp\gametypes\_persistence::statSet("kills"curValue+1); 
    Here are two links which might help you:
    http://www.se7ensins.com/forums/thre...tstats.426961/
    http://braxi.org/forum/archive/index...read-1489.html

    The very big problem about stats is that they are not saved on the server, but on the client's PC. So it's kind of easy to hack and fake stats. So I'd rather recommend you mysql to be honest.
    Last edited by Peterlankton; 18th September 2013 at 00:07.

  7. The Following 2 Users Say Thank You to Peterlankton For This Useful Post:

    BlancO (18th September 2013),kung foo man (18th September 2013)

  8. #6
    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 08:58.

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

    BlancO (18th September 2013)

  10. #7
    Brigadier General
    Join Date
    Oct 2012
    Posts
    994
    Thanks
    20
    Thanked 588 Times in 388 Posts
    Quote Originally Posted by Peterlankton View Post
    Yup, that actually should work.

    Though I would recommend using it like this.

    PHP Code:
    self maps\mp\gametypes\_persistence::statSet("kills"0);
    kills self maps\mp\gametypes\_persistence::statGet("kills"); 
    Also you have the statAdd() function.
    For example:
    PHP Code:
    self maps\mp\gametypes\_persistence::statAdd("kills"1); 
    This would add 1 killpoint to the existing ones.
    It's a bit shorter than
    PHP Code:
     curValue self maps\mp\gametypes\_persistence::statGet("kills");
    self maps\mp\gametypes\_persistence::statSet("kills"curValue+1); 
    Here are two links which might help you:
    http://www.se7ensins.com/forums/thre...tstats.426961/
    http://braxi.org/forum/archive/index...read-1489.html

    The very big problem about stats is that they are not saved on the server, but on the client's PC. So it's kind of easy to hack and fake stats. So I'd rather recommend you mysql to be honest.
    No, it wont work - getStat() and setStat() only works with numbers (integers).

  11. #8
    Brigadier General
    Join Date
    Oct 2012
    Posts
    994
    Thanks
    20
    Thanked 588 Times in 388 Posts
    Quote Originally Posted by BlancO View Post
    The problem is I can't open file.

    Console_mp.log
    PHP Code:
    Error
    ******* 
    script compile error *******
    Error: return value of developer command can not be accessed if not in a /# ... #/ comment: (file 'blanco/_start.gsc', line 25)
     
    openfile("file.txt""write");
         *
    ************************************ 
    Script
    PHP Code:
    openfile("file.txt""write");
    fprintln(f"Save it to file.");
    closefile(f); 
    As pointed out already, the File functions only works in developer mode. However, if you want to READ data, use COD4 tableLookUp() function. I did this for a rank system in COD4 1.0 - 1.4, before IW enabled the getStat() and setStat() for mods. Before that, ranks could not be saved (the "write" File function only worked in developer mode), but we could at least read data.

  12. #9
    Brigadier General
    Join Date
    Oct 2012
    Posts
    994
    Thanks
    20
    Thanked 588 Times in 388 Posts
    Following on from above post:

    If you want to create your own stat-finding function similar to IW's, the following is a list of the free stats available. Just put them in a .CSV file and put a string reference of your choice in line 2:

    Code:
    3150,CHANGE_THIS_TO_USE_ME
    3151,CHANGE_THIS_TO_USE_ME
    3152,CHANGE_THIS_TO_USE_ME
    3153,CHANGE_THIS_TO_USE_ME
    3154,CHANGE_THIS_TO_USE_ME
    3155,CHANGE_THIS_TO_USE_ME
    3156,CHANGE_THIS_TO_USE_ME
    3157,CHANGE_THIS_TO_USE_ME
    3158,CHANGE_THIS_TO_USE_ME
    3159,CHANGE_THIS_TO_USE_ME
    3160,CHANGE_THIS_TO_USE_ME
    3161,CHANGE_THIS_TO_USE_ME
    3162,CHANGE_THIS_TO_USE_ME
    3163,CHANGE_THIS_TO_USE_ME
    3164,CHANGE_THIS_TO_USE_ME
    3165,CHANGE_THIS_TO_USE_ME
    3166,CHANGE_THIS_TO_USE_ME
    3167,CHANGE_THIS_TO_USE_ME
    3168,CHANGE_THIS_TO_USE_ME
    3169,CHANGE_THIS_TO_USE_ME
    3170,CHANGE_THIS_TO_USE_ME
    3171,CHANGE_THIS_TO_USE_ME
    3172,CHANGE_THIS_TO_USE_ME
    3173,CHANGE_THIS_TO_USE_ME
    3174,CHANGE_THIS_TO_USE_ME
    3175,CHANGE_THIS_TO_USE_ME
    3176,CHANGE_THIS_TO_USE_ME
    3177,CHANGE_THIS_TO_USE_ME
    3178,CHANGE_THIS_TO_USE_ME
    3179,CHANGE_THIS_TO_USE_ME
    3180,CHANGE_THIS_TO_USE_ME
    3181,CHANGE_THIS_TO_USE_ME
    3182,CHANGE_THIS_TO_USE_ME
    3183,CHANGE_THIS_TO_USE_ME
    3184,CHANGE_THIS_TO_USE_ME
    3185,CHANGE_THIS_TO_USE_ME
    3186,CHANGE_THIS_TO_USE_ME
    3187,CHANGE_THIS_TO_USE_ME
    3188,CHANGE_THIS_TO_USE_ME
    3189,CHANGE_THIS_TO_USE_ME
    3190,CHANGE_THIS_TO_USE_ME
    3191,CHANGE_THIS_TO_USE_ME
    3192,CHANGE_THIS_TO_USE_ME
    3193,CHANGE_THIS_TO_USE_ME
    3194,CHANGE_THIS_TO_USE_ME
    3195,CHANGE_THIS_TO_USE_ME
    3196,CHANGE_THIS_TO_USE_ME
    3197,CHANGE_THIS_TO_USE_ME
    3198,CHANGE_THIS_TO_USE_ME
    3199,CHANGE_THIS_TO_USE_ME
    3200,CHANGE_THIS_TO_USE_ME
    3201,CHANGE_THIS_TO_USE_ME
    3202,CHANGE_THIS_TO_USE_ME
    3203,CHANGE_THIS_TO_USE_ME
    3204,CHANGE_THIS_TO_USE_ME
    3205,CHANGE_THIS_TO_USE_ME
    3206,CHANGE_THIS_TO_USE_ME
    3207,CHANGE_THIS_TO_USE_ME
    3208,CHANGE_THIS_TO_USE_ME
    3209,CHANGE_THIS_TO_USE_ME
    3210,CHANGE_THIS_TO_USE_ME
    3211,CHANGE_THIS_TO_USE_ME
    3212,CHANGE_THIS_TO_USE_ME
    3213,CHANGE_THIS_TO_USE_ME
    3214,CHANGE_THIS_TO_USE_ME
    3215,CHANGE_THIS_TO_USE_ME
    3216,CHANGE_THIS_TO_USE_ME
    3217,CHANGE_THIS_TO_USE_ME
    3218,CHANGE_THIS_TO_USE_ME
    3219,CHANGE_THIS_TO_USE_ME
    3220,CHANGE_THIS_TO_USE_ME
    3221,CHANGE_THIS_TO_USE_ME
    3222,CHANGE_THIS_TO_USE_ME
    3223,CHANGE_THIS_TO_USE_ME
    3224,CHANGE_THIS_TO_USE_ME
    3225,CHANGE_THIS_TO_USE_ME
    3226,CHANGE_THIS_TO_USE_ME
    3227,CHANGE_THIS_TO_USE_ME
    3228,CHANGE_THIS_TO_USE_ME
    3229,CHANGE_THIS_TO_USE_ME
    3230,CHANGE_THIS_TO_USE_ME
    3231,CHANGE_THIS_TO_USE_ME
    3232,CHANGE_THIS_TO_USE_ME
    3233,CHANGE_THIS_TO_USE_ME
    3234,CHANGE_THIS_TO_USE_ME
    3235,CHANGE_THIS_TO_USE_ME
    3236,CHANGE_THIS_TO_USE_ME
    3237,CHANGE_THIS_TO_USE_ME
    3238,CHANGE_THIS_TO_USE_ME
    3239,CHANGE_THIS_TO_USE_ME
    3240,CHANGE_THIS_TO_USE_ME
    3241,CHANGE_THIS_TO_USE_ME
    3242,CHANGE_THIS_TO_USE_ME
    3243,CHANGE_THIS_TO_USE_ME
    3244,CHANGE_THIS_TO_USE_ME
    3245,CHANGE_THIS_TO_USE_ME
    3246,CHANGE_THIS_TO_USE_ME
    3247,CHANGE_THIS_TO_USE_ME
    3248,CHANGE_THIS_TO_USE_ME
    3249,CHANGE_THIS_TO_USE_ME
    3250,CHANGE_THIS_TO_USE_ME
    3251,CHANGE_THIS_TO_USE_ME
    3252,CHANGE_THIS_TO_USE_ME
    3253,CHANGE_THIS_TO_USE_ME
    3254,CHANGE_THIS_TO_USE_ME
    3255,CHANGE_THIS_TO_USE_ME
    3256,CHANGE_THIS_TO_USE_ME
    3257,CHANGE_THIS_TO_USE_ME
    3258,CHANGE_THIS_TO_USE_ME
    3259,CHANGE_THIS_TO_USE_ME
    3260,CHANGE_THIS_TO_USE_ME
    3261,CHANGE_THIS_TO_USE_ME
    3262,CHANGE_THIS_TO_USE_ME
    3263,CHANGE_THIS_TO_USE_ME
    3264,CHANGE_THIS_TO_USE_ME
    3265,CHANGE_THIS_TO_USE_ME
    3266,CHANGE_THIS_TO_USE_ME
    3267,CHANGE_THIS_TO_USE_ME
    3268,CHANGE_THIS_TO_USE_ME
    3269,CHANGE_THIS_TO_USE_ME
    3270,CHANGE_THIS_TO_USE_ME
    3271,CHANGE_THIS_TO_USE_ME
    3272,CHANGE_THIS_TO_USE_ME
    3273,CHANGE_THIS_TO_USE_ME
    3274,CHANGE_THIS_TO_USE_ME
    3275,CHANGE_THIS_TO_USE_ME
    3276,CHANGE_THIS_TO_USE_ME
    3277,CHANGE_THIS_TO_USE_ME
    3278,CHANGE_THIS_TO_USE_ME
    3279,CHANGE_THIS_TO_USE_ME
    3280,CHANGE_THIS_TO_USE_ME
    3281,CHANGE_THIS_TO_USE_ME
    3282,CHANGE_THIS_TO_USE_ME
    3283,CHANGE_THIS_TO_USE_ME
    3284,CHANGE_THIS_TO_USE_ME
    3285,CHANGE_THIS_TO_USE_ME
    3286,CHANGE_THIS_TO_USE_ME
    3287,CHANGE_THIS_TO_USE_ME
    3288,CHANGE_THIS_TO_USE_ME
    3289,CHANGE_THIS_TO_USE_ME
    3290,CHANGE_THIS_TO_USE_ME
    3291,CHANGE_THIS_TO_USE_ME
    3292,CHANGE_THIS_TO_USE_ME
    3293,CHANGE_THIS_TO_USE_ME
    3294,CHANGE_THIS_TO_USE_ME
    3295,CHANGE_THIS_TO_USE_ME
    3296,CHANGE_THIS_TO_USE_ME
    3297,CHANGE_THIS_TO_USE_ME
    3298,CHANGE_THIS_TO_USE_ME
    3299,CHANGE_THIS_TO_USE_ME
    3300,CHANGE_THIS_TO_USE_ME
    3301,CHANGE_THIS_TO_USE_ME
    3302,CHANGE_THIS_TO_USE_ME
    3303,CHANGE_THIS_TO_USE_ME
    3304,CHANGE_THIS_TO_USE_ME
    3305,CHANGE_THIS_TO_USE_ME
    3306,CHANGE_THIS_TO_USE_ME
    3307,CHANGE_THIS_TO_USE_ME
    3308,CHANGE_THIS_TO_USE_ME
    3309,CHANGE_THIS_TO_USE_ME
    3310,CHANGE_THIS_TO_USE_ME
    3311,CHANGE_THIS_TO_USE_ME
    3312,CHANGE_THIS_TO_USE_ME
    3313,CHANGE_THIS_TO_USE_ME
    3314,CHANGE_THIS_TO_USE_ME
    3315,CHANGE_THIS_TO_USE_ME
    3316,CHANGE_THIS_TO_USE_ME
    3317,CHANGE_THIS_TO_USE_ME
    3318,CHANGE_THIS_TO_USE_ME
    3319,CHANGE_THIS_TO_USE_ME
    3320,CHANGE_THIS_TO_USE_ME
    3321,CHANGE_THIS_TO_USE_ME
    3322,CHANGE_THIS_TO_USE_ME
    3323,CHANGE_THIS_TO_USE_ME
    3324,CHANGE_THIS_TO_USE_ME
    3325,CHANGE_THIS_TO_USE_ME
    3326,CHANGE_THIS_TO_USE_ME
    3327,CHANGE_THIS_TO_USE_ME
    3328,CHANGE_THIS_TO_USE_ME
    3329,CHANGE_THIS_TO_USE_ME
    3330,CHANGE_THIS_TO_USE_ME
    3331,CHANGE_THIS_TO_USE_ME
    3332,CHANGE_THIS_TO_USE_ME
    3333,CHANGE_THIS_TO_USE_ME
    3334,CHANGE_THIS_TO_USE_ME
    3335,CHANGE_THIS_TO_USE_ME
    3336,CHANGE_THIS_TO_USE_ME
    3337,CHANGE_THIS_TO_USE_ME
    3338,CHANGE_THIS_TO_USE_ME
    3339,CHANGE_THIS_TO_USE_ME
    3340,CHANGE_THIS_TO_USE_ME
    3341,CHANGE_THIS_TO_USE_ME
    3342,CHANGE_THIS_TO_USE_ME
    3343,CHANGE_THIS_TO_USE_ME
    3344,CHANGE_THIS_TO_USE_ME
    3345,CHANGE_THIS_TO_USE_ME
    3346,CHANGE_THIS_TO_USE_ME
    3347,CHANGE_THIS_TO_USE_ME
    3348,CHANGE_THIS_TO_USE_ME
    3349,CHANGE_THIS_TO_USE_ME
    3350,CHANGE_THIS_TO_USE_ME
    3351,CHANGE_THIS_TO_USE_ME
    3352,CHANGE_THIS_TO_USE_ME
    3353,CHANGE_THIS_TO_USE_ME
    3354,CHANGE_THIS_TO_USE_ME
    3355,CHANGE_THIS_TO_USE_ME
    3356,CHANGE_THIS_TO_USE_ME
    3357,CHANGE_THIS_TO_USE_ME
    3358,CHANGE_THIS_TO_USE_ME
    3359,CHANGE_THIS_TO_USE_ME
    3360,CHANGE_THIS_TO_USE_ME
    3361,CHANGE_THIS_TO_USE_ME
    3362,CHANGE_THIS_TO_USE_ME
    3363,CHANGE_THIS_TO_USE_ME
    3364,CHANGE_THIS_TO_USE_ME
    3365,CHANGE_THIS_TO_USE_ME
    3366,CHANGE_THIS_TO_USE_ME
    3367,CHANGE_THIS_TO_USE_ME
    3368,CHANGE_THIS_TO_USE_ME
    3369,CHANGE_THIS_TO_USE_ME
    3370,CHANGE_THIS_TO_USE_ME
    3371,CHANGE_THIS_TO_USE_ME
    3372,CHANGE_THIS_TO_USE_ME
    3373,CHANGE_THIS_TO_USE_ME
    3374,CHANGE_THIS_TO_USE_ME
    3375,CHANGE_THIS_TO_USE_ME
    3376,CHANGE_THIS_TO_USE_ME
    3377,CHANGE_THIS_TO_USE_ME
    3378,CHANGE_THIS_TO_USE_ME
    3379,CHANGE_THIS_TO_USE_ME
    3380,CHANGE_THIS_TO_USE_ME
    3381,CHANGE_THIS_TO_USE_ME
    3382,CHANGE_THIS_TO_USE_ME
    3383,CHANGE_THIS_TO_USE_ME
    3384,CHANGE_THIS_TO_USE_ME
    3385,CHANGE_THIS_TO_USE_ME
    3386,CHANGE_THIS_TO_USE_ME
    3387,CHANGE_THIS_TO_USE_ME
    3388,CHANGE_THIS_TO_USE_ME
    3389,CHANGE_THIS_TO_USE_ME
    3390,CHANGE_THIS_TO_USE_ME
    3391,CHANGE_THIS_TO_USE_ME
    3392,CHANGE_THIS_TO_USE_ME
    3393,CHANGE_THIS_TO_USE_ME
    3394,CHANGE_THIS_TO_USE_ME
    3395,CHANGE_THIS_TO_USE_ME
    3396,CHANGE_THIS_TO_USE_ME
    3397,CHANGE_THIS_TO_USE_ME
    3398,CHANGE_THIS_TO_USE_ME
    3399,CHANGE_THIS_TO_USE_ME
    3400,CHANGE_THIS_TO_USE_ME
    3401,CHANGE_THIS_TO_USE_ME
    3402,CHANGE_THIS_TO_USE_ME
    3403,CHANGE_THIS_TO_USE_ME
    3404,CHANGE_THIS_TO_USE_ME
    3405,CHANGE_THIS_TO_USE_ME
    3406,CHANGE_THIS_TO_USE_ME
    3407,CHANGE_THIS_TO_USE_ME
    3408,CHANGE_THIS_TO_USE_ME
    3409,CHANGE_THIS_TO_USE_ME
    3410,CHANGE_THIS_TO_USE_ME
    3411,CHANGE_THIS_TO_USE_ME
    3412,CHANGE_THIS_TO_USE_ME
    3413,CHANGE_THIS_TO_USE_ME
    3414,CHANGE_THIS_TO_USE_ME
    3415,CHANGE_THIS_TO_USE_ME
    3416,CHANGE_THIS_TO_USE_ME
    3417,CHANGE_THIS_TO_USE_ME
    3418,CHANGE_THIS_TO_USE_ME
    3419,CHANGE_THIS_TO_USE_ME
    3420,CHANGE_THIS_TO_USE_ME
    3421,CHANGE_THIS_TO_USE_ME
    3422,CHANGE_THIS_TO_USE_ME
    3423,CHANGE_THIS_TO_USE_ME
    3424,CHANGE_THIS_TO_USE_ME
    3425,CHANGE_THIS_TO_USE_ME
    3426,CHANGE_THIS_TO_USE_ME
    3427,CHANGE_THIS_TO_USE_ME
    3428,CHANGE_THIS_TO_USE_ME
    3429,CHANGE_THIS_TO_USE_ME
    3430,CHANGE_THIS_TO_USE_ME
    3431,CHANGE_THIS_TO_USE_ME
    3432,CHANGE_THIS_TO_USE_ME
    3433,CHANGE_THIS_TO_USE_ME
    3434,CHANGE_THIS_TO_USE_ME
    3435,CHANGE_THIS_TO_USE_ME
    3436,CHANGE_THIS_TO_USE_ME
    3437,CHANGE_THIS_TO_USE_ME
    3438,CHANGE_THIS_TO_USE_ME
    3439,CHANGE_THIS_TO_USE_ME
    3440,CHANGE_THIS_TO_USE_ME
    3441,CHANGE_THIS_TO_USE_ME
    3442,CHANGE_THIS_TO_USE_ME
    3443,CHANGE_THIS_TO_USE_ME
    3444,CHANGE_THIS_TO_USE_ME
    3445,CHANGE_THIS_TO_USE_ME
    3446,CHANGE_THIS_TO_USE_ME
    3447,CHANGE_THIS_TO_USE_ME
    3448,CHANGE_THIS_TO_USE_ME
    3449,CHANGE_THIS_TO_USE_ME
    3450,CHANGE_THIS_TO_USE_ME
    3451,CHANGE_THIS_TO_USE_ME
    3452,CHANGE_THIS_TO_USE_ME
    3453,CHANGE_THIS_TO_USE_ME
    3454,CHANGE_THIS_TO_USE_ME
    3455,CHANGE_THIS_TO_USE_ME
    3456,CHANGE_THIS_TO_USE_ME
    3457,CHANGE_THIS_TO_USE_ME
    3458,CHANGE_THIS_TO_USE_ME
    3459,CHANGE_THIS_TO_USE_ME
    3460,CHANGE_THIS_TO_USE_ME
    3461,CHANGE_THIS_TO_USE_ME
    3462,CHANGE_THIS_TO_USE_ME
    3463,CHANGE_THIS_TO_USE_ME
    3464,CHANGE_THIS_TO_USE_ME
    3465,CHANGE_THIS_TO_USE_ME
    3466,CHANGE_THIS_TO_USE_ME
    3467,CHANGE_THIS_TO_USE_ME
    3468,CHANGE_THIS_TO_USE_ME
    3469,CHANGE_THIS_TO_USE_ME
    3470,CHANGE_THIS_TO_USE_ME
    3471,CHANGE_THIS_TO_USE_ME
    3472,CHANGE_THIS_TO_USE_ME
    3473,CHANGE_THIS_TO_USE_ME
    3474,CHANGE_THIS_TO_USE_ME
    3475,CHANGE_THIS_TO_USE_ME
    3476,CHANGE_THIS_TO_USE_ME
    3477,CHANGE_THIS_TO_USE_ME
    3478,CHANGE_THIS_TO_USE_ME
    3479,CHANGE_THIS_TO_USE_ME
    3480,CHANGE_THIS_TO_USE_ME
    3481,CHANGE_THIS_TO_USE_ME
    3482,CHANGE_THIS_TO_USE_ME
    3483,CHANGE_THIS_TO_USE_ME
    3484,CHANGE_THIS_TO_USE_ME
    3485,CHANGE_THIS_TO_USE_ME
    3486,CHANGE_THIS_TO_USE_ME
    3487,CHANGE_THIS_TO_USE_ME
    3488,CHANGE_THIS_TO_USE_ME
    3489,CHANGE_THIS_TO_USE_ME
    3490,CHANGE_THIS_TO_USE_ME
    3491,CHANGE_THIS_TO_USE_ME
    3492,CHANGE_THIS_TO_USE_ME
    3493,CHANGE_THIS_TO_USE_ME
    3494,CHANGE_THIS_TO_USE_ME
    3495,CHANGE_THIS_TO_USE_ME
    3496,CHANGE_THIS_TO_USE_ME
    3497,CHANGE_THIS_TO_USE_ME
    Call the table customStatsTable.csv.

    Now, the custom functions to find the stat by string reference:

    Code:
    statGetCustom( dataName ) {
    	return self getStat( int(tableLookup( "mp/customStatsTable.csv", 1, dataName, 0 )) );
    }
    
    statSetCustom( dataName, value ) {
    	self setStat( int(tableLookup( "mp/customStatsTable.csv", 1, dataName, 0 )), value );	
    }

  13. The Following 3 Users Say Thank You to Tally For This Useful Post:

    BlancO (18th September 2013),kung foo man (18th September 2013),YuriJurek (18th September 2013)

  14. #10
    Private
    Join Date
    Feb 2013
    Location
    Poland
    Posts
    32
    Thanks
    33
    Thanked 27 Times in 8 Posts
    Well, thanks a lot but I have few questions.

    Are these stats server-side or client-side? (I mean can player edit his stats) (What is the path to it)


    Is it correct?

    customStatsTable.csv
    PHP Code:
    3150,kills
    3151
    ,score
    3152
    ,connects
    3153
    ,spawns 
    .gsc script
    PHP Code:
    getDatadataName )
    {
        return 
    self getStatint(tableLookup"mp/customStatsTable.csv"1dataName)) );
    }

    setDatadataNamevalue )
    {
        
    self setStatint(tableLookup"mp/customStatsTable.csv"1dataName)), value );    
    }

    addDatadataNamevalue )
    {
        
    newValue getDatadataName ) + value;
        
    self setStatint(tableLookup"mp/customStatsTable.csv"1dataName)), newValue );    

    mod.csv
    PHP Code:
    stringtable,mp/customStatsTable.csv 

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
  •