06.09.2017, 01:44
Well OnPlayerSelectObject..it shud give em perms to edit that object but that's not working.. idk what's wrong here tbh.
It doesn't let me edit the object upon selecting.. like the edit arrows doesn't open.. btw used PVAR MovingTag MovingTag(int) - 1 to edit/move the tag, 2 to delete
Код:
public wallTagEdit(playerid) { SetPVarInt(playerid, "MovingTag", 1); SelectObject(playerid); return 1; }
Код:
OnPlayerSelectObject(playerid, objectid, modelid, Float:x, Float:y, Float:z) { #pragma unused x #pragma unused y #pragma unused z #pragma unused modelid new family = -1; new movingtag = GetPVarInt(playerid, "MovingTag"); DeletePVar(playerid, "MovingTag"); new index = findWallTagByObjID(objectid); new sqlid = findWallTagSQLIDByObjID(objectid); if(GetPVarInt(playerid, "WallTagInfo") == 1) { if(index != -1) { DisplayTagInfo(playerid, index); } } if(index != -1) { new rank = GetPVarInt(playerid, "Rank")-1; family = FindFamilyBySQLID(GetPVarInt(playerid, "Family")); if(family != -1) { new EFamilyPermissions:rankperms = EFamilyPermissions:Families[family][EFamilyRankPerms][rank]; if(~rankperms & EFamilyPerms_CanDeleteWallTags) { SendClientMessage(playerid, X11_TOMATO_2, "You do not have permissions for this"); } } if(movingtag == 1) { EditObject(playerid, objectid); } else if(movingtag == 2) { DeleteTag(sqlid); SendClientMessage(playerid, X11_YELLOW, "Tag Deleted!"); CancelEdit(playerid); } } return 0; }
Код:
OnPlayerEditObject(playerid, objectid, response, Float:x, Float:y, Float:z, Float:rx, Float:ry, Float:rz) { query[0] = 0;//[128]; if(response != EDIT_RESPONSE_FINAL) { return 0; } new sqlid = findWallTagSQLIDByObjID(objectid); new index = findWallTagByObjID(objectid); if(index != -1) { WallTagInfo[index][pWallTagX] = x; WallTagInfo[index][pWallTagY] = y; WallTagInfo[index][pWallTagZ] = z; WallTagInfo[index][pWallTagRotX] = rx; WallTagInfo[index][pWallTagRotY] = ry; WallTagInfo[index][pWallTagRotZ] = rz; SendClientMessage(playerid, X11_TOMATO_2, "Tag position saved!"); format(query, sizeof(query), "UPDATE `walltags` SET `X` = %f, `Y` = %f, `Z` = %f, `rotx` = %f, `roty` = %f, `rotz` = %f WHERE `id` = %d",x,y,z,rx,ry,rz,sqlid); SetDynamicObjectPos(objectid, x, y, z); SetDynamicObjectRot(objectid, rx, ry, rz); mysql_function_query(g_mysql_handle, query, true, "EmptyCallback",""); } return 1; }