06.02.2019, 00:21
Hello, I haven't used Pawn in a very long time so unfortunately I've forgotten a lot of things.
I was wondering whether it's a bad idea to code like this:
Instead of having a playerid as a parameter, like this
I create a new event that uses a player array containing information about that player, like this
What are the disadvantages of doing that?
I was wondering whether it's a bad idea to code like this:
Instead of having a playerid as a parameter, like this
PHP код:
enum e_pvars { Name[MAX_PLAYER_NAME] };
new PlayerVars[MAX_PLAYERS][e_pvars];
public OnPlayerConnect(playerid) // like this
{
new name[MAX_PLAYER_NAME + 1];
GetPlayerName(playerid, name, sizeof(name));
SendClientMessageToAll(YELLOW, name);
return 1;
}
PHP код:
New_OnplayerConnect(Player[]) // like this
{
SendClientMessageToAll(YELLOW, Player[Name]);
}
public OnPlayerConnect(playerid)
{
GetPlayerName(playerid, PlayerVars[playerid][Name], MAX_PLAYER_NAME);
New_OnplayerConnect(PlayerVars[playerid]);
return 1;
}