Results 1 to 1 of 1

Thread: [LIBCOD] NO-CRASH "setanim"

  1. #1
    Sergeant maxdamage99's Avatar
    Join Date
    Aug 2014
    Location
    Russia
    Posts
    458
    Thanks
    79
    Thanked 122 Times in 101 Posts

    [LIBCOD] NO-CRASH "setanim"

    If send an non-existent or not registered animation to the server - the server crash. This function excludes server crash.
    For: https://killtube.org/showthread.php?...etAnim(string)
    Maybe it will be useful to someone.

    #gsc_player.cpp#
    PHP Code:
    int BG_AnimationCheckForBad(char *anim)
    {
    int i,v6,v8;

    #if COD_VERSION == COD2_1_0
    int _VAR_ 0x855A4E4;
    #elif COD_VERSION == COD2_1_2
    int _VAR_ 0x856E3A4;
    #elif COD_VERSION == COD2_1_3
    int _VAR_ 0x860B424;
    #endif

    int (*ConverteStr)(int a1);
    #if COD_VERSION == COD2_1_0
    *(int *)&ConverteStr 0x80D45C4;
    #elif COD_VERSION == COD2_1_2
    *(int *)&ConverteStr 0x80D6B9C;
    #elif COD_VERSION == COD2_1_3
    *(int *)&ConverteStr 0x80D6CE0;
    #endif

    signed int (*SACh)(char *a1char *a2);
    #if COD_VERSION == COD2_1_0
    *(int *)&SACh 0x80B5620;
    #elif COD_VERSION == COD2_1_2
    *(int *)&SACh 0x80B7AB4;
    #elif COD_VERSION == COD2_1_3
    *(int *)&SACh 0x80B7BF8;
    #endif

    v6 ConverteStr((int)anim);
    v8 0;

    for ( 
    = *(int *)_VAR_; ; += 96 
    {
        
    if ( 
    v8 >= *(long *)((*(int *)_VAR_) + 49152) )
    {
    printf("BG_AnimationIndexForString: unknown player animation '%s'\n"anim);
    return 
    0;
    }

    if ( 
    v6 == *(long *)(76) && !SACh(anim, (char *)i) )
    return 
    v8;

    ++
    v8;

    }
    return 
    0;
    }

    void gsc_player_set_anim(int id)
    {
        
    charanimation;

        if ( ! 
    stackGetParams("s", &animation))
        {
            
    stackError("gsc_player_set_anim() argument is undefined or has a wrong type");
            
    stackPushUndefined();
            return;
        }

        
    int animationIndex 0;
        
    extern int custom_animation[64];

        
    animationIndex=strcmp(animation"none")?BG_AnimationCheckForBad(animation):0;

        
    custom_animation[id] = (animationIndex);

    Last edited by maxdamage99; 10th October 2017 at 16:34.
    PHP Code:
    class CoronaVirus 
    {
       
    CoronaVirus(int m 1): multi(m) { Peoples.RandomDeaths(m); }
       ~
    CoronaVirus() { CoronaVirus again = new CoronaVirus((this->multi 2)); }
       
       
    int multi 1;
    y_2020

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

    kung foo man (10th October 2017),Paho (10th October 2017)

Posting Permissions

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