Any alternative to this? - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Any alternative to this? (
/showthread.php?tid=175208)
Any alternative to this? -
_Vortex - 08.09.2010
So in the past I've been putting this piece of code under everything that required me to access player's dini file (commands, callbacks, etc.). I would much rather code some feature into the general server so I can just use "PlayerFile" without having this in the area i'm using it:
Код:
new string[256], pName[24], PlayerFile[50];
GetPlayerName(playerid, pName, sizeof(pName));
format(PlayerFile, sizeof(PlayerFile), "AdminScript/Users/%s.ini", pName);
This is under just about everything that requires access to players files and I'm now realizing how much of a pain it is. Since I'm a bit rusty with pawno I'm not sure how I should do it.
Re: Any alternative to this? -
_Vortex - 08.09.2010
Something like
Код:
stock PlayerFile()
{
new string[256], pName[24], PlayerFile[50];
GetPlayerName(playerid, pName, sizeof(pName));
format(PlayerFile, sizeof(PlayerFile), "AdminScript/Users/%s.ini", pName);
return PlayerFile;
}
?
Like I said I'm a bit rusty in pawno since I haven't coded in a wile so i'm not really sure how I should do it.
Re: Any alternative to this? -
woot - 08.09.2010
pawn Код:
stock PlayerFile(iPlayer)
{
new
pName[ MAX_PLAYER_NAME ],
iFile[ 48 ];
GetPlayerName(iPlayer, pName, MAX_PLAYER_NAME);
format(iFile, 48, "AdminScript/Users/%s.ini", pName);
return iFile;
}
// ex
dini_Set(PlayerFile(playerid), "money", 1337);