Strcmp fail, or did I fail? - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Strcmp fail, or did I fail? (
/showthread.php?tid=417343)
Strcmp fail, or did I fail? -
JamesS - 20.02.2013
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.
Re: Strcmp fail, or did I fail? -
Misiur - 20.02.2013
https://sampwiki.blast.hk/wiki/Strcmp
You need to check if strcmp is equal 0 (!strcmp)
Re: Strcmp fail, or did I fail? -
Vince - 20.02.2013
strcmp returns 0 on success.
Re: Strcmp fail, or did I fail? -
JamesS - 20.02.2013
Wow, How stupid of me, thanks alot guys! it's working now.