SA-MP Forums Archive
help me stock - 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: help me stock (/showthread.php?tid=653149)



help me stock - RichKiez - 27.04.2018

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.


Re: help me stock - jasperschellekens - 27.04.2018

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


Re: help me stock - Dutheil - 27.04.2018

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


Re: help me stock - RichKiez - 27.04.2018

Thanks All


Re: help me stock - CrystalGamer - 27.04.2018

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


Re: help me stock - jasperschellekens - 27.04.2018

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