Updating toys system help.
#1

How can i update my toys system from coordinate to drag?
Reply
#2

Would you mind if you explain more please ? and post your codes if you have.
Reply
#3

My toys system is a attachment to player but using coordinate but now 0.3x has a dragging one so easy can drag the object.
Reply
#4

Код:
if((dialogid == EDITTOYS2))
	{
		if(response)
		{
			if(listitem == 0)
			{
				ShowPlayerDialog(playerid, EDITTOYSBONE, DIALOG_STYLE_LIST, "Select a Bone", "Spine\nHead\nLeft upper arm\nRight upper arm\nLeft hand\nRight hand\nLeft thigh\nRight thigh\nLeft foot\nRight foot\nRight calf\nLeft calf\nLeft forearm\nRight forearm\nLeft clavicle\nRight clavicle\nNeck\nJaw", "Select", "Cancel");
			}
			else if(listitem == 1)
			{
				ShowPlayerDialog(playerid, EDITTOYSPX, DIALOG_STYLE_INPUT, "Toy Menu: Edit", "Input an X Offset from -100 to 100 (Ex: 55, or 33.4)", "Enter", "Cancel");
			}
			else if(listitem == 2)
			{
				ShowPlayerDialog(playerid, EDITTOYSPY, DIALOG_STYLE_INPUT, "Toy Menu: Edit", "Input an Y Offset from -100 to 100 (Ex: 55, or 33.4)", "Enter", "Cancel");
			}
			else if(listitem == 3)
			{
				ShowPlayerDialog(playerid, EDITTOYSPZ, DIALOG_STYLE_INPUT, "Toy Menu: Edit", "Input an Z Offset from -100 to 100 (Ex: 55, or 33.4)", "Enter", "Cancel");
			}
			else if(listitem == 4)
			{
				ShowPlayerDialog(playerid, EDITTOYSRX, DIALOG_STYLE_INPUT, "Toy Menu: Edit", "Input an X Rotation from 0 to 360 (Ex: 90, or 270.4)", "Enter", "Cancel");
			}
			else if(listitem == 5)
			{
				ShowPlayerDialog(playerid, EDITTOYSRY, DIALOG_STYLE_INPUT, "Toy Menu: Edit", "Input an Y Rotation from 0 to 360 (Ex: 90, or 270.4)", "Enter", "Cancel");
			}
			else if(listitem == 6)
			{
				ShowPlayerDialog(playerid, EDITTOYSRZ, DIALOG_STYLE_INPUT, "Toy Menu: Edit", "Input an Z Rotation from 0 to 360 (Ex: 90, or 270.4)", "Enter", "Cancel");
			}
			else if(listitem == 7)
			{
				ShowPlayerDialog(playerid, EDITTOYSSX, DIALOG_STYLE_INPUT, "Toy Menu: Edit","Input an X Scale from 0.5 to 2", "Enter", "Cancel");
			}
			else if(listitem == 8)
			{
				ShowPlayerDialog(playerid, EDITTOYSSY, DIALOG_STYLE_INPUT, "Toy Menu: Edit","Input an Y Scale from 0.5 to 2", "Enter", "Cancel");
			}
			else if(listitem == 9)
			{
				ShowPlayerDialog(playerid, EDITTOYSSZ, DIALOG_STYLE_INPUT, "Toy Menu: Edit","Input an Z Scale from 0.5 to 2", "Enter", "Cancel");
			}
		}
This is example i want to change to dragging object not to put coordinate.
Reply
#5

That will help you doing this https://sampwiki.blast.hk/wiki/EditAttachedObject
Reply
#6

But how can i know where to put it in my script
Reply
#7

Try this:

Код:
if((dialogid == EDITTOYS2)) {
	    if(response) switch(listitem) {
		    case 0: ShowPlayerDialog(playerid, 9999, DIALOG_STYLE_LIST, "Select a Bone", "Spine\nHead\nLeft upper arm\nRight upper arm\nLeft hand\nRight hand\nLeft thigh\nRight thigh\nLeft foot\nRight foot\nRight calf\nLeft calf\nLeft forearm\nRight forearm\nLeft clavicle\nRight clavicle\nNeck\nJaw", "Select", "Cancel");
		    case 1:
			{
			    SendClientMessage(playerid, COLOR_WHITE, "HINT: Hold {8000FF}~k~~PED_SPRINT~ {FFFFAA}to move your camera, press escape to cancel");
				EditAttachedObject(playerid, GetPVarInt(playerid, "ToySlot"));
			}
		}
Reply
#8

Ok thanks it can drag but there's another problem i cant choose the toy to edit it. It choose the first toys.

Код:
stock ShowEditMenu(playerid)
{
    if(IsPlayerAttachedObjectSlotUsed(playerid, slotselection[playerid]))
	{
 		RemovePlayerAttachedObject(playerid, slotselection[playerid]);
	}
	SetPlayerAttachedObject(playerid, slotselection[playerid], PlayerToyInfo[playerid][slotselection[playerid]][ptModelID],
	PlayerToyInfo[playerid][slotselection[playerid]][ptBone], PlayerToyInfo[playerid][slotselection[playerid]][ptPosX],
	PlayerToyInfo[playerid][slotselection[playerid]][ptPosY], PlayerToyInfo[playerid][slotselection[playerid]][ptPosZ],
	PlayerToyInfo[playerid][slotselection[playerid]][ptRotX], PlayerToyInfo[playerid][slotselection[playerid]][ptRotY],
	PlayerToyInfo[playerid][slotselection[playerid]][ptRotZ], 1, 1, 1);

    new stringg[512];
    format(stringg, sizeof(stringg), "%sBone (%s)\n", stringg, HoldingBones[PlayerToyInfo[playerid][slotselection[playerid]][ptBone]]);
	format(stringg, sizeof(stringg), "%sOffset X (%f)\n", stringg,(PlayerToyInfo[playerid][slotselection[playerid]][ptPosX]*100));
	format(stringg, sizeof(stringg), "%sOffset Y (%f)\n", stringg,(PlayerToyInfo[playerid][slotselection[playerid]][ptPosY]*100));
	format(stringg, sizeof(stringg), "%sOffset Z (%f)\n", stringg,(PlayerToyInfo[playerid][slotselection[playerid]][ptPosZ]*100));
	format(stringg, sizeof(stringg), "%sRotation X (%f)\n", stringg, PlayerToyInfo[playerid][slotselection[playerid]][ptRotX]);
	format(stringg, sizeof(stringg), "%sRotation Y (%f)\n", stringg, PlayerToyInfo[playerid][slotselection[playerid]][ptRotY]);
	format(stringg, sizeof(stringg), "%sRotation Z (%f)" ,stringg, PlayerToyInfo[playerid][slotselection[playerid]][ptRotZ]);
 	ShowPlayerDialog(playerid, EDITTOYS2, DIALOG_STYLE_LIST, "Toy Menu: Edit", stringg, "Select", "Cancel");
}
Do i need to delete this?
Reply
#9

And this thing

Код:
if(dialogid == EDITTOYSPX)
	{
	    if(response)
	    {
	        new Float:offset = floatstr(inputtext);
	        if(offset < -100) offset = 0;
			else if(offset > 100) offset = 100;
	        offset = offset/100;
	        PlayerToyInfo[playerid][slotselection[playerid]][ptPosX] = offset;
		}
		ShowEditMenu(playerid);
	}
	if(dialogid == EDITTOYSPY)
	{
	    if(response)
	    {
	        new Float:offset = floatstr(inputtext);
     		if(offset < -100) offset = 0;
			else if(offset > 100) offset = 100;
	        offset = offset/100;
	        PlayerToyInfo[playerid][slotselection[playerid]][ptPosY] = offset;
		}
		ShowEditMenu(playerid);
	}
	if(dialogid == EDITTOYSPZ)
	{
	    if(response)
	    {
	        new Float:offset = floatstr(inputtext);
	        if(offset < -100) offset = 0;
			else if(offset > 100) offset = 100;
			offset = offset/100;
	        PlayerToyInfo[playerid][slotselection[playerid]][ptPosZ] = offset;
		}
		ShowEditMenu(playerid);
	}
	if(dialogid == EDITTOYSRX)
	{
	    if(response)
	    {
	        new Float:offset = floatstr(inputtext);
	        if(offset < -100) offset = 0;
			else if(offset > 360) offset = 360;
	        PlayerToyInfo[playerid][slotselection[playerid]][ptRotX] = offset;
		}
		ShowEditMenu(playerid);
	}
	if(dialogid == EDITTOYSRY)
	{
	    if(response)
	    {
	        new Float:offset = floatstr(inputtext);
	        if(offset < -100) offset = 0;
			else if(offset > 360) offset = 360;
	        PlayerToyInfo[playerid][slotselection[playerid]][ptRotY] = offset;
		}
		ShowEditMenu(playerid);
	}
	if(dialogid == EDITTOYSRZ)
	{
	    if(response)
	    {
	        new Float:offset = floatstr(inputtext);
	        if(offset < -100) offset = 0;
			else if(offset > 360) offset = 360;
	        PlayerToyInfo[playerid][slotselection[playerid]][ptRotZ] = offset;
		}
		ShowEditMenu(playerid);
	}
    if(dialogid == EDITTOYSBONE)
	{
	    if(response)
	    {
	        PlayerToyInfo[playerid][slotselection[playerid]][ptBone] = listitem+1;
		}
	 	ShowEditMenu(playerid);
	}
Reply
#10

Change ur ShowEditMenu stock to this one:

Код:
stock ShowEditMenu(playerid)
{
	new
		iIndex = GetPVarInt(playerid, "ToySlot");

    if(IsPlayerAttachedObjectSlotUsed(playerid, iIndex))
	{
 		RemovePlayerAttachedObject(playerid, iIndex);
	}
	if(PlayerToyInfo[playerid][iIndex][ptScaleX] == 0) {
		PlayerToyInfo[playerid][iIndex][ptScaleX] = 1.0;
		PlayerToyInfo[playerid][iIndex][ptScaleY] = 1.0;
		PlayerToyInfo[playerid][iIndex][ptScaleZ] = 1.0;
	}

	SetPlayerAttachedObject(playerid, iIndex, PlayerToyInfo[playerid][iIndex][ptModelID],
	PlayerToyInfo[playerid][iIndex][ptBone], PlayerToyInfo[playerid][iIndex][ptPosX],
	PlayerToyInfo[playerid][iIndex][ptPosY], PlayerToyInfo[playerid][iIndex][ptPosZ],
	PlayerToyInfo[playerid][iIndex][ptRotX], PlayerToyInfo[playerid][iIndex][ptRotY],
	PlayerToyInfo[playerid][iIndex][ptRotZ], PlayerToyInfo[playerid][iIndex][ptScaleX],
	PlayerToyInfo[playerid][iIndex][ptScaleY], PlayerToyInfo[playerid][iIndex][ptScaleZ]);

    new stringg[128];
    format(stringg, sizeof(stringg), "Bone (%s)\nOffset", HoldingBones[PlayerToyInfo[playerid][iIndex][ptBone]]);
 	ShowPlayerDialog(playerid, EDITTOYS2, DIALOG_STYLE_LIST, "Toy Menu: Edit", stringg, "Select", "Cancel");
}
And delete this:

Код:
if(dialogid == EDITTOYSPX)
	{
	    if(response)
	    {
	        new Float:offset = floatstr(inputtext);
	        if(offset < -100) offset = 0;
			else if(offset > 100) offset = 100;
	        offset = offset/100;
	        PlayerToyInfo[playerid][slotselection[playerid]][ptPosX] = offset;
		}
		ShowEditMenu(playerid);
	}
	if(dialogid == EDITTOYSPY)
	{
	    if(response)
	    {
	        new Float:offset = floatstr(inputtext);
     		if(offset < -100) offset = 0;
			else if(offset > 100) offset = 100;
	        offset = offset/100;
	        PlayerToyInfo[playerid][slotselection[playerid]][ptPosY] = offset;
		}
		ShowEditMenu(playerid);
	}
	if(dialogid == EDITTOYSPZ)
	{
	    if(response)
	    {
	        new Float:offset = floatstr(inputtext);
	        if(offset < -100) offset = 0;
			else if(offset > 100) offset = 100;
			offset = offset/100;
	        PlayerToyInfo[playerid][slotselection[playerid]][ptPosZ] = offset;
		}
		ShowEditMenu(playerid);
	}
	if(dialogid == EDITTOYSRX)
	{
	    if(response)
	    {
	        new Float:offset = floatstr(inputtext);
	        if(offset < -100) offset = 0;
			else if(offset > 360) offset = 360;
	        PlayerToyInfo[playerid][slotselection[playerid]][ptRotX] = offset;
		}
		ShowEditMenu(playerid);
	}
	if(dialogid == EDITTOYSRY)
	{
	    if(response)
	    {
	        new Float:offset = floatstr(inputtext);
	        if(offset < -100) offset = 0;
			else if(offset > 360) offset = 360;
	        PlayerToyInfo[playerid][slotselection[playerid]][ptRotY] = offset;
		}
		ShowEditMenu(playerid);
	}
	if(dialogid == EDITTOYSRZ)
	{
	    if(response)
	    {
	        new Float:offset = floatstr(inputtext);
	        if(offset < -100) offset = 0;
			else if(offset > 360) offset = 360;
	        PlayerToyInfo[playerid][slotselection[playerid]][ptRotZ] = offset;
		}
		ShowEditMenu(playerid);
	}
    if(dialogid == EDITTOYSBONE)
	{
	    if(response)
	    {
	        PlayerToyInfo[playerid][slotselection[playerid]][ptBone] = listitem+1;
		}
	 	ShowEditMenu(playerid);
	}
Hope this help.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)