14.04.2019, 12:24
So I have made a master account system. (You login with Stefhan, then pick a character e.g Sean Johnson and your name is set to it.)
This causes other players to be able to connect with Stefhan and even though he is already online, you can join and spawn with another or the same character, because the name isn't taken. Obviously this isn't ment to happen.
How do I prevent this? I put this on OnPlayerConnect but it doesn't work and gives me this error.
This causes other players to be able to connect with Stefhan and even though he is already online, you can join and spawn with another or the same character, because the name isn't taken. Obviously this isn't ment to happen.
How do I prevent this? I put this on OnPlayerConnect but it doesn't work and gives me this error.
PHP Code:
public OnPlayerConnect(playerid)
{
foreach(new i:Player)
{
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
if(Account[i][Username] == name)
{
SendClientMessage(playerid, COLOR_ERROR, "Someone is already connected with this account.") && SendClientMessage(playerid, COLOR_INFO, "Please login with a different username.");
SetTimerEx("KickTimer", 200, false, "i", playerid);
}
}
return 1;
}
PHP Code:
error 033: array must be indexed (variable "name")