Quote:
Originally Posted by AndySedeyn
Because IDC must be defined as a textdraw too:
PHP код:
new Text:IDC = clickedid - TD[GunHome][1];
I haven't come across a situation where that was needed, so I'm not 100% sure this will work properly. It seems odd to subtract two textdraws from each other.
|
You don't substract textdraws. You substract regular numbers (IDs in this case). He's getting the index of the first TextDraw for GunHome.
The only Tag you have to be careful with is Float, all other Tags in SAMP (Text3D, Menu etc) are just regular IDs like objects and vehicles. Some items have Tags to seperate them for us, but after compiling there is no difference to "normal" IDs. They don't even exist during run-time.
Quote:
Originally Posted by vasyok28
Thank you very much, I decided to issue.
PHP код:
if(clickedid >= TD[GunHome][1] && clickedid <= TD[GunHome][6])
{
new Text:IDC = clickedid - TD[GunHome][1];
if(_:IDC == -1) return 1;
printf("%d", _:IDC);
}
|
If you want to further calculate stuff with the IDC variable, you can do the following too:
PHP код:
if(clickedid >= TD[GunHome][1] && clickedid <= TD[GunHome][6])
{
new IDC = _:(clickedid - TD[GunHome][1]);
if(IDC == -1) return 1;
printf("%d", IDC);
}
So you only need to convert the tags once, after that IDC can be used without any more Tag conversion.
In this example it doesn't matter, but if you are going to use IDC a few times more it's annoying to always put "_:" too.