Switch -
Heress - 09.02.2019
Hello, did possible to switch three time cases in one callback?
Example
Re: Switch -
kristo - 09.02.2019
yes
4char
Re: Switch -
Heress - 09.02.2019
so why do I have only one of the three objects when i create it like this?
Re: Switch -
Kaliber - 09.02.2019
You actually should have them always all.
Because every pos gets initialisized with the same Float.
And all should be created.
Re: Switch -
kristo - 09.02.2019
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.
Re: Switch -
Heress - 09.02.2019
Quote:
Originally Posted by kvann
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 it example but almost look like my code. Yeah.... dumb, but i newbie on pawn language. Objects ids (2000, 4526 and 7156) was example, i dont using them

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.
Re: Switch -
TheToretto - 09.02.2019
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.
Re: Switch -
Heress - 09.02.2019
Quote:
Originally Posted by TheToretto
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.
|
Yes with objects all fine, but 3dtext dont appears. 3Dtext i create:
Код:
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);
Re: Switch -
TheToretto - 09.02.2019
It should be a virtual world problem, what is your ingame VW?
Re: Switch -
Heress - 09.02.2019
No i changing it just when i go into interior and theese three objects ar in land, mountains, parks, so vitrual world is not changing. That's why 3d text parameter vw is null.
Re: Switch -
Pottus - 09.02.2019
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;
}
Re: Switch -
Heress - 09.02.2019
Quote:
Originally Posted by Pottus
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;
}
|
Thanks! but problem with 3d texts still exists
Re: Switch -
ComDuck - 10.02.2019
Quote:
Originally Posted by Heress
Thanks! but problem with 3d texts still exists
|
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);
Re: Switch -
TheToretto - 10.02.2019
Quote:
Originally Posted by ComDuck
|
Are you serious?
There is a difference between Create3DTextLabel and CreatePlayer3DTextLabel...
Re: Switch -
ComDuck - 10.02.2019
Quote:
Originally Posted by TheToretto
Are you serious?
There is a difference between Create3DTextLabel and CreatePlayer3DTextLabel...
|
Whoops, my bad. Disregard that post..
Re: Switch -
Heress - 10.02.2019
Quote:
Originally Posted by ComDuck
|
I need to create it to all players

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.
Re: Switch -
Heress - 10.02.2019
Stll need help. I giving part of my code. Link to pastebin
here
Re: Switch -
ComDuck - 10.02.2019
Quote:
Originally Posted by Heress
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?
Re: Switch -
Heress - 10.02.2019
Quote:
Originally Posted by ComDuck
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?
|
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.
Re: Switch -
ComDuck - 10.02.2019
Quote:
Originally Posted by Heress
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.
|
In your Create3DTextLabel line, replace the variables you've set in the parameters to actual coordinate values. If you want to, set it to some place else and see if it creates the label.