AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Need some help with scripting (https://forums.alliedmods.net/showthread.php?t=337360)

PawnBegg 04-15-2022 15:34

Need some help with scripting
 
Hello, i want to call native from another .sma but i got error
Code:

L 04/15/2022 - 22:26:54: [AMXX] Displaying debug trace (plugin "csgo_operations.amxx", version "2.1")
L 04/15/2022 - 22:26:54: [AMXX] Run time error 4: index out of bounds
L 04/15/2022 - 22:26:54: [AMXX]    [0] csgo_operations.sma::_csgo_get_user_operation_text (line 420)
L 04/15/2022 - 22:26:54: Unhandled dynamic native error
L 04/15/2022 - 22:26:54: [AMXX] Displaying debug trace (plugin "csgo_remake.amxx", version "2.2")
L 04/15/2022 - 22:26:54: [AMXX] Run time error 10: native error (native "csgo_get_user_operation_text")
L 04/15/2022 - 22:26:54: [AMXX]    [0] csgo_remake.sma::task_HUD (line 2364)

csgo_operations ->
Code:

public _csgo_get_user_operation_text(id, dataReturn[], dataLength)
{
        param_convert(2);

        if (playerData[id][PLAYER_ID] > -1) // Line 420
        {
                formatex(dataReturn, dataLength, "%L", id, "CSGO_OPERATIONS_TEXT_PROGRESS", get_progress(id), get_progress_need(id), float(get_progress(id)) / float(get_progress_need(id)) * 100.0, "%");
        }
        else
        {
                formatex(dataReturn, dataLength, "%L", id, "CSGO_OPERATIONS_TEXT_COMMAND");
        }
}

csgo_remake.sma ->
Code:

public task_HUD(id)
{       
        #if defined DEBUG
        log_to_file("csgor_debug_logs.log", "task_HUD()")
        #endif
        static operation[64];
        csgo_get_user_operation_text(id, operation, charsmax(operation));  // LINE 2364
        id -= TASK_HUD;

        if (!GetPlayerBit(g_bitIsAlive, id))
                return;

        if (g_bLogged[id])
        {
                new szRank[MAX_RANK_NAME];

                switch(g_iCvars[iShowHUD])
                {
                        case iStandardHUD:
                        {
                                new userRank = g_iUserRank[id];
                                ArrayGetString(g_aRankName, userRank, szRank, charsmax(szRank));
                                set_hudmessage(0, 255, 0, 0.02, 0.9, 0, 6.00, 1.10);
                                ShowSyncHudMsg(id, g_MsgSync, "%L", LANG_SERVER, "CSGOR_HUD_INFO1", g_iUserPoints[id], g_iUserKeys[id], g_iUserCases[id], szRank);
                        }
                        case iAdvancedHUD:
                        {
                                new userRank = g_iUserRank[id];
                                new szSkin[MAX_SKIN_NAME], szTemp[128];
                                new bool:bError = false;

                                new iActiveItem = get_pdata_cbase(id, OFFSET_ACTIVE_ITEM, XO_PLAYER);

                                if(pev_valid(iActiveItem) != PDATA_SAFE)
                                {
                                        bError = true;
                                }

                                new weapon = get_pdata_int(iActiveItem, OFFSET_ID, XO_WEAPON);

                                if((1 << weapon) & weaponsWithoutSkin)
                                {
                                        bError = true;
                                }

                                new skin

                                if(!bError)
                                {
                                        skin = GetSkinInfo(id, weapon, iActiveItem);
                                }

                                if(skin == -1 || bError)
                                {
                                        formatex(szSkin, charsmax(szSkin), "%L", LANG_SERVER, "CSGOR_NO_ACTIVE_SKIN_HUD");
                                        copy(szTemp, charsmax(szTemp), szSkin);
                                }
                                else
                                {
                                        ArrayGetString(g_aSkinName, skin, szSkin, charsmax(szSkin));
                                        if(g_iStattrackWeap[id][bStattrack][weapon])
                                        {
                                                formatex(szTemp, charsmax(szTemp), "StatTrack (TM) %s^n%L", szSkin, LANG_SERVER, "CSGOR_CONFIRMED_KILLS_HUD", g_iStattrackWeap[id][iKillCount][g_iStattrackWeap[id][iSelected][weapon]]);
                                        }
                                        else
                                        {
                                                formatex(szTemp, charsmax(szTemp), szSkin);
                                        }
                                }
                               
                                if (hudOperation) {
                                        formatex(szTemp, charsmax(operation), "%L", LANG_SERVER, "CSGO_RANKS_HUD_OPERATION", operation);
                                } else {
                                        operation = "";
                                }
                                ArrayGetString(g_aRankName, userRank, szRank, charsmax(szRank));
                                set_hudmessage(0, 255, 0, 0.68, 0.21, 0, 6.00, 1.10);
                                ShowSyncHudMsg(id, g_MsgSync, "%L", LANG_SERVER, "CSGOR_HUD_INFO2", g_iUserPoints[id], g_iUserKeys[id], g_iUserCases[id], szRank, szTemp, operation);
                        }
                }
        }
        else
        {
                set_hudmessage(255, 0, 0, 0.02, 0.9, 0, 6.00, 1.10);
                ShowSyncHudMsg(id, g_MsgSync, "%L", LANG_SERVER, "CSGOR_NOT_LOGGED");
        }

        set_task(1.0, "task_HUD", id + TASK_HUD);
}

how to fix it ? :)

PawnBegg 04-15-2022 16:05

Re: Need some help with scripting
 
Fixed, just have to move this line csgo_get_user_operation_text(id, operation, charsmax(operation)); // LINE 2364 after this if (!GetPlayerBit(g_bitIsAlive, id))
return;


All times are GMT -4. The time now is 21:19.

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