Need some help with opening a *specific* user file -
LeetModz - 27.04.2012
To be more specific, how to I open a file for a specific player without knowing there account name ? example: "/Users/playersname.txt" if I dont know the users name 'playersname' how could the file be opened?
heres what I want to be able to do:
Код:
//getting player name
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
//putting that player name into a path
new File:example = fopen("/Users/name.txt", io_read);
so if the name of the person inside the variable 'name' was 'cool', the path to his file would be "/Users/cool.txt"
Sorry if this is confusing! I am extremely confused my self and don't know if this is even possible.
Re: Need some help with opening a *specific* user file -
Crazymax - 27.04.2012
Of course it's possible.. here is an example.
pawn Код:
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
format(str,sizeof(str),"/Users/%s.txt",name);
new File:example = fopen(str, io_read);
Re: Need some help with opening a *specific* user file -
LeetModz - 27.04.2012
Quote:
Originally Posted by Crazymax
Of course it's possible.. here is an example.
pawn Код:
new name[MAX_PLAYER_NAME]; GetPlayerName(playerid, name, sizeof(name)); format(str,sizeof(str),"/Users/%s.txt",name); new File:example = fopen(str, io_read);
|
I get: error 017: undefined symbol "str"
Re: Need some help with opening a *specific* user file -
Danny1 - 27.04.2012
Try this.
pawn Код:
new str, name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
format(str,sizeof(str),"/Users/%s.txt",name);
new File:example = fopen(str, io_read);
Re: Need some help with opening a *specific* user file -
[MG]Dimi - 27.04.2012
Quote:
Originally Posted by Danny1
Try this.
pawn Код:
new str, name[MAX_PLAYER_NAME]; GetPlayerName(playerid, name, sizeof(name)); format(str,sizeof(str),"/Users/%s.txt",name); new File:example = fopen(str, io_read);
|
LOL. Str is string, not integer.
pawn Код:
new str[50], name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
format(str,sizeof(str),"/Users/%s.txt",name);
new File:example = fopen(str, io_read);
Re: Need some help with opening a *specific* user file -
Danny1 - 27.04.2012
I didn't know sorry.I thinking is that string or not but I decide wrong.
Re: Need some help with opening a *specific* user file -
LeetModz - 27.04.2012
Quote:
Originally Posted by Danny1
Try this.
pawn Код:
new str, name[MAX_PLAYER_NAME]; GetPlayerName(playerid, name, sizeof(name)); format(str,sizeof(str),"/Users/%s.txt",name); new File:example = fopen(str, io_read);
|
Quote:
Originally Posted by [MG]Dimi
LOL. Str is string, not integer.
pawn Код:
new str[50], name[MAX_PLAYER_NAME]; GetPlayerName(playerid, name, sizeof(name)); format(str,sizeof(str),"/Users/%s.txt",name); new File:example = fopen(str, io_read);
|
Thank you both
rep+ to you guys