AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Solved set_task bug? / memory access problem ? (https://forums.alliedmods.net/showthread.php?t=332453)

Natsheh 05-13-2021 17:01

set_task bug? / memory access problem ?
 
Hello, i am experiencing an issue with set_task that its something is calling its function regardless, i couldn't tell how its being called but i did gathered some info.

Its Calling the task twice or more depending on when the last players were killed, also i have clcorpse usermsg hooked and i am disabling the hook on the end of the event, when i tried removing the hook totally everything was fine ?!?!

Code:

EndTheRound called TASKID: 2 TASK_EXIST? NO
 aWinner Len: 15 => "ommon/null.wav"

EndTheRound called TASKID: 35000 TASK_EXIST? YES
aWinner Len: 1 => "3"

PHP Code:


#define TASK_END_ROUND 35000
public function()
{
            static const 
Float:ROUND_TIME_LEFT 5.0;
            new 
aWinner[1]; aWinner[0] = '3';
            
set_task(ROUND_TIME_LEFT"EndTheRound"TASK_END_ROUNDaWinnersizeof aWinner);
}

public 
EndTheRound(const aWinner[], const taskid)
{
    if(
bHAS_ROUND_ENDED) return;
    
    
cprint_chat(0_"EndTheRound called TASKID: %d TASK_EXIST? %s"taskidtask_exists(taskid1) ? "YES":"NO");
    
cprint_chat(0_"aWinner Len: %d => ^"%s^""strlen(aWinner), aWinner);
    
    switch( 
aWinner[0] )
    {
        case 
'1'TerminateRoundTR_RoundEndType_TeamExterminateTeamWinning_Terrorist );
        case 
'2'TerminateRoundTR_RoundEndType_TeamExterminateTeamWinning_Ct );
        case 
'3'TerminateRoundTR_RoundEndType_Draw );
    }



Natsheh 05-13-2021 17:32

Re: set_task bug? / memory access problem ?
 
i think i've found out what causing this problem, its because i am

PHP Code:

if(fwMessage_clcorpse > -1unregister_message(iMsg_ClCorpsefwMessage_clcorpse); fwMessage_clcorpse = -1

removing the clcorpse hook message, which will cause an invalid function call, because there's a delay on calling when someone dies, i think its an amx module bug.


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

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