Automatically repair Glass Objects... -
jawadhyder15 - 21.03.2013
Hi all,
I have designed a race course where users have to go by breaking a wall made of glass object (ID:3851)..
The problem is the objects, once braked, do not repair... I want them to repair after specific time period...
Any help will be appreciated...
Re: Automatically repair Glass Objects... -
Scenario - 21.03.2013
If you can figure out the object ID of the glass objects, you can destroy them and create them on a timer.
Re: Automatically repair Glass Objects... -
TheDeadlyDutchi - 21.03.2013
The glass is created at streaming in, you could use it to your advantage to repair the glass. You could also do what RealCop said.
Re: Automatically repair Glass Objects... -
jawadhyder15 - 22.03.2013
Ya, that's a good Idea RealCop228!... Thank you
![Smiley](images/smilies/smile.png)
@TheDeadlyDutchi, I do not understand what you mean by (created at streaming in)... Can you elaborate?
Re: Automatically repair Glass Objects... -
Dzines4SAMP - 22.03.2013
Quote:
Originally Posted by jawadhyder15
Ya, that's a good Idea RealCop228!... Thank you ![Smiley](images/smilies/smile.png)
@TheDeadlyDutchi, I do not understand what you mean by (created at streaming in)... Can you elaborate?
|
He meant that, example there is a glass in front of you. You go break it, and then go really way back. But then, when you come back to the same place, the mirror will be still there. I think this is what he meant
Re: Automatically repair Glass Objects... -
jawadhyder15 - 22.03.2013
Anyway, the problem is solved...
I came up with this code:
PHP код:
new GlassObjsIds[20]; // I have 18 glass objects
// Objects are created like this
GlassObjsIds[0] = CreateObject(3851, -3023.311035, 1747.706665, 18.013530, 0.000000, 0.000000, -7.599997, 300);
GlassObjsIds[1] = .....
GlassObjsIds[2] = .....
.......
......
......
Then on OnFilterScriptInit, I've created a timer that runs RepairGlassObjs after every 10 seconds
PHP код:
SetTimer("RepairGlassObjs",10000,true);
And the RepairGlassObjs function is this,
PHP код:
public RepairGlassObjs(){
new Float:X,Float:Y,Float:Z,Float:RX,Float:RY,Float:RZ;
for (new i=0; i < sizeof(GlassObjsIds); i++){
GetObjectPos(GlassObjsIds[i],X,Y,Z);
GetObjectRot(GlassObjsIds[i],RX,RY,RZ);
DestroyObject(GlassObjsIds[i]);
GlassObjsIds[i] = CreateObject(3851, X, Y, Z, RX, RY, RZ, 300);
}
}
If anyone have the same problem, he can use this code...
Re: Automatically repair Glass Objects... -
Scenario - 22.03.2013
You would be better off using foreach for that, but either way, good that you fixed it!