MySQL insert / bad code.
#1

Код:
	if(strcmp(cmd, "/addhouse", true) == 0)
	{
	  if(IsPlayerConnected(playerid))
	  {
			tmp = strtok(cmdtext, idx);
			if(!strlen(tmp))
			{
				SendClientMessage(playerid, COLOR_GRAD1, "USAGE: /addhouse [level] [price] [description]");
				return 1;
			}
			if (PlayerInfo[playerid][pAdmin] >= 5)
			{
				new id;
				id = strval(tmp);
				tmp = strtok(cmdtext, idx);
				if(!strlen(tmp))
				{
					SendClientMessage(playerid, COLOR_GRAD1, "USAGE: /addhouse [level] [price] [description]");
					return 1;
				}

				new id2;
				id2 = strval(tmp);

				if(id2 < 1 || id2 > 999999)
				{
					SendClientMessage(playerid, COLOR_GRAD1, "  The price must not be lower than $1 or higher than $999,999!");
					return 1;
				}

				new description;
				description = strval(tmp);
				tmp = strtok(cmdtext, idx);
				if(!strlen(tmp))
				{
					SendClientMessage(playerid, COLOR_GRAD1, "USAGE: /addhouse [level] [price] [description]");
					return 1;
				}

				new Float:plocx,Float:plocy,Float:plocz;
				GetPlayerPos(playerid, plocx, plocy, plocz);
				AddStaticPickup(1239, 2, plocx, plocy, plocz);
				format(string, sizeof(string), "INSERT INTO property (ent_x, ent_y, ent_z, description, level, price) VALUES('%s', '%s', '%s', '%s', '%s', '%s')", plocx, plocy, plocz, description, id, id2);
				samp_mysql_query(string);
				
				SendClientMessage(playerid, COLOR_YELLOW, "House successfully created!");
				return 1;

			}
			else
			{
				SendClientMessage(playerid, COLOR_GRAD1, "Your not an administrator.");
			}
		}
		return 1;
	}
Hey, I made this code to use alongside CW-RP's game mode, however, it creates the pickup but doesn't insert the MySQL record, what am I to do?
Reply
#2

Anyone? I urgently need this fixed.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)