|
The code is completely fine (although it is dumb, I hope it was just an example). Try with different object IDs and different coordinates, I just checked all of the IDs on this site, 7156 isn't even a valid ID and 2000 is a small object that could easily be somewhere inside 4526, which is massive.
|
Yes all created. That was my mistake, because i find them by creating a map icon and i using one id for three objects, so i thought what they dont was created. But now is another bad thing. I also create a 3DText Label nut i dont appears at object possition. Taht how i create Text: example. I destroy objects and 3D Texts because my callback is called by timer.
|
The code is fine, every object is created. The thing is you have made every single object in the same coordinates. You will not be able to see the difference, because they are duplicated.
Your code is all good. |
DestroyObject(Barrel);
Barrel = CreateObject(1225, nx, ny, nz, 0.0 ,0.0, 0.0);
Delete3DTextLabel(Barrel_text);
Barrel_text = Create3DTextLabel("Barrel. Use command /take", 0xFFBE00FF, nx, ny, nz, 10.0, 0, 1);
static Float:g_ObjectPositions[][3] = {
{ 2454.0, 965.0, 6.2 },
{ 2454.0, 965.0, 6.2 },
{ 2454.0, 965.0, 6.2 }
};
public MyForwardedCallback()
{
new r = random(sizeof(g_ObjectPositions));
CreateObject(2000, g_ObjectPositions[r][0], g_ObjectPositions[r][1], g_ObjectPositions[r][2], 0.0, 0.0, 0.0);
r = random(sizeof(g_ObjectPositions));
CreateObject(7156, g_ObjectPositions[r][0], g_ObjectPositions[r][1], g_ObjectPositions[r][2], 0.0, 0.0, 0.0);
r = random(sizeof(g_ObjectPositions));
CreateObject(4526, g_ObjectPositions[r][0], g_ObjectPositions[r][1], g_ObjectPositions[r][2], 0.0, 0.0, 0.0);
return 1;
}
|
You don't need switches for this at all in fact you used them very poorly and have shit loads of extra code for a task that is very simple. From 72 lines to 16.
Код:
static Float:g_ObjectPositions[][3] = {
{ 2454.0, 965.0, 6.2 },
{ 2454.0, 965.0, 6.2 },
{ 2454.0, 965.0, 6.2 }
};
public MyForwardedCallback()
{
new r = random(sizeof(g_ObjectPositions));
CreateObject(2000, g_ObjectPositions[r][0], g_ObjectPositions[r][1], g_ObjectPositions[r][2], 0.0, 0.0, 0.0);
r = random(sizeof(g_ObjectPositions));
CreateObject(7156, g_ObjectPositions[r][0], g_ObjectPositions[r][1], g_ObjectPositions[r][2], 0.0, 0.0, 0.0);
r = random(sizeof(g_ObjectPositions));
CreateObject(4526, g_ObjectPositions[r][0], g_ObjectPositions[r][1], g_ObjectPositions[r][2], 0.0, 0.0, 0.0);
return 1;
}
|
Create3DTextLabel(playerid, "Barrel. Use command /take", 0xFFBE00FF, nx, ny, nz, 10.0, 0, 1);
|
That is because you didn't follow the parameters correctly. You forgot to insert the playerid parameter. Please refer to the SA-MP Wiki for more information.
Код:
Create3DTextLabel(playerid, "Barrel. Use command /take", 0xFFBE00FF, nx, ny, nz, 10.0, 0, 1); |
|
Are you serious?
There is a difference between Create3DTextLabel and CreatePlayer3DTextLabel... |
|
That is because you didn't follow the parameters correctly. You forgot to insert the playerid parameter. Please refer to the SA-MP Wiki for more information.
Код:
Create3DTextLabel(playerid, "Barrel. Use command /take", 0xFFBE00FF, nx, ny, nz, 10.0, 0, 1); |
because it's an item that can be taken by any player. So objects create in random possition and all fine with them, only the text to the object is missing. Also @The Torreto difference actually is, but only one - playerid.
|
Stll need help. I giving part of my code. Link to pastebin here
|
|
I assume the object creation part is fixed, which means that the function is getting called properly. If you didn't know, you have to wait around 120000ms (2 minutes) until your custom function will get executed for the first time from server launch.
Vague guess but have you tried increasing your draw distance to a high value just to make sure that the 3D text label is actually there? |
And how to do what for first launch it dont be executed?|
Yes it's two minutes, because i testing it so i cant wait 45 minutes
And how to do what for first launch it dont be executed?Exaclty, problem is what there is no 3DText. 3Dtext draw distance is 10.0, Using command /take it wants 3.0 distance from object and it works, so if 3dtext were in there i could see it because i'm close. |