Custom formats in SA-MP?
#1

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
Reply
#2

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
Reply
#3

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. 
Reply
#4

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

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

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
Reply
#6

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


Forum Jump:


Users browsing this thread: 1 Guest(s)