Код:
#include <a_samp>
#include <zcmd>
#include <YSI\y_ini>
#define DIR_SET_SERV "SetariiServer.ini"
#define DIALOG_SETNUMESRV 15
//#define DIALOG_VersiuneServer 16
#define SCM SendClientMessage
#define SPD ShowPlayerDialog
enum Sett_Server
{
NumeServer[41]
//VersiuneServer[41]
};
new Server[Sett_Server];
public OnFilterScriptInit()
{
new str[128];
if(fexist(DIR_SET_SERV)) INI_ParseFile(DIR_SET_SERV, "IncarcareSetariiServer");
format(str, sizeof(str),".::[%s]::.",Server[NumeServer]);
print(str);
return 1;
}
forward IncarcareSetariiServer(name[], value[]);
public IncarcareSetariiServer(name[], value[])
{
INI_String( "Nume Server :", Server[NumeServer], 41);
//INI_String( "Versiune Server :", Server[VersiuneServer], 21);
return 1;
}
stock SetariiServer()
{
new INI:File = INI_Open(DIR_SET_SERV);
INI_SetTag(File,"Setari Server");
INI_WriteString(File,"Nume Server :", Server[NumeServer]);
//INI_WriteString(File,"Versiune Server :", Server[VersiuneServer]);
INI_Close(File);
return 1;
}
CMD:schimbahostname(playerid, params[])
{
SPD(playerid, DIALOG_SETNUMESRV, DIALOG_STYLE_INPUT,"Server Host Name","Scrie Numele Servarului", "Schimba", "Exit");
return 1;
}
CMD:test(playerid, params[])
{
new str[128];
if(fexist(DIR_SET_SERV)) INI_ParseFile(DIR_SET_SERV, "IncarcareSetariiServer");
format(str, sizeof(str),".::[%s]::.",Server[NumeServer]);
print(str);
SCM(playerid, -1,str);
return 1;
}
/*CMD:schimbaversiune(playerid, params[])
{
SPD(playerid, DIALOG_VersiuneServer, DIALOG_STYLE_INPUT,"Versiune Server","Scrie Versiunea ...", "Schimba", "Exit");
return 1;
}*/
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
switch(dialogid)
{
case DIALOG_SETNUMESRV:
{
if(!response)
if(strlen(inputtext) > 40) return SCM(playerid, -1,"Aici imi dade erori");
new str[50];
format(Server[NumeServer], 41, "%s", inputtext);
format(str, 50, "hostname %s", Server[NumeServer]);
SendRconCommand(str);
SetariiServer();
SendRconCommand(str);
if(fexist(DIR_SET_SERV)) INI_ParseFile(DIR_SET_SERV, "IncarcareSetariiServer");
format(str, sizeof(str),"Host Name : %s",Server[NumeServer]);
SCM(playerid,-1,str);
}
/*case DIALOG_VersiuneServer:
{
if(!response)
if(strlen(inputtext) > 40) return SCM(playerid, -1,"Aici imi dade erori");
new str[50];
format(Server[VersiuneServer], 41, "%s", inputtext);
format(str, 50, "Versiune : %s", Server[VersiuneServer]);
SendRconCommand(str);
SetariiServer();
if(fexist(DIR_SET_SERV)) INI_ParseFile(DIR_SET_SERV, "IncarcareSetariiServer");
format(str, sizeof(str),"Ai setat Versiunea la server: %s",Server[VersiuneServer]);
SCM(playerid,-1,str);
}*/
}
return 1;
}