mohabhassan / NightFall

MOHAA/MOHSH/MOHBT dgamex86 wrapper.
https://www.x-null.net/forums/forum.php
12 stars 5 forks source link

[Feature Request] changeteam event #51

Open eduzappa18 opened 9 months ago

eduzappa18 commented 9 months ago

Basically an event triggered when a player switch teams. (I think this even already exist in openmohaa. Not sure if it really works tho)

local.result = registerev "changeteam" path/to/script.scr::changeteam

// edit: maybe having local.newteam as second parameter and local.oldteam at last would make more sense, idk
changeteam local.player local.oldteam local.newteam:

end

with local.oldteam and local.newteam returning the same possible values as local.player.dmteam allies, axis, spectator or freeforall (no idea if freeforall even works, never seen it returning that)

vs98-dev commented 9 months ago

you dont need a event for this, if you add a variable to the player setting the original team he was and then keep checking if the actual team have changed to a different team as the variabel, you know when the player have changed team.

eduzappa18 commented 9 months ago

you dont need a event for this…

I don't need it. I want it

vs98-dev commented 9 months ago

This is the same reply you have say to dragon about the feature he whanted: No need for a new function, you can do this via script:


main:

while (1) {

    waitframe

    for (local.i = 1; local.i <= $player.size; local.i++) {
        local.player = $player[local.i];

        if(local.player.original_team == NIL)
        {
            local.player.original_team = local.player.dmteam
        }

        if(local.player.dmteam != local.player.original_team)
        {
            stuffsrv("say Player " + local.player.netname + " have changed team from " + local.player.original_team + " to " + local.player.dmteam)
            local.player.original_team = local.player.dmteam
        }
    }
}

end
eduzappa18 commented 9 months ago

My reply to Dragon was a one line thing using the exact rcon command he was refering to, and I thought he didn't know that it could be used along with stuffsrv. Did that offend you or something?

And the whole point of having events is to prevent the use of while loops and workarounds like that.

But anyways, thanks for your help, doublekill

My feature request stays up

vs98-dev commented 9 months ago

The while loops exist on the scripting, are meant to be used and we know a while loop doesnt do nothing to the performance of the server if his done properly.

What tilts me, is you prefer wasting time of RyBack on creating the event, instead you easly make this by script.

Sayng to avoid a while loop is bad escuse.

Other important thing is we should suggest features where theres no possible way by scripting so that feature are worth the time of RyBack and we know time is very valuable when you dont have pratacly him for the things you whant to do.

mohabhassan commented 9 months ago

No worries double, I usually do the highest priority feature requests/bugfixes first. Thank you for considering the time factor for me 😄. Yes this can be done with loops, but IMO events are a cleaner way to do it. I already considered implementing it before releasing v1.2.0 in NF but there were some hurdles.