PDA

View Full Version : Making Dynamic Org


Tanush123
01/01/2012, 06:25 AM
EDIT: the problem is
CMD:createorg(playerid,params[])
{
if(!IsPlayerAdmin(playerid)) return 0;
if(sscanf(params,"iis",orgid,orggenre,oname)) return SendClientMessage(playerid,grey,"USAGE: /createorg [Orgid] [Genre] [Name]");
if(orgid > MAX_ORGS) return SendClientMessage(playerid,red,"Available Org 1-15");
CheckMySQL();
format(str,sizeof(str),"SELECT * FROM orgs");
mysql_query(str);
mysql_store_result();
if(mysql_num_rows() == 0)
{
mysql_free_result();
format(str,sizeof(str),"INSERT INTO orgs (Orgid,Name,Genre,Leader,Members,Skin1,Skin2,Skin3 ) VALUES ('%d','%s','%d',No Leader,0,0,0,0)",orgid,oname,orggenre);
mysql_query(str);
format(str,sizeof(str),"You have created created org id %d with genre %d",orgid,orggenre);
SendClientMessage(playerid,COLOR_YELLOW,str);
format(str,sizeof(str),"Org Name: %s",oname);
SendClientMessage(playerid,COLOR_YELLOW,str);
}
else
{
SendClientMessage(playerid,red,"ERROR: This Organization ID is already used.");
}
return 1;
}

James Coral
01/01/2012, 06:33 AM
lol you have enum s?

Tanush123
01/01/2012, 06:50 AM
no i dont

[HiC]TheKiller
01/01/2012, 06:52 AM
mysql_debug(1);


at the top of your script, then post your mysql log file that is located in your server directory.

Tanush123
01/01/2012, 07:01 AM
[09:05:51] CMySQLHandler::Query(INSERT INTO orgs (Orgid,Name,Genre,Leader,Members,Skin1,Skin2,Skin3 ) VALUES ('1','k','1',No Leader,0,0,0,0))
An error has occured. (Error ID: 1064, You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'Leader,0,0,0,0)' at line 1) When i used /createorg 1 1 k.

i think the problem is CMD:createorg(playerid,params[])
{
if(!IsPlayerAdmin(playerid)) return 0;
if(sscanf(params,"iis",orgid,orggenre,oname)) return SendClientMessage(playerid,grey,"USAGE: /createorg [Orgid] [Genre] [Name]");
if(orgid > MAX_ORGS) return SendClientMessage(playerid,red,"Available Org 1-15");
CheckMySQL();
format(str,sizeof(str),"SELECT * FROM orgs");
mysql_query(str);
mysql_store_result();
if(mysql_num_rows() == 0)
{
mysql_free_result();
format(str,sizeof(str),"INSERT INTO orgs (Orgid,Name,Genre,Leader,Members,Skin1,Skin2,Skin3 ) VALUES ('%d','%s','%d',No Leader,0,0,0,0)",orgid,oname,orggenre);
mysql_query(str);
format(str,sizeof(str),"You have created created org id %d with genre %d",orgid,orggenre);
SendClientMessage(playerid,COLOR_YELLOW,str);
format(str,sizeof(str),"Org Name: %s",oname);
SendClientMessage(playerid,COLOR_YELLOW,str);
}
else
{
SendClientMessage(playerid,red,"ERROR: This Organization ID is already used.");
}
return 1;
}i just saw it wont INSERT into my mysql database when i use /createorg

jamesbond007
01/01/2012, 07:05 AM
change No Leader to NULL ?

or u can do 'No leader'

Tanush123
01/01/2012, 07:09 AM
change No Leader to NULL ?

or u can do 'No leader'

thank you, iadded ' ', repped