[Ajuda] Nгo estб salvando a posiзгo
#1

O Sistema de acessуrios nгo estб salvando a posiзгo quando ele й adcionado ao player, para a pessoa que estб usando, o objeto fica aonde ele foi editado, e para os outros, ele fica na posiзгo original

Comando
Код:
CMD:usaritem(playerid, params[])
{
    static
        type[24];

    if (sscanf(params, "s[24]", type))
    {
        SendSyntaxMessage(playerid, "/usaritem [item]");
        SendClientMessage(playerid, COLOR_YELLOW, "[ITENS]:{FFFFFF} distintivo, colete, chapeu, coldre, bigode, coletetransito, oculos, retirarobjetos.");
        return 1;
    }
    if (!strcmp(type, "distintivo", true))
    {
        if (GetFactionType(playerid) != FACTION_POLICE)
            return SendErrorMessage(playerid, "Vocк deve ser um agente da polнcia.");

        SetPlayerAttachedObject(playerid, 0, 19775, 1);
        EditAttachedObject(playerid, 0);
        SendClientMessage(playerid, COLOR_WHITE, "Vocк pegou seu distintivo!");
    }
    else if (!strcmp(type, "colete", true))
    {
        if (GetFactionType(playerid) != FACTION_POLICE)
            return SendErrorMessage(playerid, "Vocк deve ser um agente da polнcia.");

        SetPlayerAttachedObject(playerid, 1, 19142, 1);
        EditAttachedObject(playerid, 1);
        SendClientMessage(playerid, COLOR_WHITE, "Vocк pegou seu colete!");
    }
    else if (!strcmp(type, "chapeu", true))
    {
        if (GetFactionType(playerid) != FACTION_POLICE)
            return SendErrorMessage(playerid, "Vocк deve ser um agente da polнcia.");

        SetPlayerAttachedObject(playerid, 2, 19095, 2);
        EditAttachedObject(playerid, 2);
        SendClientMessage(playerid, COLOR_WHITE, "Vocк pegou seu chapйu!");
    }
    else if (!strcmp(type, "coldre", true))
    {
        if (GetFactionType(playerid) != FACTION_POLICE)
            return SendErrorMessage(playerid, "Vocк deve ser um agente da polнcia.");

        SetPlayerAttachedObject(playerid, 3, 19773, 8);
        EditAttachedObject(playerid, 3);
        SendClientMessage(playerid, COLOR_WHITE, "Vocк pegou seu coldre!");
    }
    else if (!strcmp(type, "bigode", true))
    {
        if (GetFactionType(playerid) != FACTION_POLICE)
            return SendErrorMessage(playerid, "Vocк deve ser um agente da polнcia.");

        SetPlayerAttachedObject(playerid, 4, 19351, 2);
        EditAttachedObject(playerid, 4);
        SendClientMessage(playerid, COLOR_WHITE, "Vocк pegou seu bigode!");
    }
    else if (!strcmp(type, "coletetransito", true))
    {
        if (GetFactionType(playerid) != FACTION_POLICE)
            return SendErrorMessage(playerid, "Vocк deve ser um agente da polнcia.");

        SetPlayerAttachedObject(playerid, 5, 19904, 1);
        EditAttachedObject(playerid, 5);
        SendClientMessage(playerid, COLOR_WHITE, "Vocк pegou seu colete de trбnsito!");
    }
    else if (!strcmp(type, "oculos", true))
    {
        if (GetFactionType(playerid) != FACTION_POLICE)
            return SendErrorMessage(playerid, "Vocк deve ser um agente da polнcia.");

        SetPlayerAttachedObject(playerid, 6, 19138, 1);
        EditAttachedObject(playerid, 6);
        SendClientMessage(playerid, COLOR_WHITE, "Vocк pegou seu уculos!");
    }
    else if (!strcmp(type, "retirarobjetos", true))
    {
        if (GetFactionType(playerid) != FACTION_POLICE)
            return SendErrorMessage(playerid, "Vocк deve ser um agente da polнcia.");

        for(new i=0; i<MAX_PLAYER_ATTACHED_OBJECTS; i++)
        {
            if(IsPlayerAttachedObjectSlotUsed(playerid, i)) RemovePlayerAttachedObject(playerid, i);
           }
    }
    return 1;
}
Aqui estб a public
Код:
public OnPlayerEditAttachedObject(playerid, response, index, modelid, boneid, Float:fOffsetX, Float:fOffsetY, Float:fOffsetZ, Float:fRotX, Float:fRotY, Float:fRotZ, Float:fScaleX, Float:fScaleY, Float:fScaleZ)
{
	if (response)
	{
		if (PlayerData[playerid][pEditType] != 0)
 		{
 		    AccessoryData[playerid][PlayerData[playerid][pEditType]-1][0] = fOffsetX;
       		AccessoryData[playerid][PlayerData[playerid][pEditType]-1][1] = fOffsetY;
         	AccessoryData[playerid][PlayerData[playerid][pEditType]-1][2] = fOffsetZ;

          	AccessoryData[playerid][PlayerData[playerid][pEditType]-1][3] = fRotX;
           	AccessoryData[playerid][PlayerData[playerid][pEditType]-1][4] = fRotY;
           	AccessoryData[playerid][PlayerData[playerid][pEditType]-1][5] = fRotZ;

            AccessoryData[playerid][PlayerData[playerid][pEditType]-1][6] = (fScaleX > 3.0) ? (3.0) : (fScaleX);
            AccessoryData[playerid][PlayerData[playerid][pEditType]-1][7] = (fScaleY > 3.0) ? (3.0) : (fScaleY);
			AccessoryData[playerid][PlayerData[playerid][pEditType]-1][8] = (fScaleZ > 3.0) ? (3.0) : (fScaleZ);

			switch (PlayerData[playerid][pEditType])
			{
	  			case 1:
	    		{
		            PlayerData[playerid][pEditType] = 0;
		            PlayerData[playerid][pGlasses] = modelid;

					if (!PlayerData[playerid][pCreated])
					{
		                for (new i = 23; i < 34; i ++) {
				    		PlayerTextDrawShow(playerid, PlayerData[playerid][pTextdraws][i]);
						}
						SelectTextDraw(playerid, -1);
						TogglePlayerControllable(playerid, 0);
					}
		            SendServerMessage(playerid, "Vocк confirmou a posiзгo do seu уculo.");
				}
				case 2:
	    		{
	                PlayerData[playerid][pEditType] = 0;
		            PlayerData[playerid][pHat] = modelid;

	                if (!PlayerData[playerid][pCreated])
					{
		                for (new i = 23; i < 34; i ++) {
				    		PlayerTextDrawShow(playerid, PlayerData[playerid][pTextdraws][i]);
						}
						SelectTextDraw(playerid, -1);
						TogglePlayerControllable(playerid, 0);
					}
		            SendServerMessage(playerid, "Vocк confirmou a posiзгo do seu chapйu.");
				}
				case 3:
	    		{
	                PlayerData[playerid][pEditType] = 0;
		            PlayerData[playerid][pBandana] = modelid;

                 	if (!PlayerData[playerid][pCreated])
					{
		                for (new i = 23; i < 34; i ++) {
				    		PlayerTextDrawShow(playerid, PlayerData[playerid][pTextdraws][i]);
						}
						SelectTextDraw(playerid, -1);
						TogglePlayerControllable(playerid, 0);
					}
		            SendServerMessage(playerid, "Vocк confirmou a posiзгo da sua bandana.");
				}
			}
	    }
	}
	else
	{
	    if (!PlayerData[playerid][pCreated])
		{
  			for (new i = 23; i < 34; i ++) {
			  	PlayerTextDrawShow(playerid, PlayerData[playerid][pTextdraws][i]);
			}
			SelectTextDraw(playerid, -1);

			TogglePlayerControllable(playerid, 0);
			RemovePlayerAttachedObject(playerid, PlayerData[playerid][pEditType] - 1);
		}
	}
	return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)