19.04.2014, 05:07
Still not loading or reading.
There a way to add PlayerInfo[playerid][JoinMessage]?
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;
}