AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Bomb explosion triggers an event twice (https://forums.alliedmods.net/showthread.php?t=327870)

stanciu 10-14-2020 07:50

Bomb explosion triggers an event twice
 
Hello,

Stumbled upon an error.

I have:

PHP Code:

register_event("SendAudio""eventTCastiga""a""2&%!MRAD_terwin"

Then

PHP Code:

public eventTCastiga()
{
    if(
g_MixInceput)
    {
        
g_ScorEchipaT++
    }


Which basically adds +1 score to TERRORRISTS.

Then I have this text that displays at the end of the round, which basically states the score and the overall number of rounds.

PHP Code:

if(g_ScorEchipaT != 16 && g_ScorEchipaCT != 16)
            
ColorChat(0GREEN"^1Runda ^4%d^1 s-a sfarsit. Scor: ^3[TERRORISTS] ^4%d ^1- ^4%d ^3[COUNTER-TERRORISTS]"g_NumarRundeTotalg_ScorEchipaTg_ScorEchipaCT

But if I plant the bomb and the bomb explodes, it adds +2 score to the TERRORISTs. Displays the score twice as well.

Example: Round 3 finished. Score: TERRORISTS 2 - 1 COUNTER TERRORISTS.
then displays again Round 4 finished. Score TERRORISTS 3 - 1 COUNTER TERRORISTS.

TL;DR bomb explosion adds +2 score instead of +1 and triggers twice.

Napoleon_be 10-14-2020 16:02

Re: Bomb explosion triggers an event twice
 
https://forums.alliedmods.net/showthread.php?t=17379

This should help you.

stanciu 10-14-2020 16:29

Re: Bomb explosion triggers an event twice
 
Quote:

Originally Posted by Napoleon_be (Post 2721358)

Thanks. I somehow have found a fix by having a variable check if the round is over or not. It fixed, might not be the best solution -- will switch to that soon! Thank you, solved!


All times are GMT -4. The time now is 13:49.

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