will this affect my script in any way?
#1

i got over 1000 lines of removebuildingforplayer that lag in onplayerconnect, i've send them to different callbacks, ongamemodeinit, onplayerconnect, onplayerspawn, onplayerrequestclass and onplayerrequestspawn... will this somehow affect the script is there any other way i could solve this?
Reply
#2

I don't think it will.
Reply
#3

I have found that if you remove many objects at once from a player who already has the same objects removed, it can cause problems with players lagging / crashing. You are doing this if you're calling all of your removals in all of these places.

We remove additional objects from players when the server is online (so not just on server start). Originally I used to just have a filterscript with the removals in and reload it, but this was not working out because of what I described above (objects being re-removed for a player).

I have implemented a very simple queue system for removals, which means each object is only ever removed for a player once when he is online. This seems to have solved all of the issues players were experiencing.
Reply
#4

You made a variable to know when he was first connected, and you checked with that variable?


EDIT: If so, i tried something similar i made a variable wich checks when the player is first spawned, if the variable is 0 in onplayerrequestclass/onplayerrequestspawn/ongamemodeinit it continues with the removal of objects...
Reply
#5

My script is a little bit more complicated as it allows for live removals too (not just on server start) but yes you are on the right track. A basic implementation would be to use a variable to store when a player has had the objects removed and use this information to prevent repeat removals.

You don't (and can't unless you have done something very wrong) put removals in OnGameModeInit and you could often find OnPlayerConnect, OnPlayerSpawn, OnPlayerRequestClass and OnPlayerRequestClass being called one after the over very quickly. If you are doing that, you're removing the same set of objects 4 times for 1 player and I'd imagine it can cause some slow down (I don't know if this is fact but it's just something I have experienced on my own server and have had to implement a feature to prevent the problem).

Some very basic pseudo-code

Код:
stock RemovalFunction(playerid)
{

if( variable is not 1 )
{

// All removals here...

}

// Set variable to 1 here

}
Reply
#6

i dont get it man, i need a solution to this :/..
Reply


Forum Jump:


Users browsing this thread: