New Function error -
Battlezone - 26.01.2014
I tried to make a new function that allows you to create a pickup with attached 3d text.
PHP код:
stock CreatePickupWith3DText(model, type, Float:X, Float:Y, Float:Z, Virtualworld, text[], color)
{
CreatePickup(model, type, Float:X, Float:Y, Float:Z, Virtualworld);
Create3DTextLabel(text[], color, Float:X, Float:Y, Float:Z+0.75, 0, Virtualworld, 1);
return 1;
}
But i get this error : C:\Users\TOSHIBA\Desktop\Project Work\gamemodes\TWC2.pwn(890) : error 029: invalid expression, assumed zero ( the Create3DTextLabel line)
any help?
Re: New Function error -
Scottas - 26.01.2014
pawn Код:
Create3DTextLabel(text[], color, Float:X, Float:Y, Float:Z+0.75, 0, Virtualworld, 1);
Should be
pawn Код:
Create3DTextLabel(text, color, Float:X, Float:Y, Float:Z+0.75, 0, Virtualworld, 1);
Re : New Function error -
Battlezone - 27.01.2014
Thanks ! Rep+
But why there shouldnt be [] ?
EDIT : The text doesnt show!
savedisk = CreatePickupWith3DText(1277, 2, 2510.1780,133.8019,26.8837, -1, "Game Save", 0xB40100FF);
This didnt show the text :/ help?
Re: New Function error -
Misiur - 27.01.2014
text[] is indicator that function accepts arrays (and in turn, strings) - it is placed in function definition. When you are calling that function, you have to pass specific variable, not indicator - and therefore "text" without square brackets is enough.
Re : Re: New Function error -
Battlezone - 27.01.2014
Quote:
Originally Posted by Misiur
text[] is indicator that function accepts arrays (and in turn, strings) - it is placed in function definition. When you are calling that function, you have to pass specific variable, not indicator - and therefore "text" without square brackets is enough.
|
Ah i understand now, thanks, but can you take a look at it again? it doesnt work
Re: New Function error -
Misiur - 27.01.2014
Oh, sorry, I only saw your second question. You have to remove all Float:Variable before stuff in function calls, so instead:
pawn Код:
CreatePickup(model, type, Float:X, Float:Y, Float:Z, Virtualworld);
Create3DTextLabel(text, color, Float:X, Float:Y, Float:Z+0.75, 0, Virtualworld, 1);
it has to be
pawn Код:
CreatePickup(model, type, X, Y, Z, Virtualworld);
Create3DTextLabel(text, color, X, Y, Z+0.75, 0, Virtualworld, 1);
Reason is identical as with text - Float is indicator of variable type while declaring it, or accepting as an argument.
Re : Re: New Function error -
Battlezone - 27.01.2014
Quote:
Originally Posted by Misiur
Oh, sorry, I only saw your second question. You have to remove all Float:Variable before stuff in function calls, so instead:
pawn Код:
CreatePickup(model, type, Float:X, Float:Y, Float:Z, Virtualworld); Create3DTextLabel(text, color, Float:X, Float:Y, Float:Z+0.75, 0, Virtualworld, 1);
it has to be
pawn Код:
CreatePickup(model, type, X, Y, Z, Virtualworld); Create3DTextLabel(text, color, X, Y, Z+0.75, 0, Virtualworld, 1);
Reason is identical as with text - Float is indicator of variable type while declaring it, or accepting as an argument.
|
Thanks now i can understand everything!