21.02.2013, 10:49
Pff, again I've been on this for an hour again, again an hour wasted. Seems like I really need to learn some more about working with strings. Well, the image will speak for itself.

declaration, and the command...

declaration, and the command...
Код:
enum MAIL_BOX{
bool:Owned,
Owner[MAX_PLAYER_NAME],
Messages
}
Код:
CMD:mail(playerid, params[])
{
new toplayer[MAX_PLAYER_NAME];
if(!sscanf(params, "s[17]", toplayer))
{
*new string[256];
* * new boxid, bool:found;
* * format(string, sizeof(string), "name to search for %s", toplayer);
* * SendClientMessage(playerid, COLOUR_YELLOW, string);
* * for(new i=0;i<MailBoxid;i++)
* * {
* * * * format(string, sizeof(string), "owner of mailbox %i %s", i, gMAIL_BOX[i][Owner]);
* * *SendClientMessage(playerid, COLOUR_YELLOW, string);
* * * * * *if(strcmp(toplayer, gMAIL_BOX[i][Owner], true, strlen(toplayer) == 0))
* * * * * *{
* * * * * * * *found = true;
* *boxid = i;
* *SendClientMessage(playerid, COLOUR_YELLOW, "found");
* }
* SendClientMessage(playerid, COLOUR_YELLOW, "not found!");
*}
* *if(found)
* *{
* * * *format(string, sizeof(string), "You succesfully sumbitted your mail to player %s", toplayer);
* * * *SendClientMessage(playerid, COLOUR_YELLOW, string);
* * * *gMAIL_BOX[boxid][Messages] += 1;
* *}
* *else SendClientMessage(playerid, COLOR_WHITE, "player not found'");
}
else SendClientMessage(playerid, COLOR_WHITE, "USAGE: '/sendmail [Name]'");
return 1;
}

