09.05.2011, 13:39
(
Последний раз редактировалось DesertFoxNight; 09.05.2011 в 18:32.
)
I'm having a difficult time trying to write and read from a file. I've created two commands in my Gamemode: one to record the Name, IP, and Score of a player; and the other one to retrieve the Name and Score of the person. The code looks like this:
I've tried different combination for the file name such as:
Thank you for your time.
pawn Код:
COMMAND:pass(playerid){
new file[250] = "/userfiles/testing.ini";
GetPlayerName(playerid, PlayerInfo[playerid][pName], MAX_PLAYER_NAME);
GetPlayerIp(playerid, PlayerInfo[playerid][pIP], 16);
PlayerInfo[playerid][pScore] = GetPlayerScore(playerid);
dini_Set( file, "Name", PlayerInfo[playerid][pName] );
dini_Set( file, "IP", PlayerInfo[playerid][pIP]);
dini_IntSet( file, "Score", PlayerInfo[playerid][pScore] );
return 1;
}
COMMAND:get(playerid){
new file[250] = "/userfiles/testing.ini";
new msg[150];
format( msg, sizeof(msg), "Name: %s", dini_Get(file, "Name") );
SendClientMessage( playerid, BLUE, msg );
format( msg,sizeof(msg),"Score: %d", dini_Int(file, "Score") );
SendClientMessage( playerid, BLUE, msg );
return 1;
}
- C:\Users\Owner\Desktop\Games\GTA SA\Server\userfiles\testing.ini
- C:\\Users\\Owner\\Desktop\\Games\\GTA SA\\Server\\userfiles\\testing.ini
- C:/Users/Owner/Desktop/Games/GTA SA/Server/userfiles/testing.ini
- \\userfiles\\testing.ini
- /userfiles/testing.ini
- userfiles\testing.ini
- userfiles/testing.ini
Thank you for your time.