AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Problem with amxx version change. (https://forums.alliedmods.net/showthread.php?t=319611)

Mikka 11-10-2019 14:36

Problem with amxx version change.
 
Hello, I have a certain code and it worked on amxx 1.8.3 unfortunately for many reasons I was forced to change the amxx to version 1.9.

[HAMSANDWICH] Wrong data type (data is of type entity)
L 11/10/2019 - 09:05:08: [AMXX] Displaying debug trace (plugin "jbxtreme_wishes.amxx", version "1.00a")
L 11/10/2019 - 09:05:08: [AMXX] Run time error 10: native error (native "SetHamParamFloat")
L 11/10/2019 - 09:05:08: [AMXX] [0] jbxtreme_wishes.sma::vTracerAttack (line 992)
L 11/10/2019 - 09:05:08: [AMXX] [1] jbxtreme_wishes.sma::TraceAttack (line 939)

line 992: SetHamParamFloat(4, 999.0);
line 939: return vTracerAttack(id, attacker, -1);

Code:

public TakeDamage(id, ent, attacker, Float:damage, damagebits)
        return vTracerAttack(id, attacker, ent);

public TraceAttack(id, attacker, Float:damage, Float:direction[3], tracehandle, damagebits)
        return vTracerAttack(id, attacker, -1);

vTracerAttack(id, attacker, ent)
{
        if(!pojedynek[0] || !is_user_connected(id) || id == attacker)
                return HAM_IGNORED;
       
        if((kandydaci_pojedynek[0] == id || kandydaci_pojedynek[1] == id) && czas_do_pojedynku > 0) {
                return HAM_SUPERCEDE;
        }
       
        if(pojedynek[0] == id && pojedynek[1] != attacker)
                return HAM_SUPERCEDE;
               
        if(pojedynek[0] == attacker && pojedynek[1] != id)
                return HAM_SUPERCEDE;       

        if(is_user_connected(attacker)) {/*
                if(typ_pojedynku == 1 && get_pdata_int(id, 75, 5) != HIT_HEAD) {
                        return HAM_SUPERCEDE;
                }
                */
                if(typ_pojedynku == 2) {
                        SetHamParamFloat(4, 999.0);
                        return HAM_HANDLED;
                }
               
                if(bronie_pojedynek == CSW_KNIFE && ent != -1 && !kosy)
                {
                        if(ent == attacker)
                                return HAM_SUPERCEDE;
       
                        new Float:ViewAngle[3], iOrigin[3];
                        for(new i=0; i<3; i++)
                                ViewAngle[i] = random_float(-50.0, 50.0);
       
                        get_user_origin(id, iOrigin);
                        message_begin(MSG_BROADCAST, SVC_TEMPENTITY);
                        write_byte(TE_BLOODSPRITE);
                        write_coord(iOrigin[0]);
                        write_coord(iOrigin[1]);
                        write_coord(iOrigin[2]);
                        write_short(blood2);
                        write_short(blood);
                        write_byte(229);
                        write_byte(25);
                        message_end();
                               
                        set_pev(id, pev_punchangle, ViewAngle);
                        SetHamParamEntity(2, attacker);
                        return HAM_IGNORED;
                }
        }
       
        return HAM_IGNORED;
}


iNvectus 11-10-2019 16:21

Re: Problem with amxx version change.
 
At
Code:
get_user_origin(id, iOrigin);             message_begin(MSG_BROADCAST, SVC_TEMPENTITY);             write_byte(TE_BLOODSPRITE);             write_coord(iOrigin[0]);             write_coord(iOrigin[1]);             write_coord(iOrigin[2]);             write_short(blood2);             write_short(blood);             write_byte(229);             write_byte(25);             message_end();                             set_pev(id, pev_punchangle, ViewAngle);             SetHamParamEntity(2, attacker);             return HAM_IGNORED;

you have set the second parameter of
Code:
SetHamParamEntity(2, attacker);

as attacker id or entity id aka a player id. It expects a float value, not id of entity.

PS:

Ignore my post... Now that I've read what I've written last night... I apologize. It has nothing to do with it. Probably Natseh is right.

Natsheh 11-11-2019 01:47

Re: Problem with amxx version change.
 
Use only SetHamParam... inside the callback function


All times are GMT -4. The time now is 02:57.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.