SA-MP Forums Archive
Custom formats in SA-MP? - 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)
+---- Forum: Discussion (https://sampforum.blast.hk/forumdisplay.php?fid=84)
+---- Thread: Custom formats in SA-MP? (/showthread.php?tid=638411)



Custom formats in SA-MP? - 10MIN - 31.07.2017

I want to know if i can do this in SA-MP (via an include or something)
PHP Code:
int customformat(const char format, ...) //Ignore int and const char * (they are from C++)
{
    
char buffer[256]; //Here I declare a string (is like those we have in SA-MP made with new)
    
va_list arg
    
va_start (arg,format);
    
vsprintf(buffer,format,arg); //This function is like format
    
va_end(arg);
    
cout << buffer << endl//This is something like: print(buffer) in SA-MP
    
return 1;

And sory for my bad english. I am just wondering if this can be done in SA-MP


Re: Custom formats in SA-MP? - Xeon™ - 31.07.2017

this is C++ it cannot be intergred to pawn
but i found something useful you can make it your base to create your own specifiers

https://sampforum.blast.hk/showthread.php?tid=313488


Re: Custom formats in SA-MP? - 10MIN - 31.07.2017

I don't want custom specifiers, I want to make a custom format function. So I can use something like this:
PHP Code:
SendFormated(playerid,format,args// where format have the specifiers and args is the arguments like a string or integer. 



Re: Custom formats in SA-MP? - Xeon™ - 31.07.2017

http://forum.sa-mp.com/showthread.ph...at#post1189738

but you need y_va http://pastebin.com/R3ZeiK7L in this case


Re: Custom formats in SA-MP? - jlalt - 31.07.2017

You can check passed args by
https://sampwiki.blast.hk/wiki/Numargs
and
https://sampwiki.blast.hk/wiki/Getarg

however you can use emit too
https://sampforum.blast.hk/showthread.php?tid=570930
http://forum.sa-mp.com/showpost.php?...68&postcount=2

or also
http://forum.sa-mp.com/showpost.php?...90&postcount=5

also this looks to be what you're searching for
http://forum.sa-mp.com/showpost.php?...09&postcount=8


Re: Custom formats in SA-MP? - 10MIN - 31.07.2017

Thanks! This is very usefull for me and I think for any other person.