28.06.2020, 17:02
Hello ,i create this command :
But when i create a faction , my database is still blank...
Mysql: https://imgur.com/LFB0zJC.png
PHP Code:
CMD:fcreate(playerid, params[])
{
new string[128], query[400], fname[32];
if(sscanf(params, "s[32]", fname)) return SendClientMessage(playerid, -1, "USAGE: /fcreate factionname");
// GETTING ALL THE FACTIONS CREATED, THEN ADDING 1 TO MAKE THE NEW ONE
Total_Factions_Created++;
//=====================================================================
// THIS SETS THE FACTIONS NAME TO WHATEVER YOU JUST NAMED IT, PLUS SETS THE ID FOR THE FACTION
format(Factions[Total_Factions_Created][FactionName], 64, "%s", fname);
Factions[Total_Factions_Created][ID] = Total_Factions_Created;
//==============================================================================================
// THIS IS JUST TELLING YOU CREATED A FACTION, WITH THE NAME
format(string, sizeof(string), "You have created a faction named: %s(ID:%d).",Factions[Total_Factions_Created][FactionName], Factions[Total_Factions_Created][ID]);
SendClientMessage(playerid, -1, string);
//================================================================================================
// THIS IS SETTING ALL THE FACTION NAMES, WILL BE USED LATER FOR EDITTING AROUND
format(Factions[Total_Factions_Created][Rank1], 32, "Rank 1 - Lowest");
format(Factions[Total_Factions_Created][Rank2], 32, "Rank 2");
format(Factions[Total_Factions_Created][Rank3], 32, "Rank 3");
format(Factions[Total_Factions_Created][Rank4], 32, "Rank 4");
format(Factions[Total_Factions_Created][Rank5], 32, "Rank 5");
//================================================================================
// THIS IS FOR SAVING ALL THE DATA INTO THE MYSQL DATABASE
mysql_format(MySQL:Database, query, sizeof(query), "INSERT INTO 'factions' ('ID', 'FactionName', 'FactionLeader', 'Rank1name', 'Rank2name', 'Rank3name', 'Rank4name', 'Rank5name'",
Factions[Total_Factions_Created][ID],Factions[Total_Factions_Created][FactionName],Factions[Total_Factions_Created][FactionLeader],Factions[Total_Factions_Created][Rank1],
Factions[Total_Factions_Created][Rank2],Factions[Total_Factions_Created][Rank3],Factions[Total_Factions_Created][Rank4],Factions[Total_Factions_Created][Rank5]);
mysql_query(MySQL:Database, query);
//=================================================================================
return 1;
}
Mysql: https://imgur.com/LFB0zJC.png