SA-MP Forums Archive
Question about Text: clickedid - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Question about Text: clickedid (/showthread.php?tid=620267)



Question about Text: clickedid - vasyok28 - 28.10.2016

Hello! In OnPlayerClickTextDraw(playerid, Text:clickedid) used Text:clickedid, i suppose you want to display: printf("%d", clickedid); and writes: warning 213: tag mismatch

sorry for my English


Re: Question about Text: clickedid - iLearner - 28.10.2016

Clickedid, think again.


Re: Question about Text: clickedid - AndySedeyn - 28.10.2016

clickedid is a textdraw. You can forcefully remove the tag by doing:
PHP код:
printf("%d"_:clickedid); 
But I doubt that will give you the correct results. Give it a shot.


Re: Question about Text: clickedid - vasyok28 - 28.10.2016

Quote:
Originally Posted by iLearner
Посмотреть сообщение
Clickedid, think again.
I know that clickedid transmits ID.

My goal is to make the design of this type:

PHP код:
    if(clickedid >= TD[GunHome][1] && clickedid <= TD[GunHome][6])
    {
        new 
IDC Clickedid TD[GunHome][1];
        if(
IDC == -1) return 1;
        
printf("%d"IDC);
    } 



Re: Question about Text: clickedid - vasyok28 - 28.10.2016

Quote:
Originally Posted by AndySedeyn
Посмотреть сообщение
clickedid is a textdraw. You can forcefully remove the tag by doing:
PHP код:
printf("%d"_:clickedid); 
But I doubt that will give you the correct results. Give it a shot.
I incorrectly stated your question, in this case, it will work without warning
PHP код:
printf("%d"_:clickedid); 
But what to do if you want to compare ?

PHP код:
    if(clickedid >= TD[GunHome][1] && clickedid <= TD[GunHome][6]) 
    { 
        new 
IDC = [B]clickedid[/B] - TD[GunHome][1]; 
        if(
IDC == -1) return 1
        
printf("%d"IDC); 
    } 
If you delete a tag, it will be warning 213: tag mismatch
PHP код:
new IDC = [B]_:clickedid[/B] - TD[GunHome][1]; 
Sorry for my last question wrong


Re: Question about Text: clickedid - AndySedeyn - 28.10.2016

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.


Re: Question about Text: clickedid - vasyok28 - 28.10.2016

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);
    } 



Re: Question about Text: clickedid - NaS - 28.10.2016

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.


Re: Question about Text: clickedid - AndySedeyn - 28.10.2016

Quote:
Originally Posted by NaS
Посмотреть сообщение
-
Thanks!