I don't get it :/
Well this is long code, but please help.
Top defines:
pawn Код:
#define CmdsPath "TDM/Commands/%s.ini"
#define DIALOG_SETCMD 2
Top enum:
pawn Код:
enum CommandInfo
{
MakeadminCmd,
KickCmd,
BanCmd,
}
new cInfo[CommandInfo];
Also top: (This are dialogs)
pawn Код:
new CmdMakeadmin = 3;
new CmdKick = 4;
new CmdBan = 5;
Stock:
pawn Код:
stock CmdPath()
{
new str[150];
format(str, sizeof(str), CmdsPath, "Commands");
return str;
}
forward:
pawn Код:
forward loadcommands(name[], value[]);
public loadcommands(name[], value[])
{
INI_Int("Makeadmin", cInfo[MakeadminCmd]);
INI_Int("Ban", cInfo[BanCmd]);
INI_Int("Kick", cInfo[KickCmd]);
return 1;
}
OnGameModeInit:
pawn Код:
if(fexist(CmdsPath))
{
INI_ParseFile(CmdsPath, "loadcommands", .bExtra = true);
}
else
new INI:file = INI_Open(CmdPath());
INI_SetTag(file, "Enable/Disable Command:");
INI_WriteInt(file, "Makeadmin", cInfo[MakeadminCmd], 0);
INI_WriteInt(file, "Ban", cInfo[BanCmd], 0);
INI_WriteInt(file, "Kick", cInfo[KickCmd], 0);
INI_Close(file);
OnGameModeExit:
pawn Код:
new INI:file = INI_Open(CmdPath());
INI_SetTag(file, "Enable/Disable Command:");
INI_WriteInt(file, "Makeadmin", cInfo[MakeadminCmd]);
INI_WriteInt(file, "Ban", cInfo[BanCmd]);
INI_WriteInt(file, "Kick", cInfo[KickCmd]);
INI_Close(file);
OnDialogResponse:
pawn Код:
if(dialogid == DIALOG_SETCMD)
{
if(!response)return 0;
if(response)
{
if(listitem == 0)return ShowPlayerDialog(playerid, CmdMakeadmin, DIALOG_STYLE_MSGBOX, "Command: /Makeadmin", "To enable this command, click 'Enable'\nTo disable it, click 'Disable'", "Enable", "Disable");
if(listitem == 1)return ShowPlayerDialog(playerid, CmdKick, DIALOG_STYLE_MSGBOX, "Command: /Kick", "To enable this command, click 'Enable'\nTo disable it, click 'Disable'", "Enable", "Disable");
if(listitem == 2)return ShowPlayerDialog(playerid, CmdBan, DIALOG_STYLE_MSGBOX, "Command: /Ban", "To enable this command, click 'Enable'\nTo disable it, click 'Disable'", "Enable", "Disable");
}
}
pawn Код:
if(dialogid == CmdMakeadmin)
{
if(!response)
{
cInfo[MakeadminCmd] = 0;
GameTextForPlayer(playerid, "~y~/Makeadmin ~w~command has been ~r~disabled", 3000, 5);
}
if(response)
{
cInfo[MakeadminCmd] = 1;
GameTextForPlayer(playerid, "~y~/Makeadmin ~w~command has been ~g~enabled", 3000, 5);
}
}
if(dialogid == CmdKick)
{
if(!response)
{
cInfo[KickCmd] = 0;
GameTextForPlayer(playerid, "~y~/Kick ~w~command has been ~r~disabled", 3000, 5);
}
if(response)
{
cInfo[KickCmd] = 1;
GameTextForPlayer(playerid, "~y~/Kick ~w~command has been ~g~enabled", 3000, 5);
}
}
if(dialogid == CmdBan)
{
if(!response)
{
cInfo[BanCmd] = 0;
GameTextForPlayer(playerid, "~y~/Ban ~w~command has been ~r~disabled", 3000, 5);
}
if(response)
{
cInfo[BanCmd] = 1;
GameTextForPlayer(playerid, "~y~/Ban ~w~command has been ~g~enabled", 3000, 5);
}
}
Then at the command /Makeadmin:
pawn Код:
if(cInfo[MakeadminCmd] == 0)return SendClientMessage(playerid, RED, "[SERVER]: This command is disabled !");
Then at the command /Kick:
pawn Код:
if(cInfo[KickCmd] == 0)return SendClientMessage(playerid, RED, "[SERVER]: This command is disabled !");
Then at the command /Ban:
pawn Код:
if(cInfo[BanCmd] == 0)return SendClientMessage(playerid, RED, "[SERVER]: This command is disabled !");
But still when I restart samp-server.exe are still all commands disabled :/