Strcmp fail, or did I fail?
#1

Well here I am again, (sorry xd) This time, something weird is happening, I made a sctrcmp scripty, but it seems like it doesnt work. When I use the /mail command ig, it shows name to search for, and names found, identical the same. However, the strcmp clientmessage doesn't get activated. Been searching on it for some time now, but I can't seem to find it.



Declaration

Code:
enum MAIL_BOX{
 bool:Owned,
 Owner[MAX_PLAYER_NAME],
 Messages
}
new gMAIL_BOX[MAX_MAILBOXES][MAIL_BOX];
this one is to give every mailbox a unique ID.

Code:
new MailBoxid; //unique id
command

Code:
CMD:mail(playerid, params[])
{
 new toplayer;
 if(!sscanf(params, "u", toplayer))
 {
 * * new name[MAX_PLAYER_NAME], string[256];
 * * GetPlayerName(toplayer, name, sizeof(name));
 *format(string, sizeof(string), "name to search for : %s", name);
 * *SendClientMessage(playerid, COLOR_WHITE, string);
 * * for(new i=0;i<MailBoxid;i++)
 * * {
 * * *format(string, sizeof(string), "Owner : %s", gMAIL_BOX[i][Owner]);
 * * * * * *SendClientMessage(playerid, COLOR_WHITE, string);
 * * * * * *if(strcmp(name, gMAIL_BOX[i][Owner], true))
 * * * * * *{
 * * * * * * * *SendClientMessage(playerid, COLOR_WHITE, "FFFFFFFFFOUNDDDDDDDDDDDDDDD");
 * }
 *}
 }
 else SendClientMessage(playerid, COLOR_WHITE, "USAGE: '/sendmail [Name]'");
 return 1;
}
Why do I need this for? Simply, I gotta find if the player who i'm trying to send a message has a mailbox.
Reply
#2

https://sampwiki.blast.hk/wiki/Strcmp
You need to check if strcmp is equal 0 (!strcmp)
Reply
#3

strcmp returns 0 on success.
Reply
#4

Wow, How stupid of me, thanks alot guys! it's working now.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)