Burgershot
  • Home
  • Members
  • Team
  • Help
  • Search
  • Register
  • Login
  • Home
  • Members
  • Help
  • Search
Burgershot SA-MP Pawn Scripting [Pawn] Object disappear problem

 
  • 0 Vote(s) - 0 Average
Pawn Object disappear problem
ChampDotChamp
Offline

Burgershot Member
Posts: 3
Threads: 1
Joined: Apr 2020
Reputation: 0
#1
2020-04-04, 08:17 PM (This post was last modified: 2020-04-04, 08:18 PM by ChampDotChamp.)
I have a weird problem. Objects created by functions or commands, not in global OnGameModeInit(), disappear after some period of time. 
I've tried to use default CreateObject, but it hasn't worked.
Ezio_Auditore
Offline

Burgershot Member
Posts: 23
Threads: 1
Joined: Apr 2019
Reputation: 1
#2
2020-04-04, 09:26 PM (This post was last modified: 2020-04-04, 11:50 PM by Ezio_Auditore.)
Seems like you're messing up with some IDs. Maybe somewhere in your script you're using functions for deleting specific objects for any reason, isnt it? Do you currently check and reset the variables linked to those objects everytime you delete them?

I mean, do you do something like this?
Code:
if(object_id != -1) DestroyDynamicObject(object_id), object_id = -1;


If not and if youre using functions such as DestroyDynamicObject or DestroyObject, its most likely that your problem is due to this bad handling. Everytime youre deleting something, you must first check the variable and then reset it after you have successfully deleted the item.
ChampDotChamp
Offline

Burgershot Member
Posts: 3
Threads: 1
Joined: Apr 2020
Reputation: 0
#3
2020-04-04, 09:37 PM
(2020-04-04, 09:26 PM)Ezio_Auditore Wrote: Seems like you're messing up with some IDs. Maybe somewhere in your script you're using functions for deleting specific objects for any reason, isnt it? Do you currently check and reset the variables linked to those objects everytime you delete them?

I mean, do you do something like this?
Code:
if(object_id != -1) DestroyDynamicObject(object_id), object_id = -1;


If not and if youre using functions such as DestroyDynamicObject or CreateObject, its most likely that your problem is due to this bad handling. Everytime youre deleting something, you must first check the variable and then reset it after you have successfully deleted the item.

I will try that and let you know if that helped.
ChampDotChamp
Offline

Burgershot Member
Posts: 3
Threads: 1
Joined: Apr 2020
Reputation: 0
#4
2020-04-07, 11:38 AM
(2020-04-04, 09:26 PM)Ezio_Auditore Wrote: Seems like you're messing up with some IDs. Maybe somewhere in your script you're using functions for deleting specific objects for any reason, isnt it? Do you currently check and reset the variables linked to those objects everytime you delete them?

I mean, do you do something like this?
Code:
if(object_id != -1) DestroyDynamicObject(object_id), object_id = -1;


If not and if youre using functions such as DestroyDynamicObject or DestroyObject, its most likely that your problem is due to this bad handling. Everytime youre deleting something, you must first check the variable and then reset it after you have successfully deleted the item.

Thank you so much. Now everything works !!
Ezio_Auditore
Offline

Burgershot Member
Posts: 23
Threads: 1
Joined: Apr 2019
Reputation: 1
#5
2020-04-07, 02:33 PM
(2020-04-07, 11:38 AM)ChampDotChamp Wrote:
(2020-04-04, 09:26 PM)Ezio_Auditore Wrote: Seems like you're messing up with some IDs. Maybe somewhere in your script you're using functions for deleting specific objects for any reason, isnt it? Do you currently check and reset the variables linked to those objects everytime you delete them?

I mean, do you do something like this?
Code:
if(object_id != -1) DestroyDynamicObject(object_id), object_id = -1;


If not and if youre using functions such as DestroyDynamicObject or DestroyObject, its most likely that your problem is due to this bad handling. Everytime youre deleting something, you must first check the variable and then reset it after you have successfully deleted the item.

Thank you so much. Now everything works !!

:)
Markski
Offline

Burgershot Clerk

Posts: 127
Threads: 6
Joined: Apr 2019
Reputation: 5
Location: La Plata, Argentina
#6
2020-04-19, 04:06 AM
I would suggest for the sake of standard compliance that you use INVALID_OBJECT_ID instead of -1 for this. As far as functionality goes the solution works either way, of course.
Website
« Next Oldest | Next Newest »



  • View a Printable Version
  • Subscribe to this thread
Forum Jump:

© Burgershot - Powered by our Community and MyBB Original Theme by Emerald

Linear Mode
Threaded Mode