Save/Load Parameters (dini) -
Oshery - 29.07.2017
Can someone tell me how to save/load a text parameter?
I only know how to do it with numbers used for ranks and stuff using player data and MAX PLAYER created variables
I want to know how to save the parameters to make a tag system that will be shown in the command /admins.
I already made the command and all I need that to know how to do that.
Код:
CMD:admins(playerid, params[])
{
new count = 0, str[200];
SendClientMessage(playerid, COLOR_WHITE,"- List of Online Admins -");
foreach(Player,i)
{
if(Player[i][pLevel] >=1)
{
if(IsPlayerConnected(i))
{
if(count != 0)
{
format(str,sizeof(str),"[%d]%s - Level %d (%s) %s", i, PlayerName(i), Player[i][pLevel], Player[i][aTag], GetPlayerOnDuty(i));
SendClientMessage(playerid, OR, str);
}
}
}
}
if(count == 0)
{
SendClientMessage(playerid, OR,"No Admins are currently online!");
}
return 1;
}
And here's my /asettag command,
Код:
CMD:asettag(playerid, params[])
{
new str[128];
if(Player[playerid][pLevel]<=5) return SendClientMessage(playerid, OR, "ERROR: You are not authorized to use this command");
if(sscanf(params,"us",Player,Player[playerid][aTag])) return SendClientMessage(playerid, COLOR_GREY, "Usage: /asettag [ID] [tag]");
format(Player[playerid][aTag], 50, "%s",Player[playerid][aTag]);
DOF2_SetString(AFile(pPlayer),"Tag",Player[playerid][aTag]);
format(str, SOS, "Your admin tag has been set by administrator %s", PlayerName(playerid));
SendClientMessageEx(playerid, COLOR_GREEN, str);
format(str, SOS, "Admin: %s has used the command ASETTAG", PlayerName(playerid));
SendAdminMessage(OR, str);
return DOF2_SaveFile();
}
Re: Save/Load Parameters (dini) -
Oshery - 04.08.2017
Bump
Re: Save/Load Parameters (dini) -
Oshery - 04.08.2017
Bump
Re: Save/Load Parameters (dini) -
MiyuUchiha - 05.08.2017
you can use
PHP код:
new pName[MAX_PLAYER_NAME];
GetPlayerName(i, pName, sizeof(pName));
if(strcmp(pName) == "[WRITE NAME HERE]")
{
new string[128];
format(string,sizeof(string), "%s [TAG]", pName);
//do the SendClientMessage thing
}
//learn more if you want to change the tag by command
Re: Save/Load Parameters (dini) -
OneDay - 05.08.2017
Yini is better and faster.
Re: Save/Load Parameters (dini) -
Oshery - 18.08.2017
I would like to do that with a command to change the TAG and store it in a database (mysql) or even dini
Re: Save/Load Parameters (dini) -
Oshery - 26.08.2017
Bump
Re: Save/Load Parameters (dini) -
Oshery - 08.09.2017
Bump
Re: Save/Load Parameters (dini) -
Gammix - 08.09.2017
Saving:
PHP код:
dini_Set("your location/file.ini", "Tag", Player[playerid][aTag]);
"Player[playerid][aTag]" hold the tag name.
Loading:
PHP код:
dini_Get("your location/file.ini", "Tag")
This will return the tag as string. So you can use format/strcat to put the tag in a client message or wherever you want.
Re: Save/Load Parameters (dini) -
iSpark - 09.09.2017
Quote:
Originally Posted by OneDay
Yini is better and faster.
|
Very much true. However I have one small thing about Y_INI that ticks me off. It needs a public function to execute it's query. And judging by my style I always take a modular approach. So keeping anything that is global must be at bare minimum.
The very reason why I'm using dini. However it is slower than Y_INI but doesn't need a public function or such. Thus my preference.