help me stock
#1

how to create a variable, when format () then it sends SendClientMessage without having to set
Example:
I put a function called ''textfm''
textfm(string, sizeof(string), "Player ID [%d]", playerid);
it will show: Player ID 1.
without having to use SendClientMessage.
Reply
#2

Im not sure but you want to do but i guess something like this?

PHP код:
textfm(playerid)
{
    new 
textfmstr[128];
    
textfmstr(stringsizeof(textfmstr), "Player ID [%d]"playerid);
    
SendClientMessage(playerid, -1textfmstr);
    return 
1;

You can then use this in your script:
Код:
textfm(playerid)
Btw only make it a stock if you plan on using it outside the script your putting it in.
https://sampforum.blast.hk/showthread.php?tid=570635
Reply
#3

You can use y_va from YSI :
PHP код:
#define Scm_Params (3)
// native Scm(playerid, color, const fmat[], ...);
stock Scm(playeridcolor, const fmat[], va_args<>) { 
    if(
numargs() == Scm_Params
        return 
SendClientMessage(playeridcolorfmat);
    static 
        
str[145];
    
va_format(strsizeof(str), fmatva_start<Scm_Params>);    
    return 
SendClientMessage(playeridcolorstr); 

Or http://forum.sa-mp.com/showpost.php?...postcount=4225
Reply
#4

Thanks All
Reply
#5

Quote:
Originally Posted by jasperschellekens
Посмотреть сообщение
Im not sure but you want to do but i guess something like this?

PHP код:
textfm(playerid)
{
    new 
textfmstr[128];
    
textfmstr(stringsizeof(textfmstr), "Player ID [%d]"playerid);
    
SendClientMessage(playerid, -1textfmstr);
    return 
1;

You can then use this in your script:
Код:
textfm(playerid)
Btw only make it a stock if you plan on using it outside the script your putting it in.
https://sampforum.blast.hk/showthread.php?tid=570635
please that should be
Код:
textfm(playerid) 
{ 
    new textfmstr[128]; 
    format(string, sizeof(textfmstr), "Player ID [%d]", playerid); 
    SendClientMessage(playerid, -1, textfmstr); 
    return 1; 
}
format not textfmstr

hmm
Reply
#6

Quote:
Originally Posted by CrystalGamer
Посмотреть сообщение
please that should be
Код:
textfm(playerid) 
{ 
    new textfmstr[128]; 
    format(string, sizeof(textfmstr), "Player ID [%d]", playerid); 
    SendClientMessage(playerid, -1, textfmstr); 
    return 1; 
}
format not textfmstr

hmm
my bad, mistyped something. Should be:
PHP код:
format(textfmstrsizeof(textfmstr), "Player ID [%d]"playerid); 
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)