Giter VIP home page Giter VIP logo

Comments (8)

CantBeKarma avatar CantBeKarma commented on September 26, 2024

Additionally, specifically in my script when I'm loading player data and spawning them and then setting their virtual world and position through a different function (rather than during OnPlayerSpawn); the code decides to reset the player's interior under the hooked OnPlayerSpawn. It must be a specific case (mine), however I don't think it hurts merely adding a check to see if someone's interior was set within the last 3 seconds and avoid resetting it to 0 under OnPlayerSpawn! (here's my code: https://pastebin.com/w37VWvcE)

I tested my own code of course and my issue vanished.

from protection.

ziggi avatar ziggi commented on September 26, 2024

Where are you using SetPlayerInterior?

from protection.

CantBeKarma avatar CantBeKarma commented on September 26, 2024

Under my login function, after authenticating properly I've got this (which spawns the player):

SetSpawnInfo(playerid, 0, PlayerInfo[playerid][p_skin], PlayerInfo[playerid][p_posx], PlayerInfo[playerid][p_posy], PlayerInfo[playerid][p_posz], PlayerInfo[playerid][p_fa], -1, -1, -1, -1, -1, -1);
TogglePlayerSpectating(playerid, false); 

Afterwards, I call a function that handles setting the player's interior/virtual world and position:

SetPlayerPos(playerid, PlayerInfo[playerid][p_posx], PlayerInfo[playerid][p_posy], PlayerInfo[playerid][p_posz]);
SetPlayerFacingAngle(playerid, PlayerInfo[playerid][p_fa]);
SetPlayerVirtualWorld(playerid, PlayerInfo[playerid][p_virtualworld]);
SetPlayerInterior(playerid, PlayerInfo[playerid][p_interior]);
SetCameraBehindPlayer(playerid);

And basically, it calls OnPlayerSpawn AFTER my function (OnPlayerSpawn execution time seems to be a couple seconds slower than the function call) and triggers a Protection Warning (and se because you hooked OnPlayerSpawn to reset gPlayerInterior{playerid} to 0. The adjusted code in the pastebin I posted fixed this issue for me. The idea is to basically avoid resetting gPlayerInterior{playerid} if it was recently altered (using SetPlayerInterior) to avoid the problem caused on my server because of this. I integrated this system into a live server of mine and basically it messed up my logging in process when players logged out inside of an interior because it'd reset their interior to 0. I never enabled this protection and it took a while to realize it's forcefully enabled when you use DisableInteriorEnterExits();; which is FINE, except this should be extremely solid with safe checks built into the code.

from protection.

ziggi avatar ziggi commented on September 26, 2024

I just want to find a more proper solution. Can you check this issue for a health? Add to these:

SetPlayerPos(playerid, PlayerInfo[playerid][p_posx], PlayerInfo[playerid][p_posy], PlayerInfo[playerid][p_posz]);
SetPlayerFacingAngle(playerid, PlayerInfo[playerid][p_fa]);
SetPlayerVirtualWorld(playerid, PlayerInfo[playerid][p_virtualworld]);
SetPlayerInterior(playerid, PlayerInfo[playerid][p_interior]);
SetCameraBehindPlayer(playerid);

this:

SetPlayerHealth(playerid, 50.0);

and remove any SetPlayerHealth from your OnPlayerSpawn

from protection.

CantBeKarma avatar CantBeKarma commented on September 26, 2024

The issue isn't a thing with Health (using SetPlayerHealth). It works perfectly fine.

from protection.

ziggi avatar ziggi commented on September 26, 2024

The issue isn't a thing with Health (using SetPlayerHealth). It works perfectly fine.

My bad.

Can you check with my solution?

from protection.

CantBeKarma avatar CantBeKarma commented on September 26, 2024

The issue isn't a thing with Health (using SetPlayerHealth). It works perfectly fine.

My bad.

Can you check with my solution?

Your solution works perfectly fine, admittedly a better fix than mine. Thanks!

from protection.

ziggi avatar ziggi commented on September 26, 2024

Thanks for reporting and helping with it.

from protection.

Related Issues (13)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.