17.06.2011, 22:01
Elaborating on what Sasha replied with, your "Name()" function loops through every player and gets the player name of the last connected player - this code is illogical and won't work for what you want it to do.
Scripting is based primary off logic - you script things, they make sense!
To fix your problem, you're going to need to add an ID parameter to your function and you're going to need to use that parameter. The proper term for a function parameter is an "argument" though.
The code most likely to fix this is:
Scripting is based primary off logic - you script things, they make sense!
To fix your problem, you're going to need to add an ID parameter to your function and you're going to need to use that parameter. The proper term for a function parameter is an "argument" though.
The code most likely to fix this is:
pawn Код:
public OnPlayerDisconnect(playerid, reason)
{
new files[48],message[48];
format(files,sizeof(files),"Last log/%s.ini",Name(playerid)); // you probably shouldn't use spaces in var names though!
new INI:file = INI_Open(files);
format(message,sizeof(message),"%s",TimeDate());
INI_WriteString(file,"Logged off",message);
INI_Close(file);
return 1;
}
pawn Код:
Name(playerid)
{
new n[MAX_PLAYER_NAME];
GetPlayerName(playerid, n, MAX_PLAYER_NAME);
return n;
}