Help!!
#1

Hello.
This command is from DrEdit object editor, In this object editor, /createnewobject command is bugged:
When i /createnewobject, The objects goes to Position: 0,0,0, But it should comes in front of me:

Код:
CMD:createnewobject(playerid, params[])
{
	if(pInfo[playerid][editing] != true) return SendClientErrorMessage(playerid, 7); 
	new model, Float:distance;
  	if(sscanf(params, "iF(10.0)", model, distance))
	{
		SendClientMessage(playerid, COLOR_USAGE, "Usage: /createnewobject [modelid] <distance>");
		SendClientMessage(playerid, COLOR_USAGE2, "> Creates a new object using the defined model ID and distance.");
		SendClientMessage(playerid, COLOR_USAGE2, "> If no distance is entered, the default value of 10.0m is used.");
		#if USE_COMMAND_SHORTCUTS == true
		SendClientMessage(playerid, COLOR_USAGE2, "> The shortcut for this command is /cno.");
		#endif
	}
	else
	{
	    if(pInfo[playerid][totalobjects] < MAX_CREATED_OBJECTS)
	    {
			#if USE_MAX_CREATE_DISTANCE == true
			if(distance > MAX_CREATE_DISTANCE) return SendClientErrorMessage(playerid, 5);
			#endif
		    for(new i = 0; i < MAX_CREATED_OBJECTS; i++)
		    {
		        if(oInfo[playerid][i][created] == 0)
		        {
		            oInfo[playerid][i][created] = 1;
					if(pInfo[playerid][flyeditor] == 1)
					{
								new
									Float:fPX, Float:fPY, Float:fPZ,
									Float:fVX, Float:fVY, Float:fVZ;
								GetPlayerCameraPos(playerid, fPX, fPY, fPZ);
								GetPlayerCameraFrontVector(playerid, fVX, fVY, fVZ);
								oInfo[playerid][i][modelID]  = model;
								oInfo[playerid][i][XLoc] = fPX + floatmul(fVX, distance);
								oInfo[playerid][i][YLoc] = fPY + floatmul(fVY, distance);
								oInfo[playerid][i][ZLoc] = fPZ + floatmul(fVZ, distance);
								oInfo[playerid][i][XRot] 	 = 0.0;
								oInfo[playerid][i][YRot] 	 = 0.0;
								oInfo[playerid][i][ZRot] 	 = 0.0;
								oInfo[playerid][i][objectID] = CreateObject(model,oInfo[playerid][i][XLoc], oInfo[playerid][i][YLoc], oInfo[playerid][i][ZLoc],0,0,0);
								pInfo[playerid][totalobjects]		 ++;
								new string[100];
								format(string, sizeof(string), "Created object number {F58282}%i{F5F582} (Model {F58282}%i{F5F582}) %.1f meter infront of you.", i, oInfo[playerid][i][modelID], distance);
								SendClientMessage(playerid, COLOR_INFO, string);
					}
					else
					{
						new Float:X, Float:Y, Float:Z;
						new Float:rot;
						GetPlayerPos(playerid, X, Y, Z);
						if(IsPlayerInAnyVehicle(playerid))
							GetVehicleZAngle(GetPlayerVehicleID(playerid), rot);
						else
							GetPlayerFacingAngle(playerid, rot);
						oInfo[playerid][i][modelID]  = model;
						oInfo[playerid][i][XLoc] 	 = X + (distance * floatsin(-rot, degrees));
						oInfo[playerid][i][YLoc] 	 = Y + (distance * floatcos(-rot, degrees));
						oInfo[playerid][i][ZLoc] 	 = Z;
						oInfo[playerid][i][XRot] 	 = 0.0;
						oInfo[playerid][i][YRot] 	 = 0.0;
						oInfo[playerid][i][ZRot] 	 = 0.0;
						oInfo[playerid][i][objectID] = CreateObject(model,X + (distance * floatsin(-rot, degrees)), Y + (distance * floatcos(-rot, degrees)), Z,0,0,0);
						pInfo[playerid][totalobjects]		 ++;
						new string[100];
						format(string, sizeof(string), "Created object number {F58282}%i{F5F582} (Model {F58282}%i{F5F582}) %.1f meter infront of you.", i, oInfo[playerid][i][modelID], distance);
						SendClientMessage(playerid, COLOR_INFO, string);
					}
					#if ALLOW_EDIT_OBJECT_ON_CREATE == true
					if(pInfo[playerid][EditObjectOnCreate] == true)
					{
						pInfo[playerid][editobject] = i;
						EditObject(playerid, oInfo[playerid][i][objectID]);
					}
					#endif
					#if ALLOW_USE_3D_LABELS == true
					if(pInfo[playerid][UseLabels] == true)
					{
						new labeltext[200];
						format(labeltext, 200, "Object Number: %i\nModel ID: %i\nRotation: 0.0, 0.0, 0.0", i, model);
						oInfo[playerid][i][labelID] = CreatePlayer3DTextLabel(playerid, labeltext, -1, oInfo[playerid][i][XLoc], oInfo[playerid][i][YLoc], oInfo[playerid][i][ZLoc], 10.0, 0, 0, 0);
					}
					#endif
	                break;
				}
			}
		}
		else
		{
		    SendClientErrorMessage(playerid, 2);
		}
	}
  	return 1;
}
Reply
#2

I think that you should post this issue in his thread.
This is the position where it spawns...
"oInfo[playerid][i][XRot] = 0.0;
oInfo[playerid][i][YRot] = 0.0;
oInfo[playerid][i][ZRot] = 0.0;"
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)