Yini: Join Message
#1

Still not loading or reading.

pawn Код:
format(Message, sizeof(Message), "%s (%s)" ReturnName(playerid), INI_Get(file, "JoinMessage"));


pawn Код:
stock INI_Get(filename[],key[])
{
    new File:F,string[128];
    new sname[24],sval[24];
    F = fopen(filename,io_read);
    if(!F) return sname;
    while(fread(F,string))
    {
        sscanf(string,"p<=>s[24]s[24]",sname,sval);
        if(!strcmp(sname,key)) {
            sval[strlen(sval)-2] = 0;
            fclose(F);
            return sval;
        }
    }
    fclose(F);
    sname[0] = '\0';
    return sname;
}
pawn Код:
COMMAND:joinmessage(playerid, params[])
{
    new string[128], pName[MAX_PLAYER_NAME], locfile[32];
    if(isnull(params)) return SendClientMessage(playerid, -1, "USAGE: {FFFFFF}/joinmessage [message]");
    format(string, sizeof(string), "You have set your Join Message to: %s", params);
    SendClientMessage(playerid, -1, string);
    GetPlayerName(playerid, pName, sizeof(pName));
    format(locfile, sizeof(locfile), "accounts/%s.ini", pName);
    new INI:file = INI_Open(locfile);
    INI_WriteString(file, "JoinMessage", params);
    INI_Close(file);
    return 1;
}
There a way to add PlayerInfo[playerid][JoinMessage]?
Reply
#2

PlayerInfo[playerid][JoinMessage] < this one ?
Reply
#3

Quote:
Originally Posted by ChandraLouis
Посмотреть сообщение
Your enum ? [ Player Info ]
Why you need my enum?
Reply
#4

I think u should load all the info at once during Player connect
why not like this
pawn Код:
forward LoadUser_data(playerid,name[],value[]);
public LoadUser_data(playerid,name[],value[])
{
INI_String("JoinMessage",PlayerInfo[playerid][pPassword],200);//edit size as per as ur need
//here ur other loadings
return 1;
}

//this in OnPlayerConnect
INI_ParseFile(PATH, "LoadUser_%s", .bExtra = true, .extra = playerid);//here instead of path enter the file u want to open
Reply
#5

Quote:
Originally Posted by BroZeus
Посмотреть сообщение
I think u should load all the info at once during Player connect
why not like this
pawn Код:
forward LoadUser_data(playerid,name[],value[]);
public LoadUser_data(playerid,name[],value[])
{
INI_String("JoinMessage",PlayerInfo[playerid][pPassword],200);//edit size as per as ur need
//here ur other loadings
return 1;
}

//this in OnPlayerConnect
INI_ParseFile(PATH, "LoadUser_%s", .bExtra = true, .extra = playerid);//here instead of path enter the file u want to open
PlayerInfo[playerid][pPassword]?

EDIT
pawn Код:
(94) : error 001: expected token: ")", but found "["
(94) : warning 215: expression has no effect
(94) : error 001: expected token: ";", but found "]"
(94) : error 029: invalid expression, assumed zero
(94) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


4 Errors.
pawn Код:
forward LoadUser_data(playerid,name[],value[]);
public LoadUser_data(playerid,name[],value[])
{
    INI_Int("Password",PlayerInfo[playerid][pPass]);
    INI_Int("Score",PlayerInfo[playerid][Score]);
    INI_Int("Cash",PlayerInfo[playerid][pCash]);
    INI_Int("WantedLevel",PlayerInfo[playerid][Wanted]);
    INI_Int("Admin",PlayerInfo[playerid][pAdmin]);
    INI_Int("Vip",PlayerInfo[playerid][pVip]);
    INI_Int("TruckerJob",PlayerInfo[playerid][TruckerJob]);
    INI_String("JoinMessage",PlayerInfo[playerid][JoinMessage],200);//
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)