19.02.2011, 12:53
Can someone please show me an example on how to store some text(string) in multidimensional array.
I would really appreciate that.
Thank you.
I would really appreciate that.
Thank you.
new pName[MAX_PLAYERS][MAX_PLAYER_NAME];
//[MAX_PLAYERS] - the maximum amount of "data"
//[MAX_PLAYER_NAME] - the max length of the string (or player name, in this case)
public OnPlayerConnect(playerid)
{
GetPlayerName(playerid, pName[playerid], MAX_PLAYER_NAME); //This stores the players name in the multi-dimensional array.
//You an also store data in it using format, like so;
format(pName, MAX_PLAYER_NAME, "This is the text that will go in pName");
return 1;
}
CMD:test(playerid, params[])
{
SendClientMessage(playerid, COLOR, params);
// and now i need to store 'params' in multidimensional array so I can use it again
// Sure that doesn't have to be this way, but this is just a simple example
return 1;
}
CMD:text(playerid, params[])
{
SendClientMessage(playerid, COLOR, params);
//format(ArrayName[playerid], ArraySize, params);
//Or back to my example;
format(pName[playerid], MAX_PLAYER_NAME, params);
return 1;
}