Compare Name with part of an enum -
dusk - 31.03.2013
pawn Code:
for(new i; i<MAX_BUSINESS; i++)
{
GetPlayerName(playerid,Name,sizeof(Name));
printf(BizInfo[i][Owner]);
if(!strcmp(BizInfo[i][Owner],Name,true))
{
ShowPlayerDialog(playerid,DIALOG_BIZ,DIALOG_STYLE_LIST,"Verslo valdymas","Pakeisti biznio pavadinima\nPakeisti įėjimo kainą","Pasirinkti","Atsaukti");
}
else SendClientMessage(playerid,0xFF0000FF,"Tu neturi jokio verslo");
}
Here is my script. The problem is, there's no BizInfo with my name,but i still see the dialog. Any help?
Re: Compare Name with part of an enum -
Neil. - 31.03.2013
pawn Code:
if(strcmp(BizInfo[i][Owner], Name, false) == 0)
Re: Compare Name with part of an enum -
Riddick94 - 31.03.2013
Quote:
Originally Posted by Ken97
pawn Code:
if(strcmp(BizInfo[i][Owner], Name, false) == 0)
|
pawn Code:
if(!strcmp(BizInfo[i][Owner],Name,true))
It's the same, the only one change in yours is case value.
Re: Compare Name with part of an enum -
Neil. - 31.03.2013
Quote:
Originally Posted by Riddick94
pawn Code:
if(!strcmp(BizInfo[i][Owner],Name,true))
It's the same, the only one change in yours is case value.
|
Very well then,
OT: How do you define your BizInfo?
EDIT: Also how do you load your user info onto the variable BizInfo[i][Owner]?
Re: Compare Name with part of an enum -
dusk - 31.03.2013
pawn Code:
enum bInfo
{
bizid,
Owner[32],
Owned,
Price,
BizName[64],
Type,
Products,
EntrancePrice,
Float:enX,
Float:enY,
Float:enZ,
Float:exX,
Float:exY,
Float:exZ,
Interior,
VirtualWorld,
Text3D:HouseLabel[24],
Locked
};
new BizInfo[MAX_BUSINESS][bInfo];
EDIT: yes, i have a loadbussiness function,which loads it on game mode init.
Re: Compare Name with part of an enum -
SuperViper - 31.03.2013
If any of the variables are blank, it will say that they matched.
pawn Code:
strsame(firstString[], secondString[], bool: caseSensitive = false)
{
if(isnull(firstString) || isnull(secondString)) return 0;
return !strcmp(firstString, secondString, caseSensitive);
}
Requires an
isnull function which ZCMD automatically adds to your script. Usage:
pawn Code:
if(strsame("Hello", "Hello"))
That will return true.
Re: Compare Name with part of an enum -
dusk - 31.03.2013
Thank you very much! Could have never though of that myself