![]() |
#1 |
Big Clucker
![]() ![]() Join Date: Jul 2015
Posts: 161
Reputation: 2
|
![]() Code:
CMD:obj(playerid) { new Float:x, Float:y, Float:z; GetPlayerPos(playerid, x,y,z); if(!IsValidDynamicObject(Object[playerid])) { Object[playerid]=CreateObject(866, x, y, z, 0, 0,0, 50); SetTimerEx("Destroy", 2000, false, "i", playerid); } return 1; } forward Destroy(playerid); public Destroy(playerid) { DestroyObject(Object[playerid]); } |
![]() |
![]() |
![]() |
#2 |
Little Clucker
![]() Join Date: Oct 2012
Posts: 29
Reputation: 10
|
![]()
You are checking if the object is valid/invalid using a fuction from Incognito's streamer plugin but you are creating and destroying the objects using the default sa:mp natives.
To fix this problem you must either check if the object is valid/invalid using the sa:mp native function or use Incognito's streamer plugin to create and destroy the object. |
![]() |
![]() |
![]() |
#3 |
High-roller
![]() ![]() ![]() ![]() ![]() Join Date: Jul 2010
Location: Latvia,Riga
Posts: 1,364
Reputation: 180
|
![]()
at top of the script add
new Object[MAX_PLAYERS] = {-1,...}; Then when you destroy an object, set object handle to -1 and dont use IsValid... object, but just check if Object[playerid] is -1, and if it is, object is destroyed. otherwise destroy and set it to -1, this is how you MUST do to keep it in order, cuz IsValidDynamicObject doesnt actually check if its right object, it just check if object with such a handle is created at all. |
![]() |
![]() |
![]() |
#4 |
High-roller
![]() ![]() ![]() ![]() ![]() Join Date: Oct 2014
Posts: 1,359
Reputation: 333
|
![]()
change this
PHP Code:
PHP Code:
|
![]() |
![]() |
![]() |
#5 |
Banned
![]() Join Date: Apr 2015
Location: Poland
Posts: 1,260
Reputation: 326
|
![]()
you need glasses :P
Code:
CMD:obj(playerid) { new Float:x, Float:y, Float:z; GetPlayerPos(playerid, x,y,z); if(!IsValidDynamicObject(Object[playerid])) { Object[playerid]=CreateObject(866, x, y, z, 0, 0,0, 50); SetTimerEx("Destroy", 2000, false, "i", playerid); } return 1; } forward Destroy(playerid); public Destroy(playerid) { DestroyObject(Object[playerid]); } |
![]() |
![]() |
![]() |
Thread Tools | |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Valid Dynamic Object | TwinkiDaBoss | Scripting Help | 5 | 12/12/2015 04:10 PM |
Object not being destroyed and weapon are not been given | Gaurav_Rawat | Scripting Help | 1 | 04/04/2014 10:50 AM |
If player near an object the object will be destroyed | ToiletDuck | Scripting Help | 10 | 30/07/2013 03:59 PM |
detect if destroyed object? | jamesbond007 | Scripting Help | 7 | 05/12/2011 07:36 AM |
[?] valid object list? | BombaNick | Help Archive | 1 | 03/09/2010 01:06 PM |