Skip to content

Many player functions behave inconsistently when passing an invalid player element #304

@patrikjuvonen

Description

@patrikjuvonen

Describe the bug
Many player functions process the element provided as CElement* instead of CPlayer*, causing inconsistency between some of the functions. For example, by providing root as the element, it will not throw a warning, while some of the functions do.

To Reproduce

  1. getPlayerIP(root) -> false, no warning
  2. getPlayerSerial(root) -> false, warning

Expected behavior
Make all functions work consistently. Specific class function -> require that specific class element.

MTA Client & Server
Multi Theft Auto v1.5.5-release-13977

Additional context

  • Should probably also check out other classes while at it.
  • I stumbled across to this problem while helping someone with a script problem on our Discord #scripting channel. They were using these two functions together and they asked me why does it throw an error on serial, but not on IP (IP was before serial). I then investigated and found these inconsistencies. And I agree, it is a stupid inconsistency that has to be fixed.
  • Does not require backwards compatibility as the only thing changing is we're essentially adding a warning.

Metadata

Metadata

Assignees

Labels

bugSomething isn't workinggood first issueGood for newcomers

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions