12.12.2016, 14:51
Hello, I think I got to the point of not understanding my own code, how should it work? If the character has already been connected to the server with the same name, it will send a message to him saying that there is already a player that is using that same name, for example.
The function;
This checks if he is already online with the character, in case he is sent the message saying that he can not use the character and the function below is stopped, with the return.
What is going on? Simple, the player is connecting with the same name, "More like that Suk? There is no way" Not exactly with the same name, because there is no geito of gets two names in the game, but he gets the name he entered On the Onplayerconect.
The function;
PHP код:
Account[i][pPersonagem1] = FirstName_SecondName
PHP код:
if(!IsPlayerConnected(idonline)) return SendClientMessage(playerid, COLOR_ERROR, "ERROR: This character is already in the game.");
PHP код:
if(slot == 1) for(new i = 0; i < MAX_PLAYERS; i++) idonline = GetPlayerID(Account[i][pPersonagem1]);
if(slot == 2) for(new i = 0; i < MAX_PLAYERS; i++) idonline = GetPlayerID(Account[i][pPersonagem2]);
if(slot == 3) for(new i = 0; i < MAX_PLAYERS; i++) idonline = GetPlayerID(Account[i][pPersonagem3]);
if(!IsPlayerConnected(idonline)) return SendClientMessage(playerid, COLOR_ERROR, "ERRO: This character is already in the game.");