SA-MP Forums Archive
What solution should fit better and cause no bugs or unwanted outcome? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: What solution should fit better and cause no bugs or unwanted outcome? (/showthread.php?tid=635635)



What solution should fit better and cause no bugs or unwanted outcome? - bencesz - 11.06.2017

I'm making a lot&house system in my gamemode. This would include both removing and creating objects.
The question is: how shall I execute them?
My thoughts are removing objects under OnPlayerConnect, and creating objects (houses) with commands.
After a server restart would RemoveBuildingForPlayer actually remove a created house too if it's modelid is the same as the previously deleted one? And would the server crash because of it?

I haven't really started the code so I cannot show it to you. I'm asking because I don't want to struggle with making it and then fail, so my question would appear here anyway.
Would a HouseCreated[houseid] variable solve this problem if it exists? And should I and can I even make a stock function to remove objects?


Re: What solution should fit better and cause no bugs or unwanted outcome? - bencesz - 11.06.2017

EDIT: Figured it out, it should be working without bugs or "not showing" if the created object's ID is different from the deleted ones. As object-loading would be happening under OnGameModeInit, use of a different modelid wouldn't cross over with the RemoveBuildingForPlayer function under OnPlayerConnect