30.07.2016, 05:33
Hello guys. I'm trying to save my faction information.
Under Enumerators I have.
Under OnDialogResponse I have.
For some reason my faction name/type doesn't save. What am I doing wrong?
PHP код:
CMD:createfaction(playerid,params[])
{
if(Player[playerid][Admin] < 4) return SendClientMessage(playerid, COLOR_GREY, "You must be an adminstrator to use this command");
ShowPlayerDialog(playerid, factionnamed, DIALOG_STYLE_INPUT, "Faction Creation", "Enter the faction name below", "Next");
return 1;
}
PHP код:
enum FactionData
{
ID,
factionname,
factiontype
};
new Faction[MAX_PLAYERS][FactionData];
PHP код:
enum
{
LoginDialog,
RegisterDialog,
factionnamed,
factiontyped,
};
PHP код:
case factionnamed:
{
new query[500];
mysql_format(mysql,query,sizeof(query), "INSERT INTO `faction` (`factionname`,`factiontype`) VALUES ('%e')",inputtext);
mysql_tquery(mysql, query, "", "");
ShowPlayerDialog(playerid, factiontyped, DIALOG_STYLE_LIST, "FACTION CREATION", "Type 0(Drugs)\nType 1(Weapons)", "Choose","Cancel");
if(dialogid == factiontyped)
{
if(response)
{
switch(listitem)
{
//mysql_format(mysql,query,sizeof(query), "UPDATE `accounts` SET `Admin` = %d WHERE ID = %d LIMIT 1", level, Player[target][ID]);
case 0:
{
mysql_format(mysql, query,sizeof(query), "UPDATE `faction` SET `factiontype` = '0' WHERE ID = %d LIMIT 1", Faction[playerid][ID]);
mysql_tquery(mysql, query, "", "");
}
case 1:
{
mysql_format(mysql, query,sizeof(query), "UPDATE `faction` SET `factiontype` = '1' WHERE ID = %d LIMIT 1", Faction[playerid][ID]);
mysql_tquery(mysql, query, "", "");
}
}
}
}
}