SA-MP Forums Archive
Pawn making new specifiers and Tags - 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: Pawn making new specifiers and Tags (/showthread.php?tid=617294)



Pawn making new specifiers and Tags - GhostHacker - 19.09.2016

Hi im interested to know how i can create custom specifier in pawn i read panw implementers guide but i cant find anything valuable about it.And yeah also there is anything like typedef thing as in c++ in pawn to define new tags (i know pawn is typless but we can create new tags huh).Or we can just define it like this:
PHP Code:
new sometag:var; 
and will be a new tag?that part is also not understood from implementor's guide thats why im asking this.Thanks in advance.


Re: Pawn making new specifiers and Tags - Kaliber - 19.09.2016

You can do that...but WHY?

This just gives you a huge of troubles...and it optimize nothing...


Re: Pawn making new specifiers and Tags - GhostHacker - 19.09.2016

I would appreciate if you share your knowledge. Im willing to take any trouble. But dont ask me why im doing this. I use pawn not just for samp but also for something else which i cant tell here. And i can also make use of it here too.


Re: Pawn making new specifiers and Tags - Kaliber - 19.09.2016

Read this: https://sampwiki.blast.hk/wiki/Scripting:tags

If you have more questions, then you can ask here for more details


Re: Pawn making new specifiers and Tags - GhostHacker - 19.09.2016

Thanks but i already read it what im asking is can i create new tags and specifiers?
Creating tag can be just be done like this
PHP Code:
mytag:var; 
or is there any other function like typedef?


Re: Pawn making new specifiers and Tags - Kaliber - 19.09.2016

No, there is no function (btw typedef is an operator).
So you have to do sth like this:

PHP Code:
new test:a;
//for functions where u allow only a specific tag:
func(test:x//If you give here a variable with another tag... = warning
{
    
}
//You can also do
func(x)
{
    new 
tmp tagof (x);
    if(
tmp == tagof (test:))
    {
        
//x is from type test
    
}
    else
    {
        
//Here its not
    
}




Re: Pawn making new specifiers and Tags - GhostHacker - 19.09.2016

Quote:
Originally Posted by Kaliber
View Post
No, there is no function (btw typedef is an operator).
So you have to do sth like this:

PHP Code:
new test:a;
//for functions where u allow only a specific tag:
func(test:x//If you give here a variable with another tag... = warning
{
    
}
//You can also do
func(x)
{
    new 
tmp tagof (x);
    if(
tmp == tagof (test:))
    {
        
//x is from type test
    
}
    else
    {
        
//Here its not
    
}

Thanks my doubt about tag cleared and yeah typedef is an operator my mistake.
Ok now about specifiers?


Re: Pawn making new specifiers and Tags - Kaliber - 19.09.2016

Quote:
Originally Posted by GhostHacker
View Post
Ok now about specifiers?
What you wanna know about that?

Dont know what you mean exactly by this...


Re: Pawn making new specifiers and Tags - GhostHacker - 19.09.2016

Quote:
Originally Posted by Kaliber
View Post
What you wanna know about that?

Dont know what you mean exactly by this...
for eg in samp when SQLite introduced after some while a new specifier %q was introduced for db escape.that means a new specifier was added or created for samp. Another eg is specifier u for playerid and name in sscanf .Like that how can i create new one?