How i can do something like this... -
Dodus - 25.09.2011
pawn Код:
stock MoneyActionLog(const logString[256], {Float,_}:...)
I wanna make this function is working like:
pawn Код:
native format(output[], len, const format[], {Float,_}:...);
How i can do that? I want that is my code when i send to console looks like:
pawn Код:
MoneyActionLog("Player %s has $%d", PlayerName(playerid), money);
I don't wanna use the MACRO's for this!
Sorry for my bad english...
Re : How i can do something like this... -
timaoux - 25.09.2011
for the money
pawn Код:
new Float:money;
GetPlayerMoney(theplayertoknowthemoney, money);
MoneyActionLog("Player %s has $%d", PlayerName(playerid), money);
Re: How i can do something like this... -
Dodus - 25.09.2011
@timaoux
The problem is my string is not formatted when i use this, console shows me:
And i wanna repair this, but how?
Re: How i can do something like this... -
Jafet_Macario - 25.09.2011
pawn Код:
new money = GetPlayerMoney(playerid), PlayerName[MAX_PLAYER_NAME];
GetPlayerName(playerid, PlayerName, sizeof(PlayerName));
MoneyActionLog("Player %s has $%d", PlayerName, money);
Re: How i can do something like this... -
Dodus - 25.09.2011
Omg, i know how using the format. I wanna make the same working function like format(...), but i have this function and that is no working...
Re: How i can do something like this... -
iJumbo - 25.09.2011
search for SendClientMessageEx learn the code from glibrary
Re: How i can do something like this... -
dice7 - 25.09.2011
You can do it with defines
pawn Код:
#define MoneyActionLog(%0,%1,%2); \
new text[128]; \
format(text,sizeof(text),%0,%1,%2); \
new File:example = fopen("log.txt", io_write); \
fwrite(example, text); \
fclose(example);
Or you could do it with getarg() and numargs()
Here's a tutorial for that
https://sampforum.blast.hk/showthread.php?tid=77000
Re: How i can do something like this... -
Dodus - 25.09.2011
Ouch, thanks ******, thats is very good. Reput for you and dice7, thx all.
Re: How i can do something like this... -
Dodus - 25.09.2011
Ok, so i use that like this:
pawn Код:
stock MoneyActionLog(logString[256], va_args<>)
{
new entry[256], hour, minute, second;
gettime(hour, minute, second);
va_format(entry, sizeof(entry), logString, va_start<1>);
format(entry, sizeof(entry), "[%02d:%02d:%02d] %s\n", hour, minute, second, entry);
new File:hFile = fopen("Logs/money_log.txt", io_append);
fwrite(File:hFile, entry);
fclose(File:hFile);
}
And my gamemode is not compiling and has a 0 kb. Whats wrong?
Re: How i can do something like this... -
Dodus - 25.09.2011
Hm, i don't have that include, lol. Where i can find that?