y_ini offline. -
tyler12 - 08.09.2012
How can I use INI_String with offline users in y_ini?
Thanks,tyler.
Re: y_ini offline. -
[WSF]ThA_Devil - 08.09.2012
what you want to do first with offline users?
+ it should be quetly difficult to manage that if you don't have users ID based.
Re: y_ini offline. -
tyler12 - 08.09.2012
Users have there own %s.ini
I would like to use it to read stuff from files, such as there stats,IP..
Re: y_ini offline. -
[WSF]ThA_Devil - 08.09.2012
Quote:
Originally Posted by tyler12
Users have there own %s.ini
I would like to use it to read stuff from files, such as there stats,IP..
|
amm why would you even need to do that from offline players?
Re: y_ini offline. -
tyler12 - 08.09.2012
Quote:
Originally Posted by [WSF]ThA_Devil
amm why would you even need to do that from offline players?
|
Checking if a player is banned, with my aka system. Checking ban evaders, and alot other things.
Re: y_ini offline. -
[WSF]ThA_Devil - 08.09.2012
Quote:
Originally Posted by tyler12
Checking if a player is banned, with my aka system. Checking ban evaders, and alot other things.
|
you can make ban log... which logs all banned players... you wouldn't need to mess with thousands of files, only with one.
Re: y_ini offline. -
tyler12 - 08.09.2012
Quote:
Originally Posted by [WSF]ThA_Devil
you can make ban log... which logs all banned players... you wouldn't need to mess with thousands of files, only with one.
|
Ive got a ban log, That wouldnt help in my case. I need to check if Banned == 1 then it tells me. Then I can ban the ban evader...
@******
If I format a string with the account name, How would I go about reading from the file?
like dini_get.
Re: y_ini offline. -
clarencecuzz - 08.09.2012
I know exactly what you mean, and the situation you're in. It took me a while to figure it out but I finally got it.
Here's an example of unbanning an offline account.
pawn Код:
CMD:unban(playerid,params[])
{
new account[25];
if(!IsPlayerAdmin(playerid) && Player[playerid][Admin] < 7) return SendClientMessage(playerid, red, "ERROR: {FFFFFF}You Have Entered An Invalid Command. Please Read {00FF00}/CMDS{FFFFFF}.");
if(sscanf(params,"s[25]",account)) return SendClientMessage(playerid, red, "SYNTAX ERROR: {00FF00}/UNBAN {FFFF00}<Account>");
new string[45];
format(string,sizeof(string),PATH,account);
if(!fexist(string)) return SendClientMessage(playerid, red, "ERROR: {FFFFFF}This Player Account Does Not Exist.");
INI_ParseFile(string, "LoadBanCheck_%s", .bExtra = true, .extra = playerid);
if(Player[playerid][Banned] == 0) return SendClientMessage(playerid, red, "ERROR: {FFFFFF}This Player Account Is Not Banned.");
new INI:File = INI_Open(string);
INI_WriteInt(File, "Banned", 0);
INI_Close(File);
format(string,sizeof(string),"The Account Of %s Has Been Unbanned.",account);
SendClientMessage(playerid, yellow, string);
format(string,sizeof(string),"Administrator %s Has Unbanned The Account Of %s.",pName(playerid), account);
SendAdminMessage(orange, string);
Player[playerid][Banned] = 0;
Player[playerid][BanReason] = 0;
return 1;
}
pawn Код:
forward LoadBanCheck_data(playerid,name[],value[]);
public LoadBanCheck_data(playerid,name[],value[])
{
INI_Int("Banned",Player[playerid][Banned]);
INI_Int("BanReason",Player[playerid][BanReason]);
return 1;
}
However the only downside is that I had to save them as variables for playerid, there are alternatives however.
Re: y_ini offline. -
tyler12 - 08.09.2012
Quote:
Originally Posted by clarencecuzz
I know exactly what you mean, and the situation you're in. It took me a while to figure it out but I finally got it.
Here's an example of unbanning an offline account.
pawn Код:
CMD:unban(playerid,params[]) { new account[25]; if(!IsPlayerAdmin(playerid) && Player[playerid][Admin] < 7) return SendClientMessage(playerid, red, "ERROR: {FFFFFF}You Have Entered An Invalid Command. Please Read {00FF00}/CMDS{FFFFFF}."); if(sscanf(params,"s[25]",account)) return SendClientMessage(playerid, red, "SYNTAX ERROR: {00FF00}/UNBAN {FFFF00}<Account>"); new string[45]; format(string,sizeof(string),PATH,account); if(!fexist(string)) return SendClientMessage(playerid, red, "ERROR: {FFFFFF}This Player Account Does Not Exist."); INI_ParseFile(string, "LoadBanCheck_%s", .bExtra = true, .extra = playerid); if(Player[playerid][Banned] == 0) return SendClientMessage(playerid, red, "ERROR: {FFFFFF}This Player Account Is Not Banned."); new INI:File = INI_Open(string); INI_WriteInt(File, "Banned", 0); INI_Close(File); format(string,sizeof(string),"The Account Of %s Has Been Unbanned.",account); SendClientMessage(playerid, yellow, string); format(string,sizeof(string),"Administrator %s Has Unbanned The Account Of %s.",pName(playerid), account); SendAdminMessage(orange, string); Player[playerid][Banned] = 0; Player[playerid][BanReason] = 0; return 1; }
pawn Код:
forward LoadBanCheck_data(playerid,name[],value[]); public LoadBanCheck_data(playerid,name[],value[]) { INI_Int("Banned",Player[playerid][Banned]); INI_Int("BanReason",Player[playerid][BanReason]); return 1; }
However the only downside is that I had to save them as variables for playerid, there are alternatives however.
|
Kind of. Heres what im trying to do.
pawn Код:
CMD:isbanned(playerid,params[])
{
new account[25],string[25],msg[124];
if(sscanf(params,"s[25]",account)) return ShowUsageMessage(playerid,"/isbanned [name]");
format(string,sizeof(string),"Users/%s.ini",account);
if(!fexist(string)) return SendClientMessage(playerid,-1,"Account does not exist");
new INI:file = INI_Open(string);
INI_Int(file,"Banned",pInfo[playerid][Banned]);// I need to save if hes banned somewhere
INI_Close(file);
format(msg,sizeof(msg),"Account status:%d (1 - banned 0 - not banned",/*Where I saved if hes banned */);
SendClientMessage(playerid,-1,msg);
return 1;
}
Half of the code dosent exist, but if you could give me a lil help, I would appreciate it.
Re: y_ini offline. -
clarencecuzz - 08.09.2012
Sorry for the long response, only just saw your PM.
pawn Код:
CMD:isbanned(playerid,params[])
{
new account[25];
new string[40];
if(sscanf(params,"s[25]",account)) return ShowUsageMessage(playerid,"/isbanned [name]");
format(string,sizeof(string),"Users/%s.ini",account);
if(!fexist(string)) return SendClientMessage(playerid,-1,"Account does not exist");
INI_ParseFile(string, "CheckBan_%s", .bExtra = true, .extra = playerid);
new Status[15];
new msg[60];
if(pInfo[playerid][Banned] == 0)
{
Status = "Not Banned";
}
else if(pInfo[playerid][Banned] == 1)
{
Status = "Banned";
}
format(msg, sizeof(msg), "%s | Account Status: %s |",Status);
pInfo[playerid][Banned] = 0;
SendClientMessage(playerid,-1,msg);
return 1;
}
forward CheckBan_data(playerid,name[],value[]);
public CheckBan_data(playerid,name[],value[])
{
INI_Int("Banned",pInfo[playerid][Banned]);
}