Loading Offline Player info - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Loading Offline Player info (
/showthread.php?tid=347510)
Loading Offline Player info -
nickdodd25 - 02.06.2012
Hi there,
I have been working steady on a new admin system/registration system using y_ini. And i was trying to make a /unban command, i have tryed diffrent ways and none of them worked or gave tons of errors.
What i am wondering is how would i store the players info in an array/enum so then the /unban command can unban the player and then save the info all while the player is offline and possibly use the info for something such as /stats <name of offline player>?
I have the actuall /unban command done its self just mission the loading part for the player's file...
pawn Код:
COMMAND:unban(playerid, params[])
{
new PlayerToUnban[24], Msg[128], Name[24];
new string[50];
if (PlayerInfo[playerid][pLoggedIn] == 1)
{
if (PlayerInfo[playerid][pAdmin] >= 3)
{
print("before sscanf");
if (sscanf(params, "s[24]", PlayerToUnban)) return SendClientMessage(playerid, 0xFF0000AA, "Usage: \"/unban <PlayerToUnban>\"");
{
print("after sscanf");
format(string,sizeof(string),PATH,PlayerToUnban);
if(fexist(string))
{
//==========================================================
//unban code/loading info here
//==========================================================
GetPlayerName(playerid, Name, sizeof(Name));
format(Msg, 128, "Admin %s has un-banned %s", Name, PlayerToUnban);
SendClientMessageToAll(0x808080FF, Msg);
}
else
{
print(string);
SendClientMessage(playerid, 0xFFFFFFFF, "{FF0000}There is no account with that playername");
print("There was no account");
}
}
}
else
{
print("player isnt admin");
return 0;
}
}
else
{
print("player isnt logged in");
return 0;
}
return 1;
}
Hoping for a little assistance on this so i can get a idea on how to do it.
If anyone needs anymore info let me know.
Thanks
Re: Loading Offline Player info -
nickdodd25 - 06.06.2012
BUMP!!!
Well i got a working unban system, the command now writes a line in the players file that he is unban and then on connect it checks for it and unbans the player, works flawlessly. But my command has a issue it keeps saying unknown command even tho its unbanning the players file. Heres the basic command i made....
pawn Код:
CMD:unban(playerid,params[])
{
new id, Msg[128];
if(PlayerInfo[playerid][pAdmin] >=3)
{
if(sscanf(params,"s[24]",id)) return SendClientMessage(playerid,COLOR_RED,"SERVER: /unban playername");
{
print("before opening the file");
format(Msg, sizeof(Msg), "/AdminFolder/Users/%s.ini", id);
new INI:File = INI_Open(Msg);
print("after opening the file");
INI_SetTag(File,"data");
print("just set the data tag");
INI_WriteInt(File,"UnBan",1);
print("wrote to file");
INI_Close(File);
format(Msg, sizeof(Msg), "Admin has unban %s", id);
SendClientMessageToAll(COLOR_GREY,Msg);
print("closed the file");
}
}
else
{
print("its returning 0");
return 0;
}
print("its returning 1");
return 1;
}
and the debug lines
Код:
[09:41:18] before opening the file
[09:41:18] after opening the file
[09:41:18] just set the data tag
[09:41:18] wrote to file
[09:41:18] closed the file
[09:41:18] its returning 1
Anyone know what i did wrong?