Why objects get a name?
#1

Whenever i create an object and restart, The objects get a weird numbers, Like a 3dtext
Check the picture out : http://prntscr.com/fadn3p
Any idea how to create them without see-ing them?

Код:
CMD:createobj(playerid, params[])
{
	new string[128], object;
   	if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
	if(PlayerInfo[playerid][pMapper] < 1) return SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use this command.");
	if(!mDuty[playerid]) return SendClientMessage(playerid, COLOR_GREY, "You are not on Mapper Duty.");
	if(sscanf(params, "i", object)) return SendClientMessage(playerid, COLOR_WHITE, "[Usage]: /createobj [objectid]");

	for(new idx=1; idx<MAX_OBJ; idx++)
	{
	    if(!ObjInfo[idx][oModel])
	    {
	        GetPlayerPos(playerid, ObjInfo[idx][oX], ObjInfo[idx][oY], ObjInfo[idx][oZ]);
  			ObjInfo[idx][oModel] = object;
  			oldoID = ObjInfo[idx][oModel];
  			oldodX = ObjInfo[idx][oX];
  			oldodY = ObjInfo[idx][oY];
  			oldodZ = ObjInfo[idx][oZ];
  			oldodRX = ObjInfo[idx][oRX];
  			oldodRY = ObjInfo[idx][oRY];
  			oldodRZ = ObjInfo[idx][oRZ];
			ObjInfo[idx][oX] = ObjInfo[idx][oX] + 2;
			ObjInfo[idx][oY] = ObjInfo[idx][oY] + 2;
			ObjInfo[idx][oRX] = 0;
			ObjInfo[idx][oRY] = 0;
			ObjInfo[idx][oRZ] = 0;
			// Creating
            ObjInfo[idx][obj] = CreateDynamicObject(ObjInfo[idx][oModel], ObjInfo[idx][oX], ObjInfo[idx][oY], ObjInfo[idx][oZ], ObjInfo[idx][oRX], ObjInfo[idx][oRY], ObjInfo[idx][oRZ]);
			// Text
			format(string, sizeof(string), "MapperWarn: %s has created object ID %d. (Object: %d)", RPN(playerid), idx, object);
		    SendMapperMessage(COLOR_GREEN, 1, string);
			Log("logs/cbject.log", string);
			idx = MAX_OBJ;
		}
	}
	return 1;
}
Reply
#2

Show us your object loading function
Reply
#3

Quote:
Originally Posted by Troydere
Посмотреть сообщение
Show us your object loading function
Код:
stock LoadCsObjects()
{
	new dinfo[15][128];
	new string[256];
	new File:file = fopen("objects22.cfg", io_read);
	if(file)
	{
	    new idx = 1;
		while(idx < MAX_OBJ)
		{
		    fread(file, string);
		    split(string, dinfo, '|');
			ObjInfo[idx][oModel] = strval(dinfo[0]);
			ObjInfo[idx][oX] = floatstr(dinfo[1]);
			ObjInfo[idx][oY] = floatstr(dinfo[2]);
			ObjInfo[idx][oZ] = floatstr(dinfo[3]);
			ObjInfo[idx][oRX] = floatstr(dinfo[4]);
			ObjInfo[idx][oRY] = floatstr(dinfo[5]);
			ObjInfo[idx][oRZ] = floatstr(dinfo[6]);
			if(ObjInfo[idx][oModel]) // If gate exists
			{
				ObjInfo[idx][obj] = CreateDynamicObject(ObjInfo[idx][oModel], ObjInfo[idx][oX], ObjInfo[idx][oY], ObjInfo[idx][oZ], ObjInfo[idx][oRX], ObjInfo[idx][oRY], ObjInfo[idx][oRZ]);
				ObjInfo[idx][oText] = CreateDynamic3DTextLabel(string, COLOR_WHITE, ObjInfo[idx][oX], ObjInfo[idx][oY], ObjInfo[idx][oZ], 10);
			}
			idx++;
	    }
	}
	print("Objects loaded successfully.");
	return 1;
}

stock LoadCsgObjects()
{
	new dinfo[15][128];
	new string[256];
	new File:file = fopen("objects22g.cfg", io_read);
	if(file)
	{
	    new idx = 1;
		while(idx < MAX_gOBJ)
		{
		    fread(file, string);
		    split(string, dinfo, '|');
			ObjgInfo[idx][ogModel] = strval(dinfo[0]);
			ObjgInfo[idx][ogX] = floatstr(dinfo[1]);
			ObjgInfo[idx][ogY] = floatstr(dinfo[2]);
			ObjgInfo[idx][ogZ] = floatstr(dinfo[3]);
			ObjgInfo[idx][ogRX] = floatstr(dinfo[4]);
			ObjgInfo[idx][ogRY] = floatstr(dinfo[5]);
			ObjgInfo[idx][ogRZ] = floatstr(dinfo[6]);
			if(ObjgInfo[idx][ogModel]) // If gate exists
			{
				ObjgInfo[idx][gobj] = CreateDynamicObject(ObjgInfo[idx][ogModel], ObjgInfo[idx][ogX], ObjgInfo[idx][ogY], ObjgInfo[idx][ogZ], ObjgInfo[idx][ogRX], ObjgInfo[idx][ogRY], ObjgInfo[idx][ogRZ]);
				ObjgInfo[idx][goText] = CreateDynamic3DTextLabel(string, COLOR_WHITE, ObjgInfo[idx][ogX], ObjgInfo[idx][ogY], ObjgInfo[idx][ogZ], 10);
			}
			idx++;
	    }
	}
	print("Objects loaded successfully.");
	return 1;
}
Thanks for helping, This is the code!
Reply
#4

Quote:

ObjgInfo[idx][goText] = CreateDynamic3DTextLabel(string, COLOR_WHITE, ObjgInfo[idx][ogX], ObjgInfo[idx][ogY], ObjgInfo[idx][ogZ], 10);

Remove it to remove that Dynamic 3D Text
Reply
#5

Thanks dude, gonna take a quick look and test it tomorrow.
Reply
#6

Remove object name on loadobject
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)