CMD:createfaction(playerid, params[])
{
if(pInfo[playerid][pLevel] >= 5)
{
new id,name[50],fac = FacCount;
if(sscanf(params,"us[50]",id,name)) return SCM(playerid,COLOR_ORANGE,"USAGE: /createfaction (playerid) (faction name)");
if(fac >= MAX_FACTIONS) return SCM(playerid,COLOR_RED,"Max faction limit reached!");
if(pInfo[id][flevel] == 0)
{
new Query[128];
format(Query, sizeof(Query), "INSERT INTO `Faction` (`Name`, `ID`, `Owner`, `Levels`, `InviteRank`, `KickRank`) VALUES('%s', '%d', '%s', '%d', '%d', '%d')", name, FacCount, PN(id), 10, 7, 7);
db_query(Database, Query);
pInfo[id][flevel] = 10;
pInfo[id][fname] = name;
pInfo[id][pfacno] = FacCount;
FactionInfo[fac][del] = 0;
SaveStatus(id);
new string[120];
format(string,sizeof(string),"You created a faction for %s with name %s.",PN(id),name);
SCM(playerid,COLOR_YELLOW,string);
format(string,sizeof(string),"Administrator %s has created a faction for you with name %s.",PN(playerid),name);
SCM(id,COLOR_YELLOW,string);
FacCount++;
}
}
return 1;
}
CREATE TABLE IF NOT EXISTS `Faction` ...
It's generally not worth the effort to create tables via Pawn. Just create the database and the table structure in phpMyAdmin or another GUI you might have.
|
mysql_log(ERROR | WARNING);
db_logging 1
[16:30:05] [Warning] db_query: Query failed: near ",": syntax error
db_log_queries 1