27.09.2018, 12:59
Maybe this can help you.
I hope you can understand
PHP код:
CMD:editfrank(playerid, params[])
{
new string[128], rname[32], query[400], fid, rid;
if(sscanf(params, "dds[32]", fid, rid, rname)) return SCM(playerid, COLOR_WHITE, "USAGE: /editrank [faction id] [rank id] [rank name]\nTIPS: Rank ID = 1 - 10");
switch(rid)
{
case 1:
{
format(Factions[fid][Rank1], 32, "%s", rname);
format(string, sizeof(string), "You have set faction id %d rank 1 name to %s", fid, Factions[fid][Rank1]);
mysql_format(g_SQL, query, sizeof(query), "UPDATE `Factions` SET Rank1 = '%s' WHERE ID = %d", Factions[fid][Rank1], fid);
mysql_tquery(g_SQL, query);
}
case 2:
{
format(Factions[fid][Rank2], 32, "%s", rname);
format(string, sizeof(string), "You have set faction id %d rank 2 name to %s", fid, Factions[fid][Rank2]);
mysql_format(g_SQL, query, sizeof(query), "UPDATE `Factions` SET Rank2 = '%s' WHERE ID = %d", Factions[fid][Rank2], fid);
mysql_tquery(g_SQL, query);
}
case 3:
{
format(Factions[fid][Rank3], 32, "%s", rname);
format(string, sizeof(string), "You have set faction id %d rank 3 name to %s", fid, Factions[fid][Rank3]);
mysql_format(g_SQL, query, sizeof(query), "UPDATE `Factions` SET Rank3 = '%s' WHERE ID = %d", Factions[fid][Rank3], fid);
mysql_tquery(g_SQL, query);
}
case 4:
{
format(Factions[fid][Rank4], 32, "%s", rname);
format(string, sizeof(string), "You have set faction id %d rank 4 name to %s", fid, Factions[fid][Rank4]);
mysql_format(g_SQL, query, sizeof(query), "UPDATE `Factions` SET Rank4 = '%s' WHERE ID = %d", Factions[fid][Rank4], fid);
mysql_tquery(g_SQL, query);
}
case 5:
{
format(Factions[fid][Rank5], 32, "%s", rname);
format(string, sizeof(string), "You have set faction id %d rank 5 name to %s", fid, Factions[fid][Rank5]);
mysql_format(g_SQL, query, sizeof(query), "UPDATE `Factions` SET Rank5 = '%s' WHERE ID = %d", Factions[fid][Rank5], fid);
mysql_tquery(g_SQL, query);
}
case 6:
{
format(Factions[fid][Rank6], 32, "%s", rname);
format(string, sizeof(string), "You have set faction id %d rank 6 name to %s", fid, Factions[fid][Rank6]);
mysql_format(g_SQL, query, sizeof(query), "UPDATE `Factions` SET Rank6 = '%s' WHERE ID = %d", Factions[fid][Rank6], fid);
mysql_tquery(g_SQL, query);
}
case 7:
{
format(Factions[fid][Rank7], 32, "%s", rname);
format(string, sizeof(string), "You have set faction id %d rank 7 name to %s", fid, Factions[fid][Rank7]);
mysql_format(g_SQL, query, sizeof(query), "UPDATE `Factions` SET Rank7 = '%s' WHERE ID = %d", Factions[fid][Rank7], fid);
mysql_tquery(g_SQL, query);
}
case 8:
{
format(Factions[fid][Rank8], 32, "%s", rname);
format(string, sizeof(string), "You have set faction id %d rank 8 name to %s", fid, Factions[fid][Rank8]);
mysql_format(g_SQL, query, sizeof(query), "UPDATE `Factions` SET Rank8 = '%s' WHERE ID = %d", Factions[fid][Rank8], fid);
mysql_tquery(g_SQL, query);
}
case 9:
{
format(Factions[fid][Rank9], 32, "%s", rname);
format(string, sizeof(string), "You have set faction id %d rank 9 name to %s", fid, Factions[fid][Rank9]);
mysql_format(g_SQL, query, sizeof(query), "UPDATE `Factions` SET Rank9 = '%s' WHERE ID = %d", Factions[fid][Rank9], fid);
mysql_tquery(g_SQL, query);
}
case 10:
{
format(Factions[fid][Rank10], 32, "%s", rname);
format(string, sizeof(string), "You have set faction id %d rank 10 name to %s", fid, Factions[fid][Rank10]);
mysql_format(g_SQL, query, sizeof(query), "UPDATE `Factions` SET Rank10 = '%s' WHERE ID = %d", Factions[fid][Rank10], fid);
mysql_tquery(g_SQL, query);
}
}
return 1;
}