How do i read something inside a file using Y_INi
#1

How do I read something inside a .ini file example:

PHP код:
#define CLAN_TAG_MEMBERS "ClanMembers/%.ini" 
PHP код:
public OnPlayerSpawn(playerid)
{
If(
strfind(playername"[Look]"true) != 0// this will check if the player has [Look] infront of there name and inside the .ini file is 0 his not  clan tag member it will kick the player
if(fexist(Folder(playerid)))
{
     new 
INI:file INI_Open(Folder(playerid));
    
// NOW HERE HOW DO I CHECK IF THE PLAYER Really has 0 in there ini file?

Custom Function:

PHP код:
Folder(playerid)
{
      New 
string[128], playername[MAX_PLAYER_NAME];
      
format(stringsizeof(string), CLAN_TAG_MEMBERSplayername);
      return 
string;

Reply
#2

Код:
INI_Int("IsMember",IsMember[playerid]);
By the way, just make an array and store the name of guys that are in a clan. And check from it when some one connects, It can also be managed in game but won't be saved.
Reply
#3

Im already doing that tha ks
Reply
#4

Heres some things i missed out

Enum PlayerData
{
ClanMember
}
New player[MAX_PLAYERS][PlayerData]
Reply
#5

Wait, let me start from the beginning, I just got on the PC, so heres my defines and enums:

PHP код:
#define     CLAN_TAG_MEMBERS        "ClanMembers/%s.ini" 
PHP код:
enum PlayerData
{
    
ClanMember
}
new 
Player[MAX_PLAYERS][PlayerData]; 
PHP код:
public OnPlayerConnect(playerid)
{
     if(
fexist(Folder(playerid)))
    {
        
INI_ParseFile(Folder(playerid), "LoadUser_%s", .bExtra true, .extra playerid);
    }
    else
    {
        new 
INI:file INI_Open(Folder(playerid));
        
INI_WriteInt(file"ClanMember"Player[playerid][ClanMember]);
        
INI_ParseFile(Folder(playerid), "LoadUser_%s", .bExtra true, .extra playerid);
        
INI_Close(file);
    }
    return 
1;

PHP код:
public OnPlayerSpawn(playerid)
{
    new 
playername[64];
    
GetPlayerName(playerid,playernameMAX_PLAYER_NAME);
    if(
strfind(playername,""SERVER_CLAN_TAG"",true) != 0)
    {
        if(
fexist(Folder(playerid)))
         {
             new 
INI:file INI_Open(Folder(playerid));
                    
// IDK WHAT TO DO HERE!
            
return 1;
        }
    }
    return 
1;

PHP код:
Folder(playerid)
{
    new 
string[128],playername[MAX_PLAYER_NAME];
     
GetPlayerName(playerid,playername,sizeof(playername));
      
format(string,sizeof(string),CLAN_TAG_MEMBERS,playername);
       return 
string;

Reply
#6

I'd suggest you to learn MySQL, It's way easier than everyone thinks.
Reply
#7

Sure, I will, help me instead
Reply
#8

You may not need it under 'OnPlayerSpawn'. Why are you loading user in both cases when player's file exist, and when it doesn't exist.
By the way locate your loading function or loading code and place there in this
[CODE]INI_Int("IsMember",Player[playerid][ClanMember]);
//Now you are all set just use your variable when you want to check if someone is in clan or not[CODE]
Reply
#9

Error:

PHP код:
filterscripts\ClanTagSystem.pwn(66) : error 017undefined symbol "name"
filterscripts\ClanTagSystem.pwn(66) : error 017undefined symbol "value"
Pawn compiler 3.2.3664              Copyright (c1997-2006ITB CompuPhase
2 Errors

Line:

66:
PHP код:
INI_Int("ClanMember"Player[playerid][ClanMember]); 
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)