0 Members and 1 Guest are viewing this topic.
procedure OnJoinGame(ID, Team: byte);var i:byte;beginif not FileExists('scripts/asd' +CurrentMap+ '.log') then WriteFile('scripts/asd' +CurrentMap+ '.log');if not FileExists('scripts/asd' +lowercase(player+) '.log') then WriteFile('scripts/asd' +lowercase(player)+ '.log');end;
procedure OnJoinGame(ID, Team: byte);var i:byte; player:string;beginplayer := GetPlayerStat(ID, 'name');if not FileExists('scripts/asd' +CurrentMap+ '.log') then WriteFile('scripts/asd' +CurrentMap+ '.log', 'dummy text');if not FileExists('scripts/asd' +lowercase(player)+ '.log') then WriteFile('scripts/asd' +lowercase(player)+ '.log', 'dummy text');end;
The event OnJointGame specifies the id of the player joining the game. It appears you are trying to write to a file containing the name of the player, however the variable player does not exist. You will need to get the name of the player with the id ID. In this code, I define such a variable and assign it to be the name of the player. Also, you have a misplaced the + character in the second if statement line in 'scripts/asd' +lowercase(player+) '.log'.Quote from: rOy on January 06, 2013, 12:15:48 amprocedure OnJoinGame(ID, Team: byte);var i:byte; player:string;beginplayer := GetPlayerStat(ID, 'name');if not FileExists('scripts/asd' +CurrentMap+ '.log') then WriteFile('scripts/asd' +CurrentMap+ '.log', 'dummy text');if not FileExists('scripts/asd' +lowercase(player)+ '.log') then WriteFile('scripts/asd' +lowercase(player)+ '.log', 'dummy text');end;I did not test this code.
Currently, it would NOT write to the file dummy.txt. The way it is now is it will try to write to two files (if they do not already exist): scripts/asdMapName.log and scripts/asdplayername.log (where the underlined stuff would be variable). The content of the file will be "dummy text" (without quotes). That can be easily changed in the script (look for the part that says 'dummy text' and change what is between the ' single quote marks ' ). If you want the files to be blank (no content), have no text there (simply ''; two consecutive single quote marks).Regarding your question of IDToName vs GetPlayerStat, I do not know. I think IDToName is still implemented, but as far as I know, it is not preferred, and I always thought of it as depreciated. I could be wrong about this though, and am not completely certain.
procedure OnJoinGame(ID, Team: byte);var i:byte; player:string;beginplayer := GetPlayerStat(ID, 'name');if not FileExists('scripts/asd' +CurrentMap+ '.log') then WriteFile('scripts/asd' +CurrentMap, '.log');if not FileExists('scripts/asd' +lowercase(player)+ '.log') then WriteFile('scripts/asd' +lowercase(player)+ GetPlayerStat, '.log');end;
procedure OnJoinGame(ID, Team: byte);var i:byte; player:string;beginplayer := GetPlayerStat(ID, 'name');if not FileExists('scripts/asd' +CurrentMap+ '.log') then WriteFile('scripts/asd' +CurrentMap '.log');if not FileExists('scripts/asd' +lowercase(player)+ '.log') then WriteFile('scripts/asd' +lowercase(player)+ GetPlayerStat '.log');end;
I've a testThisCode: [Select]procedure OnJoinGame(ID, Team: byte);var i:byte; player:string;beginplayer := GetPlayerStat(ID, 'name');if not FileExists('scripts/asd' +CurrentMap+ '.log') then WriteFile('scripts/asd' +CurrentMap, '.log');if not FileExists('scripts/asd' +lowercase(player)+ '.log') then WriteFile('scripts/asd' +lowercase(player)+ GetPlayerStat, '.log');end;where's the problem?Log say:asd -> [Error] (9:123): Invalid number of parameters
if not FileExists('scripts/asd' +lowercase(player)+ '.log') then WriteFile('scripts/asd' +lowercase(player)+ GetPlayerStat, '.log');
procedure OnJoinGame(ID, Team: byte);var i:byte; player:string;beginplayer := GetPlayerStat(ID, 'name');if not FileExists('scripts/asd' +CurrentMap+ '.log') then WriteFile('scripts/asd' +CurrentMap, '.log');if not FileExists('scripts/asd' +lowercase(player)+ '.log') then WriteFile('scripts/asd' +lowercase(player), '.log');end;