Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature Request] changeteam event #51

Open
eduzappa18 opened this issue Feb 23, 2024 · 6 comments
Open

[Feature Request] changeteam event #51

eduzappa18 opened this issue Feb 23, 2024 · 6 comments
Labels
enhancement New feature or request

Comments

@eduzappa18
Copy link

eduzappa18 commented Feb 23, 2024

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
Copy link
Contributor

vs98-dev commented Feb 26, 2024

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
Copy link
Author

you dont need a event for this…

I don't need it. I want it

@vs98-dev
Copy link
Contributor

vs98-dev commented Feb 27, 2024

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
Copy link
Author

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
Copy link
Contributor

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
Copy link
Owner

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.

@mohabhassan mohabhassan added the enhancement New feature or request label Feb 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants