Creating a stock to return file path of a users account, better ways? [REP++] - 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: Creating a stock to return file path of a users account, better ways? [REP++] (
/showthread.php?tid=436888)
Creating a stock to return file path of a users account, better ways? [REP++] -
Hoborific - 13.05.2013
Alright so far this is what I have.
pawn Код:
stock GetAccountPath(playerid)
{
new Player[25];
new AccountName[50];
GetPlayerName(playerid, Player, sizeof(Player) );
format(AccountName,sizeof(AccountName),"\\Accounts\\%s.ini", Player);
return AccountName;
}
and I have to call it like so.
pawn Код:
new File[50];
format(File,sizeof(File),"%s",GetAccountPath(playerid) );
now I haven't been around for a while but I am pretty sure there's a much simpler way I've missed, like being able to return the value without having to format it into another string.
Re: Creating a stock to return file path of a users account, better ways? [REP++] -
[HiC]TheKiller - 13.05.2013
Why do you even need the file variable / format? Just use GetAccountPath(playerid) directly.
Re: Creating a stock to return file path of a users account, better ways? [REP++] -
Hoborific - 13.05.2013
Because with like, 15 variables, I'd rather see (File,"Money") instead of GetAccountPath(playerid) each time.