Switch
#1

Hello, did possible to switch three time cases in one callback?

Example
Reply
#2

yes4char
Reply
#3

so why do I have only one of the three objects when i create it like this?
Reply
#4

You actually should have them always all.

Because every pos gets initialisized with the same Float.

And all should be created.
Reply
#5

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.
Reply
#6

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.
Reply
#7

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.
Reply
#8

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);
Reply
#9

It should be a virtual world problem, what is your ingame VW?
Reply
#10

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.
Reply
#11

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;
}
Reply
#12

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
Reply
#13

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);
Reply
#14

Quote:
Originally Posted by ComDuck
Посмотреть сообщение
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...
Reply
#15

Quote:
Originally Posted by TheToretto
Посмотреть сообщение
Are you serious?

There is a difference between Create3DTextLabel and CreatePlayer3DTextLabel...
Whoops, my bad. Disregard that post..
Reply
#16

Quote:
Originally Posted by ComDuck
Посмотреть сообщение
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);
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.
Reply
#17

Stll need help. I giving part of my code. Link to pastebin here
Reply
#18

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?
Reply
#19

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.
Reply
#20

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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)