28.04.2012, 02:41
Quote:
pawn Код:
and this should be pawn Код:
it will return 0 if this is a match so thats why i added the ! you can also write it like pawn Код:
Also its not it is actually checking to see if "menu" contains the string "main" regards, |
pawn Код:
if(isPlayerIn(playerid, "main") == false)
Heres all of it:
pawn Код:
forward isPlayerIn(playerid, menu[]);
public isPlayerIn(playerid, menu[])
{
if(!strcmp("main", menu, true, 4)) //if "main" == menu (menu being a string parameter with the name of a menu screen, ie. "main", "weapons", "cars" etc.....)
{
//opening users .txt file
new readLine[64];
new str[50], name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
format(str,sizeof(str),"/Users/%s.txt",name);
new File:example = fopen(str, io_read);
while(fread(example, readLine)) //reads the file line-by-line
{
if(strcmp(readLine, "inMenu = true", true)) //if a line in the example file has "inMain == true"
{
fclose(example);
return true;
}
}
fclose(example);
}
return false;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
if(strcmp(cmdtext, "/admin") == 0 && isPlayerIn(playerid, "main") == false)
{
return 1;
}
}