Invalid function or declaration
#1

Hey, i've gotta a stupid problem here. While i'm trying to compile my script i'm getting this error.
Код:
drugs.inc(1) : error 010: invalid function or declaration
Код:
#undef MAX_PLANT
#define MAX_PLANTS 50


forward Plant_Create( playerid, type );
forward Plant_Delete( uid );
forward Plant_Save( uid );
forward Plant_Load();

enum plantGameInfo
{
	plantID,
	Float:plantPos[3],
	plantWorld,
	plantInterior,
	plantProgress,
	plantWaterlevel,
	plantOxydizerlevel,
	plantPlayer,
	plantType,
	Text3D:planttxt,
	
	plantObject
}

new PlantInfo[MAX_PLANTS][plantGameInfo];

public Plant_Create( playerid, type )
{
	new Float:Pos[3],
	world = GetPlayerVirtualWorld( playerid ),
	interior = GetPlayerInterior( playerid ),
	player = pInfo[playerid][player_id];
	
	GetPlayerPos( playerid, Pos[0], Pos[1], Pos[2] );
	
	mysql_query(sprintf( "INSERT INTO `plants` SET `plant_pos_x` = '%f', `plant_pos_y` = '%f', `plant_pos_z` = '%f', `plant_world` = '%d', `plant_interior` = '%d', `plant_player` = '%d', `plant_type` = '%d'", Pos[0], Pos[1], Pos[2], world, interior, player, type  ));
	new uid = mysql_insert_id();
	
	PlantInfo[uid][plantID]				= uid;
	PlantInfo[uid][plantPos][0]			= Pos[0];
	PlantInfo[uid][plantPos][1]			= Pos[1];
	PlantInfo[uid][plantPos][2]			= Pos[2];
	PlantInfo[uid][plantWorld]			= world;
	PlantInfo[uid][plantInterior]		= interior;
	PlantInfo[uid][plantProgress]		= 0;
	PlantInfo[uid][plantWaterlevel]	= 0;
	PlantInfo[uid][plantOxydizerlevel]	= 0;
	PlantInfo[uid][plantPlayer]			= player;
	PlantInfo[uid][plantType]			= type;
	
	PlantInfo[uid][plantObject]			= CreateDynamicObject( 678, Pos[0], Pos[1], Pos[2] - 1.0, 0.0, 0.0, 0.0, world, interior );
	
	PlantInfo[uid][planttxt] = Create3DTextLabel("/plant",COLOR_WHITE,PlantInfo[uid][plantPos][0],PlantInfo[uid][plantPos][1],PlantInfo[uid][plantPos][2] , 5, PlantInfo[uid][plantWorld], 1);
	
	Streamer_Update( playerid );
	return uid;
}

public Plant_Delete( uid )
{
	mysql_query(sprintf( "DELETE FROM `plants` WHERE `plant_uid` = '%d'", uid  ));
	
	PlantInfo[uid][plantID]				= 0;
	PlantInfo[uid][plantPos][0]			= 0.0;
	PlantInfo[uid][plantPos][1]			= 0.0;
	PlantInfo[uid][plantPos][2]			= 0.0;
	PlantInfo[uid][plantWorld]			= 0;
	PlantInfo[uid][plantInterior]		= 0;
	PlantInfo[uid][plantProgress]		= 0;
	PlantInfo[uid][plantWaterlevel]	= 0;
	PlantInfo[uid][plantOxydizerlevel]	= 0;
	PlantInfo[uid][plantPlayer]			= 0;
	PlantInfo[uid][plantType]			= 0;
	
	DestroyDynamicObject( PlantInfo[uid][plantObject] );
}

public Plant_Save( uid )
{
	mysql_query(sprintf( "UPDATE `plants` SET `plant_player` = '%d', `plant_type` = '%d', `plant_progress` = '%d', `plant_waterlevel` = '%d', `plant_oxydizerlevel` = '%d' WHERE `plant_uid` = '%d'", PlantInfo[uid][plantPlayer], PlantInfo[uid][plantType], PlantInfo[uid][plantProgress], PlantInfo[uid][plantWaterlevel], PlantInfo[uid][plantOxydizerlevel], PlantInfo[uid][plantID] ));
}

public Plant_Load()
{
	new result[128], i = 0;
	mysql_query( "SELECT * FROM `plants`" );
	mysql_store_result();
	
	while( mysql_fetch_row(result, "|") == 1 )
	{
		new uid;
		sscanf(result, 	"p<|>d", uid);
		sscanf(result, "p<|>dfffddddddd",	PlantInfo[uid][plantID],
		PlantInfo[uid][plantPos][0],
		PlantInfo[uid][plantPos][1],
		PlantInfo[uid][plantPos][2],
		PlantInfo[uid][plantWorld],
		PlantInfo[uid][plantInterior],
		PlantInfo[uid][plantProgress],
		PlantInfo[uid][plantWaterlevel],
		PlantInfo[uid][plantOxydizerlevel],
		PlantInfo[uid][plantPlayer],
		PlantInfo[uid][plantType]);
		
		PlantInfo[uid][plantObject]	= CreateDynamicObject( 678, PlantInfo[uid][plantPos][0], PlantInfo[uid][plantPos][1], PlantInfo[uid][plantPos][2] - 1.0, 0.0, 0.0, 0.0, PlantInfo[uid][plantWorld], PlantInfo[uid][plantInterior] );
		//PlantInfo[uid][planttxt] = Create3DTextLabel("/plant",COLOR_WHITE,PlantInfo[uid][plantPos][0],PlantInfo[uid][plantPos][1],PlantInfo[uid][plantPos][2] , 5, PlantInfo[uid][plantWorld], 1);
		i ++;
	}
	
	mysql_free_result();
	
	printf("[LOAD] %d plants were loaded.", i);
	return 1;
}
Reply
#2

there is no MAX_PLANT define
Reply
#3

"MAX_PLANT" isn't defined already, you should make a check unless you're certain something is defined, by doing so:
pawn Код:
#if defined MAX_PLANT
    #undef MAX_PLANT
#endif
#define MAX_PLANTS 50
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)