Page 8 of 9 FirstFirst ... 6789 LastLast
Results 141 to 160 of 176
  1. #141

    Re: Sig coding: Collection of useful functions

    Here is a genuine query lol

    I have had an idea for a sig but I am not sure if the API will do this (or can it?). I would like to make an "Army of two" signature with stats for me and also for my clan mate.

    I had a think on how to code it, here is my PSEUDO

    Var Ath's PID
    Var Mag's PID

    Function (Get Athrun's stats)
    INPUT Ath's PID
    PROCESS Collect Ath's stats, place in variables ie Var Kills = p.stats.global.kills;
    RETURN Ath's Selected Stats


    Function (Get Magnitudemus' stats)
    INPUT Mag's PID
    PROCESS Collect Mag's stats, place in variables ie Var Kills = p.stats.global.kills;
    RETURN Mag's Selected Stats (return, mkills, mdeaths etc)

    Then just code as normal using the prefix A on my variables and M on Mags variables.

    Just need to know if you can select different playerId's or its just one.

    Thanks.

  2. #142
    Experienced user HigH_HawK's Avatar
    Join Date
    2006-03-15
    Location
    UK / GER
    Posts
    1,104

    Re: Sig coding: Collection of useful functions

    As far as I know this is not be possible, as you are calling the stats signature with your soldiers name and therefore it would only pull your data but not the data from your mate.

  3. #143
    New User
    Join Date
    2011-12-19
    Posts
    5
    BFBC2 PS3
    L_astic
    BF3 PS3
    L_astic

    Re: Sig coding: Collection of useful functions

    think he's right. I have already tried to get an other player stats (e.g. for a server sig with stats of fan players) but this needs an http request to get the player stats and the app doesn't allow it as it only gives you a sub part of the javascript possibilities ( you haven't any access to more elaborate stuffs).

    if someone knows how, i'll also be interested


  4. #144
    New User
    Join Date
    2011-12-19
    Posts
    5
    BFBC2 PS3
    L_astic
    BF3 PS3
    L_astic

    Re: Sig coding: Collection of useful functions

    concerning the strimming of server's name : I think that it's a better idea to set the fontsize so that the full name fits the available space in the sig rather than cutin' the name ...

    I wrote this as I did it for our server's sig :
    var sig_w=590
    var pos_name_x = 60
    var pos_name_y = 18
    var name_size=12;
    if((((name_size)*s.name.length)/2) > sig_w/2){
    name_size=((295)*2/s.name.length) -1
    }

    rectangle({x:2,y: pos_name_y-16,w:sig_w-5,h:20,color:rect_color,fill:rect_fill_bw});
    text({text:s.name,font:def_font,x: (sig_w/2)-((name_size-1)*s.name.length)/2,y: pos_name_y,size:name_size,color:def_color}
    The space allowed for the server name is quite the full width of the sig. This short code adapts the fontsize function of the length of the server name .


  5. #145

    Equipment Service Star Code (ie C4)

    What would be the code for service stars for C4?

    I tried this, but it didn't work:

    Code:
    defaults.text.size=10;
    var wpn=p.stats.weapons
    var glb=p.stats.global
    var wae=p.stats.equipment
    
    // C4 Service Stars
    image({file:'0otyti5FU0ESJKFYsQ/servicestar.png', x:190, y:87, w:20, h:20});
    text({x:210, y:104, size:10, color:'000000', text:wae.waeC4.star.count});

  6. #146

    Re: Equipment Service Star Code (ie C4)

    Also, would it have anything to do with the glitch "ID_P_WSTAR_NAME_C4
    ID_P_WSTAR_DESC_C4?"

  7. #147

    Re: Equipment Service Star Code (ie C4)

    Quote Originally Posted by David Lee Houch View Post
    What would be the code for service stars for C4?
    [/CODE]
    I don't think c4 star count exists so you just need to figure it out like people have been doing for vehicles. I don't have time to test right now but I assume something like floor(wae.waeC4.kills/100) would get you the service star number you wanted.

    GL

  8. #148
    New User
    Join Date
    2012-05-12
    Posts
    3

    Re: Sig coding: Collection of useful functions

    I have been looking everywhere for some example code for the top 10 fans on a server. Unfortunately all the sigs that contain this are keeping the code secret. Does any kind folk here have any kicking around by any chance?

    Thanks in advance

  9. #149
    New User
    Join Date
    2012-05-30
    Posts
    3

    Re: Sig coding: Collection of useful functions

    i have tried to copy and paste some of these codes and not getting anything to "appear" on my graphic. help would be appreciated

  10. #150

    Re: Sig coding: Collection of useful functions

    Hi All

    I'm trying to build my 1st server sig, so I'm a bit of a noob, I've got the basics done But I'm after the code for showing most popular players on the server, say top 15.

    Any help would be greatly appreciated

    Cheers
    Last edited by Ruthless-K; 2012-06-02 at 15:06.

  11. #151
    New User
    Join Date
    2012-05-12
    Posts
    3

    Re: Sig coding: Collection of useful functions

    Ok I can now pretty much pull everything apart from the names and count in the PList. If someone could at least point me in the right direction of how to do this I would really appreciate it.

  12. #152

    Re: Sig coding: Collection of useful functions

    Quote Originally Posted by 1ApRiL View Post
    Here I collect useful functions for you graphic coders.
    If you have any suggestions or wishes for new functions, write it down in this thread.
    Code:
    /**
     * Get the weapon of latest service star
     * @returns weapon object
     */
    var getLatestWeaponStar=function(){
        if(!p.stats || !p.stats.weapons) return null;
        var ret=null;
        
        for(var w in p.stats.weapons) {
            if(!p.stats.weapons[w].star || !p.stats.weapons[w].star.date) continue;
            if(!ret || ret.star.date<p.stats.weapons[w].star.date) {
                ret=p.stats.weapons[w];
            }
        }
        return ret;
    };
    How can i get the graphic for this weapon and the service stars?
    Last edited by Wutzmann; 2012-07-10 at 21:51.

  13. #153

    Re: Sig coding: Collection of useful functions

    All service stars


    Code:
    var getStarCount=function(){
        var startotal = 0;
        for (n in p.stats.weapons) { startotal += p.stats.weapons[n].star.count; };
        for (n in p.stats.vehcats) { startotal += p.stats.vehcats[n].star.count; };
        if (p.stats.kits.recon.star.count > 0 ) startotal += p.stats.kits.recon.star.count;
        if (p.stats.kits.assault.star.count > 0 ) startotal += p.stats.kits.assault.star.count;
        if (p.stats.kits.engineer.star.count > 0 ) startotal += p.stats.kits.engineer.star.count;
        if (p.stats.kits.support.star.count > 0 ) startotal += p.stats.kits.support.star.count;
        return startotal;
    };
    
    text({ x:xcoord, y:ycoord, text:getStarCount() });


  14. #154

    Re: Sig coding: Collection of useful functions

    What code do I use to have the total kills personal defense weapons? I wanna recreate my tags I have for the PDW medal...

  15. #155

    Re: Sig coding: Collection of useful functions

    Quote Originally Posted by Le_Stat_ View Post
    What code do I use to have the total kills personal defense weapons?

    You want total service stars obtained by all PDW weapons or just the kill number?


  16. #156

    Re: Sig coding: Collection of useful functions

    Quote Originally Posted by eXoTaylor View Post
    You want total service stars obtained by all PDW weapons or just the kill number?
    Number of kills plz

  17. #157

    Re: Sig coding: Collection of useful functions

    Quote Originally Posted by eXoTaylor View Post
    You want total service stars obtained by all PDW weapons or just the kill number?
    Apologize for the double post but this is what I'm trying to do...
    There is a current sig called bf3s_dogt_l

    I just wanna add my total kills with ALL pdw like it is when you recieive the PDW Medal...

    Current code for the sig:
    --------------------------------------------
    defaults.text.color='FFFFFF';
    defaults.text.font='fonts/Vera.ttf';

    if(p.dogtags) {

    image({file.dogtags.basic.image_l, x:10, y:2, w:256, h:148});
    image({file.dogtags.advanced.image_l, x:250, y:2, w:256, h:148});

    // Name
    text({x:61, y:88, size:15, text.name, color:'cccccc'});
    text({x:60, y:87, size:15, text.name, color:'4a4c4e'});


    } else {
    text({x:120, y:28, size:11, text:'No Dogtag info found\nPlease update your stats.', color:'EEEEEE'});
    text({x:121, y:29, size:11, text:'No Dogtag info found\nPlease update your stats.', color:'000000'});
    --------------------------------------------

  18. #158

    Re: Sig coding: Collection of useful functions

    Quote Originally Posted by Le_Stat_ View Post
    Apologize for the double post but this is what I'm trying to do...
    There is a current sig called bf3s_dogt_l

    I just wanna add my total kills with ALL pdw like it is when you recieive the PDW Medal...

    Current code for the sig:
    --------------------------------------------
    defaults.text.color='FFFFFF';
    defaults.text.font='fonts/Vera.ttf';

    if(p.dogtags) {

    image({file.dogtags.basic.image_l, x:10, y:2, w:256, h:148});
    image({file.dogtags.advanced.image_l, x:250, y:2, w:256, h:148});

    // Name
    text({x:61, y:88, size:15, text.name, color:'cccccc'});
    text({x:60, y:87, size:15, text.name, color:'4a4c4e'});


    } else {
    text({x:120, y:28, size:11, text:'No Dogtag info found\nPlease update your stats.', color:'EEEEEE'});
    text({x:121, y:29, size:11, text:'No Dogtag info found\nPlease update your stats.', color:'000000'});
    --------------------------------------------
    Hope this helps...

    Code:
    text({x:370, y:38, size:10, text:'PDW Kills:', align:'left', color:'121212'});
    
    text({x:440, y:38, size:10, align:'left', color:'121212', 
    text:wpn.smMP7.kills+wpn.smVAL.kills+wpn.smUMP.kills+wpn.smPP2000.kills+wpn.smP90.kills+wpn.smPP19.kills+wpn.smM5K.kills+wpn.smPDR.kills});
    If they add new PDW weapons you would have to add them.


  19. #159

    Re: Sig coding: Collection of useful functions

    This is what I'm kind of looking for...


  20. #160

    Re: Sig coding: Collection of useful functions

    This is what I'm kind of looking for...

    Click image for larger version

Name:	Untitled.png
Views:	21
Size:	146.6 KB
ID:	3504

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
P-STATS NETWORK FORUM LOGIN CREATE ACCOUNT