Page 2 of 4 FirstFirst 1234 LastLast
Results 11 to 20 of 35

Thread: No .so created

  1. #11
    Brigadier General
    Join Date
    Dec 2012
    Posts
    1,012
    Thanks
    440
    Thanked 171 Times in 132 Posts
    I get Segmentation error on these 2 lines
    Code:
    strcpy(defaultweapon_mp, "defaultweapon_mp");
    	defaultweapon_mp[strlen(defaultweapon_mp)] = '\0';
    gsc_utils.cpp

    However, when I comment them out, setweaponfiretime doesnt work correctly (no error, but also no change in firetime) and after I shoot I get full ammo everytime

  2. #12
    Global Mossaderator Mitch's Avatar
    Join Date
    Nov 2012
    Posts
    654
    Thanks
    204
    Thanked 450 Times in 305 Posts
    Quote Originally Posted by Ni3ls View Post
    I get Segmentation error on these 2 lines
    Code:
    strcpy(defaultweapon_mp, "defaultweapon_mp");
    	defaultweapon_mp[strlen(defaultweapon_mp)] = '\0';
    gsc_utils.cpp

    However, when I comment them out, setweaponfiretime doesnt work correctly (no error, but also no change in firetime) and after I shoot I get full ammo everytime
    Can you post the segmentation fault of this crash from dmesg?
    Does the getweaponfiretime function read the firetime correctly?

  3. #13
    Brigadier General
    Join Date
    Dec 2012
    Posts
    1,012
    Thanks
    440
    Thanked 171 Times in 132 Posts
    Quote Originally Posted by Mitch View Post
    Can you post the segmentation fault of this crash from dmesg?
    Trying to reproduce the seg fault
    Quote Originally Posted by Mitch View Post
    Does the getweaponfiretime function read the firetime correctly?
    No for all weapons it returns 0

    Code:
    			case "firetime":
    				if(args.size >= 3) // say !firetime time
    				{
    					firetime = Int(args[2]);
    					maps\mp\gametypes\_weapons::setWepFireTime(self getCurrentWeapon(), firetime);
    				}
    				else
    				{
    					firetime = maps\mp\gametypes\_weapons::WeaponFireTime(self getCurrentWeapon());
    					self thread tellMessage("FireTime: " + firetime);
    				}
    				return;
    And this is what I added in _weapons.gsc from another thread. I dont load/setup/precache anything in any other script. I dont know if I have to.
    Code:
    ///NEW
    loadWeaponInfo(i, array)
    {
        array.id = i;
        array.dmg = getweapondamage(i); // store baseline
        array.meleedmg = getweaponmeleedamage(i); // in case you want to restore old value
        
        if(i >= 64) // no viewmodels after 64th weapon
            array.bugged = 1;
    }
    
    getWeaponArray(weapon)
    {
        if(isDefined(level.weapons[weapon]) && isDefined(level.weapons[weapon].id))
            return level.weapons[weapon];
        else if(isDefined(level.otherweapons[weapon]) && isDefined(level.otherweapons[weapon].id))
            return level.otherweapons[weapon];
        else
            return undefined;
    }
    
    updateWepDamage(weapon, dmg)
    {
        array = getWeaponArray(weapon);
        if(isDefined(array))
            array.dmg = dmg;
    }
    
    updateWepMeleeDamage(weapon, dmg)
    {
        array = getWeaponArray(weapon);
        if(isDefined(array))
            array.meleedmg = dmg;
    }
    
    getWeaponId(weapon)
    {
        if(isDefined(level.weapons[weapon]) && isDefined(level.weapons[weapon].id))
            return level.weapons[weapon].id;
        else if(isDefined(level.otherweapons[weapon]) && isDefined(level.otherweapons[weapon].id))
            return level.otherweapons[weapon].id;
        else
            return -1;
    }
    
    WeaponMaxAmmo(weapon)
    {
        id = getWeaponId(weapon);
        if(id == -1)
            return 0;
        
        return getweaponmaxammo(id);
    }
    
    WeaponDamage(weapon)
    {
        id = getWeaponId(weapon);
        if(id == -1)
            return 0;
        
        return getweapondamage(id);
    }
    
    WeaponMeleeDamage(weapon)
    {
        id = getWeaponId(weapon);
        if(id == -1)
            return 0;
        
        return getweaponmeleedamage(id);
    }
    
    setWepDamage(weapon, dmg, isdefault)
    {
        id = getWeaponId(weapon);
        if(id == -1)
            return 0;
        
        if(isDefined(isdefault) && isdefault)
            updateWepDamage(weapon, dmg);
        
        return setweapondamage(id, dmg);
    }
    
    setWepMeleeDamage(weapon, dmg, isdefault)
    {
        id = getWeaponId(weapon);
        if(id == -1)
            return 0;
        
        if(isDefined(isdefault) && isdefault)
            updateWepMeleeDamage(weapon, dmg);
        
        return setweaponmeleedamage(id, dmg);
    }  
    
    WeaponFireTime(weapon)
    {
        id = getWeaponId(weapon);
        if(id == -1)
            return 0;
        
        return getweaponfiretime(id);
    }
    
    setWepFireTime(weapon, time)
    {
        id = getWeaponId(weapon);
        if(id == -1)
            return 0;
        
        return setweaponfiretime(id, time);
    }

  4. #14
    Global Mossaderator Mitch's Avatar
    Join Date
    Nov 2012
    Posts
    654
    Thanks
    204
    Thanked 450 Times in 305 Posts
    What CentOS version are you running?

    Also I have updated my CentOS build post, because in release 7 MySQL is replaced by MariaDB. Therefore the mysql packages are replaced by maradb-server and mariadb-devel.
    You can check if your mysql client is detected correctly by running:
    PHP Code:
    mysql_config --cflags --libs 

  5. The Following User Says Thank You to Mitch For This Useful Post:

    Ni3ls (11th November 2015)

  6. #15
    Brigadier General
    Join Date
    Dec 2012
    Posts
    1,012
    Thanks
    440
    Thanked 171 Times in 132 Posts
    Centos x64.

    If I run those commands
    Code:
    -I/usr/include/mysql  -g -pipe -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -fno-strict-aliasing -fwrapv -fPIC   -DUNIV_LINUX -DUNIV_LINUX
    -rdynamic -L/usr/lib64/mysql -lmysqlclient -lz -lcrypt -lnsl -lm -lssl -lcrypto
    EDIT: ammo issue is solved. I tried it with my old mod and it doesnt have the issue :/

    Still setweaponfiretime not working.

    Do I need to load the scripts somewhere?
    Last edited by Ni3ls; 8th November 2015 at 15:28.

  7. #16
    Global Mossaderator Mitch's Avatar
    Join Date
    Nov 2012
    Posts
    654
    Thanks
    204
    Thanked 450 Times in 305 Posts
    Quote Originally Posted by Ni3ls View Post
    Centos x64.
    Which CentOS release? 7? 6? 5?
    PHP Code:
    cat /etc/redhat-release 
    Edit: the problem that you have with your mysql is that your mysql lib is 64-bit and libcod requires the 32-bit client.
    If you can't install the 32-bit version then you need to use the vendors directory.
    Last edited by Mitch; 8th November 2015 at 17:40.

  8. The Following User Says Thank You to Mitch For This Useful Post:

    Ni3ls (11th November 2015)

  9. #17
    Brigadier General
    Join Date
    Dec 2012
    Posts
    1,012
    Thanks
    440
    Thanked 171 Times in 132 Posts
    Quote Originally Posted by Mitch View Post
    Which CentOS release? 7? 6? 5?
    PHP Code:
    cat /etc/redhat-release 
    CentOS release 6.5 (Final)


    But i dont want to use mysql. Cant i compile without it like izno said? How to do that?

  10. #18
    Assadministrator IzNoGoD's Avatar
    Join Date
    Aug 2012
    Posts
    1,718
    Thanks
    17
    Thanked 1,068 Times in 674 Posts
    If getweaponfiretime returns 0 for all weapons then there's something wrong with the addresses used by said function. Try to figure that out first. (maybe no #ifdef for different cod versions?)
    "Does not work" is an error report for a bug between keyboard and chair.

    All hail Artie Effem

  11. #19
    Global Mossaderator Mitch's Avatar
    Join Date
    Nov 2012
    Posts
    654
    Thanks
    204
    Thanked 450 Times in 305 Posts
    Quote Originally Posted by Ni3ls View Post
    CentOS release 6.5 (Final)


    But i dont want to use mysql. Cant i compile without it like izno said? How to do that?
    You can disable mysql by setting COMPILE_MYSQL to 0 in config.hpp.

    Edit:
    Quote Originally Posted by IzNoGoD View Post
    If getweaponfiretime returns 0 for all weapons then there's something wrong with the addresses used by said function. Try to figure that out first. (maybe no #ifdef for different cod versions?)
    It might be possible that the offsets are different in 1.0 than 1.2/1.3.
    Edit 2: firetime is the same offset as 1.3.
    Last edited by Mitch; 8th November 2015 at 18:55.

  12. #20
    Brigadier General
    Join Date
    Dec 2012
    Posts
    1,012
    Thanks
    440
    Thanked 171 Times in 132 Posts
    Compiling wiothout my-sql will give me libcod2_1_0.so, however with segmentation fault

    Code:
    cod2_lnxded_1_0[9742]: segfault at 0 ip 0000000000a6bf1d sp 00000000ffd68e58 error 6 in libc-2.12.so[934000+190000]
    cod2_lnxded_1_0[24555]: segfault at 0 ip 0000000000a6bf1d sp 00000000ffcd6958 error 6 in libc-2.12.so[934000+190000]
    cod2_lnxded[31179]: segfault at 0 ip 0000000000a6bf1d sp 00000000ffb3a1c8 error 6 in libc-2.12.so[934000+190000]
    Last 3 lines of "dmesg"

Posting Permissions

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